/*
 * vdricq.c: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id: vdricq.c,v 1.12 2005/04/10 21:56:52 jurij Exp $
 */

#include <vdr/plugin.h>
#include "i18n.h"


static const char *VERSION        = "0.0.2";
static const char *DESCRIPTION    = "ICQ-Client";
static const char *MAINMENUENTRY  = "ICQ-Client";


class SimpleClient;


// --- cPluginVdrIcq ----------------------------------------------------------

class cPluginVdrIcq : public cPlugin {
private:
  // Add any member variables or functions you may need here.
  const char   *option_a;
  bool         option_b;
  SimpleClient *m_pIcqClient;
public:
  cPluginVdrIcq(void);
  virtual ~cPluginVdrIcq();
  virtual const char *Version(void) { return VERSION; }
  virtual const char *Description(void) { return tr(DESCRIPTION); }
  virtual const char *CommandLineHelp(void) { return NULL; }
  virtual bool ProcessArgs(int argc, char *argv[]) { return true; }
  virtual bool Start(void);
  virtual void Housekeeping(void);
  virtual const char *MainMenuEntry(void) { return tr(MAINMENUENTRY); }
  virtual cOsdObject *MainMenuAction(void);
  virtual cMenuSetupPage *SetupMenu(void);
  virtual bool SetupParse(const char *Name, const char *Value);
  };

#include "icqhook.h"
#include "vdricqosd.h"
#include "vdricqsetup.h"

cPluginVdrIcq::cPluginVdrIcq(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!
  option_a = NULL;
  option_b = false;
}

cPluginVdrIcq::~cPluginVdrIcq()
{
  delete m_pIcqClient;
}


bool cPluginVdrIcq::Start(void)
{
  // Start any background activities the plugin shall perform.
  RegisterI18n(Phrases);

  m_pIcqClient = new SimpleClient(VdrIcqSetup.IcqUIN, VdrIcqSetup.IcqPassword);
  //m_pIcqClient = new SimpleClient(239366594, "", true);
  //m_pIcqClient = new SimpleClient(323785901, "", true);
  //m_pIcqClient = new SimpleClient(256104183, "", true);
  m_pIcqClient->Start();

  return true;
}

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

cOsdObject *cPluginVdrIcq::MainMenuAction(void)
{
  // Perform the action when selected from the main VDR menu.
//  Interface->Confirm(VdrIcqSetup.UseAlternateGreeting ? tr("Howdy folks!") : tr("VdrIcq world!"), VdrIcqSetup.GreetingTime);
  return new cVdrIcqOsd(m_pIcqClient);
}

cMenuSetupPage *cPluginVdrIcq::SetupMenu(void)
{
  // Return a setup menu in case the plugin supports one.
  return new cMenuSetupVdrIcq(m_pIcqClient);
}

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

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