msnprotocol.h

00001 // -*- C++ -*- 00002 /* 00003 $Id: msnprotocol_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_MSN_PROTOCOL_H 00024 #define GM_MSN_PROTOCOL_H 00025 00026 #include <vector> 00027 #include <string> 00028 00029 #include "gm/protocol.h" 00030 00031 namespace GNUMessenger { 00032 00033 class XMLNode; 00034 class Network; 00035 00045 class MsnProtocol: public Protocol 00046 { 00047 public: 00048 00049 MsnProtocol(const XMLNode &,ProtocolManager *manager); 00050 virtual ~MsnProtocol(); 00051 00052 const string screenName() { return ""; }; 00053 00054 virtual void update(); 00055 00056 virtual void login(); 00057 virtual void logout(); 00058 virtual bool sendMessage(const Contact &recipient, const string &message); 00059 virtual void addBuddy(const Contact &c); 00060 virtual void delBuddy(const Contact &c); 00061 virtual void newUser(); 00062 virtual void getPubkey(); 00063 00064 virtual void handleData(Network *net); 00065 virtual void handleData(Network *net,const string& data); 00066 00067 virtual void connectionError(Network *net,int error); 00068 virtual void connectedToServer(Network *net); 00069 virtual void reset() {} 00070 00071 private: 00072 00073 const string trId() {return "123";}; 00074 void setProtocol(); 00075 void sendMD5Auth(string challenge); 00076 void authenticateUser(); 00077 void getPolicy(); 00078 void handleMsg(string sender,string nick,string msg,int pos); 00079 void handleStatus(Contact c,string status ); 00080 void parseMessage(const string &msg); 00081 string deSpaceify(string s); 00082 void requestSwitchboard(); 00083 void sendCmd(Network *net,string cmd, string args=""); 00084 void sendCmd(Network *net,string cmd, vector<string> args); 00085 vector<string> splitStr(string str,char delim=' '); 00086 void handleNS(Network *net,vector<string> &cmd); 00087 void handleSW(Network *net,vector<string> &cmd); 00088 void sendPendingMsgs(Network *net); 00089 00091 class message 00092 { 00093 public: 00094 // timestamp 00095 int year;int month;int day;int hour;int minute;int sec; 00096 // msg 00097 string msg; 00098 string sender; 00099 Network *fd; 00100 }; 00101 00102 00103 enum MsnState { S_none=3*65536, 00104 S_connecting, 00105 S_xfer1, 00106 S_settingProtocol, 00107 S_gettingPolicy, 00108 S_establishingChat, 00109 S_authenticatingUser1, 00110 S_authenticatingUser2, 00111 S_synchronizing 00112 }; 00113 00115 class Conversation 00116 { 00117 public: 00118 enum status {online,negotiating1,negotiating2,answering,offline}; 00119 vector<string> pendingMsgs; 00120 Contact user; 00121 string cookie; 00122 string sessionid; 00123 Network *net; 00124 int status; 00125 }; 00126 00127 MsnProtocol::Conversation &findConv(Network *net); 00128 00129 vector<string> chatUsers; 00130 vector<string> allowList; 00131 vector<string> blockList; 00132 vector<string> reverseList; 00133 MsnState m_msnstate; 00134 Network *m_net; 00135 vector<Conversation> chatSessions; 00136 Network *notifyServer; 00137 00138 }; 00139 00140 } 00141 00142 #endif

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