Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MSN::NotificationServerConnection Class Reference

#include <notificationserver.h>

Inheritance diagram for MSN::NotificationServerConnection:

MSN::Connection List of all members.

Detailed Description

Represents a connection to a MSN notification server.

The MSN notification server is responsible for dealing with the contact list, online status, and dispatching message requests or invitations to or from switchboard servers.


Public Types

enum  NotificationServerState {
  NS_DISCONNECTED, NS_CONNECTING, NS_CONNECTED, NS_SYNCHRONISING,
  NS_ONLINE
}

Public Member Functions

 NotificationServerConnection (AuthData &auth_, Callbacks &cb)
 Create a NotificationServerConnection with the specified authentication data.
 NotificationServerConnection (Passport username, std::string password, Callbacks &cb)
 Create a NotificationServerConnection with the specified username and password.
 NotificationServerConnection (Callbacks &cb)
 Create a NotificationServerConnection with no specified username or password.
virtual ~NotificationServerConnection ()
virtual void dispatchCommand (std::vector< std::string > &args)
 Dispatch a command to its appropriate handler routines based on args.
const std::list< SwitchboardServerConnection * > & switchboardConnections ()
 Return a list of SwitchboardServerConnection's that have been started from this NotificationServerConnection.
void addSwitchboardConnection (SwitchboardServerConnection *)
 Add a SwitchboardServerConnection to the list of connections that have been started from this connection.
void removeSwitchboardConnection (SwitchboardServerConnection *)
 Remove a SwitchboardServerConnection from the list of connections that have beep started from this connection.
ConnectionconnectionWithSocket (int fd)
 Return a connection that is associated with fd.
SwitchboardServerConnectionswitchboardWithOnlyUser (Passport username)
 Return a SwitchboardServerConnection that has exactly one user whose username is username.
void checkReverseList (ListSyncInfo *)
virtual void connect (const std::string &hostname, unsigned int port)
 Connect ourself to hostname on port.
virtual void connect (const std::string &hostname, unsigned int port, const Passport &username, const std::string &password)
virtual void disconnect ()
virtual void addCallback (NotificationServerCallback cb, int trid, void *data)
 Add a callback of cb to this connection for response with ID of trid.
virtual void removeCallback (int trid)
 Remove callbacks assocated with responses with ID of trid.
virtual void socketConnectionCompleted ()
 The connection has been established.
NotificationServerState connectionState () const
virtual NotificationServerConnectionmyNotificationServer ()
Action Methods
These methods all perform actions on the notification server.

void setState (BuddyStatus state)
 Set our online state to state.
void setBLP (char setting)
void setGTC (char setting)
void setFriendlyName (std::string friendlyName) throw (std::runtime_error)
 Set our friendly name to friendlyName.
void addToList (std::string list, Passport buddyName)
 Add buddy named buddyName to the list named list.
void removeFromList (std::string list, Passport buddyName)
 Remove buddy named budydName from the list named list.
void addToGroup (Passport, int groupID)
void removeFromGroup (Passport buddyName, int groupID)
void addGroup (std::string groupName)
void removeGroup (int groupId)
void renameGroup (int groupId, std::string newGroupName)
void synchronizeLists (int version=0)
 Request the server side buddy list.
void sendPing ()
 Send a 'keep-alive' ping to the server.
void requestSwitchboardConnection (const void *tag)
 Request a switchboard connection.

Public Attributes

CallbacksexternalCallbacks

Protected Member Functions

virtual void handleIncomingData ()
void setConnectionState (NotificationServerState s)
void assertConnectionStateIs (NotificationServerState s)
void assertConnectionStateIsNot (NotificationServerState s)
void assertConnectionStateIsAtLeast (NotificationServerState s)

Protected Attributes

NotificationServerState _connectionState

Classes

class  AuthData


Member Enumeration Documentation

enum MSN::NotificationServerConnection::NotificationServerState
 

Enumeration values:
NS_DISCONNECTED 
NS_CONNECTING 
NS_CONNECTED 
NS_SYNCHRONISING 
NS_ONLINE 


Constructor & Destructor Documentation

MSN::NotificationServerConnection::NotificationServerConnection AuthData &  auth_,
Callbacks cb
 

Create a NotificationServerConnection with the specified authentication data.

MSN::NotificationServerConnection::NotificationServerConnection Passport  username,
std::string  password,
Callbacks cb
 

Create a NotificationServerConnection with the specified username and password.

MSN::NotificationServerConnection::NotificationServerConnection Callbacks cb  ) 
 

Create a NotificationServerConnection with no specified username or password.

MSN::NotificationServerConnection::~NotificationServerConnection  )  [virtual]
 


Member Function Documentation

void MSN::NotificationServerConnection::addCallback NotificationServerCallback  cb,
int  trid,
void *  data
[virtual]
 

Add a callback of cb to this connection for response with ID of trid.

Todo:
void * is bad.

void MSN::NotificationServerConnection::addGroup std::string  groupName  ) 
 

