GNUMessenger::TocProtocol Class Reference
[Protocols]

#include <tocprotocol.h>

Inheritance diagram for GNUMessenger::TocProtocol:

Inheritance graph
[legend]
Collaboration diagram for GNUMessenger::TocProtocol:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TocProtocol (const XMLNode &, ProtocolManager *manager)
const string getLoginName ()
 Returns the text string name used to login to the protocol.
virtual void update ()
 In a non-event based system this call will check the network for incoming data and will call appropriate handlers.
virtual void login ()
 Login to TOC.
virtual void logout ()
 Logout of TOC.
virtual void shutdown ()
 Shutdown this protocol and deallocate socket.
virtual bool sendMessage (const Contact &recipient, const string &message)
 Send a message over this protocol.
virtual void addContact (const Contact &c)
 Add a contact to this protocol.
virtual void delContact (const Contact &c)
 Remove a contact from this protocol.
virtual void newUser (const string &userName, const VBuffer &password)
 Create a new user...might not do anything on this proto.
virtual void getPubkey ()
 Get the public key from remote user--useless.
virtual void handleData (Network *net)
 The many, terrible ways to handle data.
virtual void handleData (Network *net, const VBuffer &data)
virtual void handleData (Network *net, const string &data)
virtual void connectionError (Network *net, int error)
 The network reports a connection errod.
virtual void connectedToServer (Network *net)
 The network reports we are connected to server.
virtual void setAway (const string &msg="")
 Set the away message.
virtual void setInfo (const string &info="")
 Set the user info (profile).
virtual void getInfo (const string &contact)
 Request the info from the protocol, this has to be an async call---we'll respond with a callback sometime.
virtual void reset ()
 Resets the protocol by disconnecting and reconnecting to the network.

Static Public Member Functions

string getErrorText (int i, const string &name)
 Convert an error number into a human readable string.
vector< string > splitStrLF (const string &str)
 Split a string on the LF char into a vector of strings.
vector< string > splitStr (const string &str)
 Split a string on ':'.

Protected Member Functions

void handleRealData (Network *net, const string &data)
 Process a packet payload (not the header).

Protected Attributes

Networkm_net
 The network socket.

Detailed Description

AIM/Toc protocol.

Implements the protocol needed to connect to AOL's aim service.

The configuration XML looks like this:

 <toc>
      <user password="password" username="username"/>
      <server host="toc.oscar.aol.com" port="9898"/>
      <loginserver host="login.oscar.aol.com" port="1234"/>
 </toc>
 
Author:
Henrik Abelsson

Jesse Lovelace

Definition at line 60 of file tocprotocol.h.


Member Function Documentation

void GNUMessenger::TocProtocol::addContact const Contact c  )  [virtual]
 

Add a contact to this protocol.

Todo:
Instead this should check with the protocol to see if this new person is online....or maybe this is taken care of after we read in server list.

Implements GNUMessenger::Protocol.

Definition at line 355 of file tocprotocol.cpp.

References GNUMessenger::Protocol::getProtocol(), GNUMessenger::Contact::getServerId(), and GNUMessenger::Protocol::getState().

00356 { 00357 m_buddies[aim_normalize(c.getServerId(getProtocol()))] = c; 00358 00359 if (getState() == S_online) { 00363 forceContactUpdate(c); 00364 } else { 00365 m_buddies[aim_normalize(c.getServerId(getProtocol()))]. 00366 setStatus(getProtocol(), Contact::Offline); 00367 } 00368 00369 LOG_DEBUG("TocProtocol::addContact: I am not adding to TOC"); 00370 /*if (m_state==S_online) 00371 send_flap(TYPE_DATA, "toc_add_buddy " + aim_normalize(c.getServerId(getProtocol()))); 00372 00373 m_buddies[aim_normalize(c.getServerId(getProtocol()))] = c; 00374 m_buddies[aim_normalize(c.getServerId(getProtocol()))].setStatus(getProtocol(), Contact::Offline); 00375 eventStatusChange(c);*/ 00376 }

Here is the call graph for this function:

void GNUMessenger::TocProtocol::getPubkey  )  [virtual]
 

Get the public key from remote user--useless.

Todo:
move all this into GM sub proto
Definition at line 792 of file tocprotocol.cpp.
00793 { 00794 00795 }

void GNUMessenger::TocProtocol::handleRealData Network net,
const string &  data
[protected]
 

Process a packet payload (not the header).

debug output Definition at line 612 of file tocprotocol.cpp.

References GNUMessenger::Protocol::getState().

00613 { 00615 if (data.length() < 80) 00616 LOG_DEBUG("Got Data: " << data); 00617 00618 string command; 00619 00620 // if we are connecting, we should just go to signup 00621 // but the actual data should be the flap signon msg 00622 if (getState() == S_connecting) { 00623 signup(); 00624 return; 00625 } 00626 00627 unsigned int position((unsigned int)data.find(':', 0)); 00628 00629 command = data.substr(0, position); 00630 00631 LOG_DEBUG(command); 00632 00633 FuncMap::iterator it = m_funcMap.find(command); 00634 00635 if (it == m_funcMap.end()) { 00636 LOG_DEBUG("TOC: Function not found in hashtable: " << command); 00637 } else { 00638 (this->*(it->second))(data); 00639 } 00640 00641 }

Here is the call graph for this function:

void GNUMessenger::TocProtocol::reset  )  [virtual]
 

Resets the protocol by disconnecting and reconnecting to the network.

All configuration settings are re-read.

Implements GNUMessenger::Protocol.

Definition at line 218 of file tocprotocol.cpp.

References login(), and logout().

00219 { 00220 logout(); 00221 login(); 00222 00223 }

Here is the call graph for this function:

void GNUMessenger::TocProtocol::update  )  [virtual]
 

In a non-event based system this call will check the network for incoming data and will call appropriate handlers.

Reimplemented from GNUMessenger::Protocol.

Definition at line 783 of file tocprotocol.cpp.

00784 { 00785 00786 }


The documentation for this class was generated from the following files:
Generated on Tue Oct 5 14:41:58 2004 for GNU Messenger by doxygen 1.3.8