kitprotocol.h

00001 // -*- C++ -*- 00002 /* 00003 $Id: kitprotocol_8h-source.html,v 1.1 2004/10/05 21:12:02 mentat Exp $ 00004 00005 GNU Messenger - The secure instant messenger 00006 00007 Copyright (C) 1999-2002 Henrik Abelsson <henrik@abelsson.com> 00008 00009 This program is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2 of the License, or 00012 (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 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

Generated on Tue Oct 5 14:41:47 2004 for GNU Messenger by doxygen 1.3.8