void MSN::NotificationServerConnection::addSwitchboardConnection SwitchboardServerConnection  ) 
 

Add a SwitchboardServerConnection to the list of connections that have been started from this connection.

void MSN::NotificationServerConnection::addToGroup Passport  ,
int  groupID
 

void MSN::NotificationServerConnection::addToList std::string  list,
Passport  buddyName
 

Add buddy named buddyName to the list named list.

void MSN::NotificationServerConnection::assertConnectionStateIs NotificationServerState  s  )  [inline, protected]
 

void MSN::NotificationServerConnection::assertConnectionStateIsAtLeast NotificationServerState  s  )  [inline, protected]
 

void MSN::NotificationServerConnection::assertConnectionStateIsNot NotificationServerState  s  )  [inline, protected]
 

void MSN::NotificationServerConnection::checkReverseList ListSyncInfo  ) 
 

void MSN::NotificationServerConnection::connect const std::string &  hostname,
unsigned int  port,
const Passport username,
const std::string &  password
[virtual]
 

void MSN::NotificationServerConnection::connect const std::string &  hostname,
unsigned int  port
[virtual]
 

Connect ourself to hostname on port.

Implements MSN::Connection.

NotificationServerState MSN::NotificationServerConnection::connectionState  )  const [inline]
 

Connection * MSN::NotificationServerConnection::connectionWithSocket int  fd  ) 
 

Return a connection that is associated with fd.

If fd is equal to sock, this is returned. Otherwise connectionWithSocket is sent to each SwitchboardServerConnection until a match is found.

Returns:
The matching connection, if found. Otherwise, NULL.

void MSN::NotificationServerConnection::disconnect  )  [virtual]
 

Implements MSN::Connection.

void MSN::NotificationServerConnection::dispatchCommand std::vector< std::string > &  args  )  [virtual]
 

Dispatch a command to its appropriate handler routines based on args.

Parameters:
args A vector of strings containing arguments, returned from readLine.

Implements MSN::Connection.

void MSN::NotificationServerConnection::handleIncomingData  )  [protected, virtual]
 

Implements MSN::Connection.

virtual NotificationServerConnection* MSN::NotificationServerConnection::myNotificationServer  )  [inline, virtual]
 

Implements MSN::Connection.

void MSN::NotificationServerConnection::removeCallback int  trid  )  [virtual]
 

Remove callbacks assocated with responses with ID of trid.

void MSN::NotificationServerConnection::removeFromGroup Passport  buddyName,
int  groupID
 

void MSN::NotificationServerConnection::removeFromList std::string  list,
Passport  buddyName
 

Remove buddy named budydName from the list named list.

void MSN::NotificationServerConnection::removeGroup int  groupId  ) 
 

void MSN::NotificationServerConnection::removeSwitchboardConnection SwitchboardServerConnection  ) 
 

Remove a SwitchboardServerConnection from the list of connections that have beep started from this connection.

void MSN::NotificationServerConnection::renameGroup int  groupId,
std::string  newGroupName
 

void MSN::NotificationServerConnection::requestSwitchboardConnection const void *  tag  ) 
 

Request a switchboard connection.

void MSN::NotificationServerConnection::sendPing  ) 
 

Send a 'keep-alive' ping to the server.

void MSN::NotificationServerConnection::setBLP char  setting  ) 
 

void MSN::NotificationServerConnection::setConnectionState NotificationServerState  s  )  [inline, protected]
 

void MSN::NotificationServerConnection::setFriendlyName std::string  friendlyName  )  throw (std::runtime_error)
 

Set our friendly name to friendlyName.

Parameters:
friendlyName Maximum allowed length is 387 characters after URL-encoding.

void MSN::NotificationServerConnection::setGTC char  setting  ) 
 

void MSN::NotificationServerConnection::setState BuddyStatus  state  ) 
 

Set our online state to state.

void MSN::NotificationServerConnection::socketConnectionCompleted  )  [virtual]
 

The connection has been established.

Reimplemented from MSN::Connection.

const std::list< SwitchboardServerConnection * > & MSN::NotificationServerConnection::switchboardConnections  ) 
 

Return a list of SwitchboardServerConnection's that have been started from this NotificationServerConnection.

SwitchboardServerConnection * MSN::NotificationServerConnection::switchboardWithOnlyUser Passport  username  ) 
 

Return a SwitchboardServerConnection that has exactly one user whose username is username.

Returns:
The matching SwitchboardServerConnection, or NULL.

void MSN::NotificationServerConnection::synchronizeLists int  version = 0  ) 
 

Request the server side buddy list.

Parameters:
version if version is specified the server will respond with the changes necessary to update the list to the latest version. Otherwise the entire list will be sent.


Member Data Documentation

NotificationServerState MSN::NotificationServerConnection::_connectionState [protected]
 

Callbacks& MSN::NotificationServerConnection::externalCallbacks
 


The documentation for this class was generated from the following files:
Generated on Sun Feb 6 19:59:41 2005 for libmsn by  doxygen 1.4.1