#include <unistd.h>
#include <stdio.h>
#include <xclass/OXMenu.h>
#include "OXIrc.h"
#include "OXNameList.h"

OXClient * clientX;
OXIrc * mainWindow;
OXPopupMenu * _nick_actions;

int main(int argc, char **argv)
{
  char server[50], nick[15];
  clientX = new OXClient;

  _nick_actions = new OXPopupMenu(clientX->GetRoot());
  _nick_actions->AddEntry(new OHotString("Ping"), C_PING);
  _nick_actions->AddEntry(new OHotString("Whois"), C_WHOIS);
  _nick_actions->AddEntry(new OHotString("Message"), C_MESSAGE);
  _nick_actions->AddEntry(new OHotString("DCC"), 0);
  _nick_actions->AddEntry(new OHotString("Speak"), 0);
  _nick_actions->AddEntry(new OHotString("ChanOp"), 0);
  _nick_actions->AddEntry(new OHotString("Kick"), 0);
  _nick_actions->AddEntry(new OHotString("Ban"), 0);

  nick[0]=0;
  server[0]=0;

  if (getenv("IRCSERVER")) strcpy(server, getenv("IRCSERVER"));
  if (getenv("IRCNICK")) strcpy(nick, getenv("IRCNICK"));

  if (argc > 1) strcpy(nick, argv[1]); 
  if (argc > 2) strcpy(server, argv[2]); 

  if ((nick[0] == 0) && (server[0] == 0)){
    printf("Usage : foxirc nick server\n");
    exit(1);
  }

  mainWindow = new OXIrc(clientX->GetRoot(), nick, server, 6667);

  mainWindow->MapWindow();

  clientX->Run();
}
