/*
 * config.c: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id$
 */


#include "config.h"


cConsoleCommand::cConsoleCommand(void) {

  title = command = NULL;
  confirm = false;
}



cConsoleCommand::~cConsoleCommand() {

  free(title);
  free(command);
}



bool cConsoleCommand::Parse(const char *s) {

  const char *p = strchr(s, ':');
  if (p) {

    int l = p - s;
    if (l > 0) {

      title = MALLOC( char, l + 1 );
      stripspace( strn0cpy(title, s, l + 1) );
      if (! isempty(title)) {

        int l = strlen(title);
        if (l > 1 && title[l - 1] == '?') {

          confirm = true;
          title[l - 1] = 0;
        }

        command = stripspace( strdup( skipspace(p + 1) ) );
        return !isempty(command);
      }
    }
  }
  return false;
}



sConsoleConfig config;
int consoleOwnerMacro = 0;
cConsoleCommands gl_ConsoleCommands;


