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

#include "umsadmin.h"
#include "umsmenus.h"
#include "getopt.h"

cPluginUmsadmin::cPluginUmsadmin(void)
{
  // Initialize any member variables here.
  // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
  // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
}

cPluginUmsadmin::~cPluginUmsadmin()
{
  // Clean up after yourself!
}

const char *cPluginUmsadmin::CommandLineHelp(void)
{
  // Return a string that describes all known command line options.
  return "-d <dir> --csdir=<dir> -the dir to look for capisuite mailboxes.";
}

bool cPluginUmsadmin::ProcessArgs(int argc, char *argv[])
{
  // Implement command line argument processing here if applicable.
  static struct option long_options[] = 
  {
	{"csdir", required_argument,NULL,'d'},
	{NULL}
  };
  int c;
  while ((c=getopt_long(argc,argv,"d:",long_options,NULL))!=-1)	
  {
	switch (c)
	{
	    case 'd':
			csroot=strdup(optarg);
			break;
	    default:
			return false;
    						
	}
  }    			
  return true;
}

bool cPluginUmsadmin::Initialize(void)
{
  // Initialize any background activities the plugin shall perform.
  return true;
}

bool cPluginUmsadmin::Start(void)
{
  // Start any background activities the plugin shall perform.
  return true;
}

void cPluginUmsadmin::Stop(void)
{
  // Stop any background activities the plugin shall perform.
}

void cPluginUmsadmin::Housekeeping(void)
{
  // Perform any cleanup or other regular tasks.
}

cOsdObject *cPluginUmsadmin::MainMenuAction(void)
{
  return new cUMSMainMenu(csroot);
}

cMenuSetupPage *cPluginUmsadmin::SetupMenu(void)
{
  // Return a setup menu in case the plugin supports one.
  return NULL;
}

bool cPluginUmsadmin::SetupParse(const char *Name, const char *Value)
{
  // Parse your own setup parameters and store their values.
  return false;
}

bool cPluginUmsadmin::Service(const char *Id, void *Data)
{
  // Handle custom service requests from other plugins
  return false;
}

const char **cPluginUmsadmin::SVDRPHelpPages(void)
{
  // Return help text for SVDRP commands this plugin implements
  return NULL;
}

cString cPluginUmsadmin::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode)
{
  // Process SVDRP commands this plugin implements
  return NULL;
}


VDRPLUGINCREATOR(cPluginUmsadmin); // Don't touch this!
