#ifndef OXIRC_H
#define OXIRC_H

#define FOXIRCVERSION "fOXIrc v0.000000001. http://fox.unixville.com/"

#include <stdlib.h>
#include <stdio.h>

#include <xclass/OXClient.h>
#include <xclass/OXWindow.h>
#include <xclass/OXFrame.h>
#include <xclass/OXWidgets.h>
#include <xclass/OXMsgBox.h>
#include <xclass/OXSlider.h>
#include <xclass/OString.h>

#include "OXTextView.h"
#include "OXMyTextEntry.h"
#include "OIrc.h"

//---------------------------------------------------------------------

class OXChannel;

class OXIrc : public OXMainFrame, public OIrc {
public:
  OXIrc(const OXWindow *p, char * nick, char * server, int port);
  virtual ~OXIrc();

  void Log(char * message);
  void Log(char * message, char * color);

  OXChannel * GetChannel(char * channel);

  void ProcessNickList(char * channel, char * nicklist);
  void ProcessJoin(char * channel, char * nick);
  void ProcessPart(char * channel, char * nick);
  void ProcessNick(char * old_nick /* :*] */, char * new_nick);
  void ProcessQuit(char * nick);
  void ProcessMsg(char * channel, char * nick, char * msg, int mode);

  int ProcessMessage(long msg, long parm1, long parm2);

  int HandleTimer(OTimer *t);

  char _nick[10];
protected:
  OTimer * _timer;

  OXMyTextEntry * _channelentry;
  OTextBuffer * _channel;

  OTextDoc * _log;
  OXView * _logw;

  char _server[80];
  int _port;
  int _fd;

  OXChannel * channels;
};

#endif
