00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#ifndef GM_KIT_PROTOCOL_H
00024
#define GM_KIT_PROTOCOL_H
00025
00026
#include <vector>
00027
#include <string>
00028
00029
#include "gm/protocol.h"
00030
#include "gm/basenetwork.h"
00031
#include "gm/wrapexpat.h"
00032
00033
namespace GNUMessenger {
00034
00035
using namespace std;
00036
class XMLNode;
00037
00038
00050 class KitProtocol:
public Protocol,
private Expat
00051 {
00052
public:
00053
00054
KitProtocol(
const XMLNode &,
ProtocolManager *manager);
00055
virtual ~
KitProtocol();
00056
00057
const string screenName() {
return m_conf.
child(
"user")[
"username"]; };
00058
virtual void update();
00059
00060
virtual void login();
00061
virtual void logout();
00062
virtual bool sendMessage(
const Contact &recipient,
const string &message);
00063
virtual void addBuddy(
const Contact &c);
00064
virtual void delBuddy(
const Contact &c);
00065
virtual void newUser();
00066
virtual void getPubkey();
00067
virtual void customRequest(
XMLNode n);
00068
00069
virtual void handleData(
Network *net);
00070
virtual void handleData(
Network *net,
const string& buf);
00071
00072
virtual void connectionError(
Network *net,
int error);
00073
virtual void connectedToServer(
Network *net);
00074
00075 virtual void reset() {}
00076
00077
private:
00078
enum KitState { S_none=2*65536, S_registering, S_getPubKey};
00079
00080
void rootTagRecieved(XMLNode &root);
00081
void recievedTag(XMLNode &n);
00082
void parserError(string msg,
int line);
00083
void updateContacts();
00084
void sendData(
const string &str);
00085
00086
int m_connectionEncrypted;
00087
unsigned char *m_sessionKey;
00088
int m_sessionKeyLen;
00089 string toParse;
00090 KitState m_kitstate;
00091 Network *m_net;
00092
00093 };
00094 }
00095
00096
#endif