libmsn: MSN::NotificationServerConnection Class Reference

# MSN::NotificationServerConnection Class Reference

`#include <notificationserver.h>`

Inheritance diagram for MSN::NotificationServerConnection:
[legend]
Collaboration diagram for MSN::NotificationServerConnection:
[legend]

List of all members.

## Public Member Functions
| NotificationServerConnection (Passport username, std::string password, Callbacks &cb)
virtual void | dispatchCommand (std::vector< std::string > &args)
const std::vector < SwitchboardServerConnection * > & | switchboardConnections ()
Connection * | connectionWithSocket (void *sock)
SwitchboardServerConnection * | switchboardWithOnlyUser (Passport username)
## Action Methods
These methods all perform actions on the notification server.
enum | NotificationServerState
std::list< std::string > | adl_packets
std::string | myDisplayName
std::string | myPassport
uint | m_clientId
char | bplSetting
std::string | server_reported_ip
std::string | server_reported_port
std::string | login_time
std::string | MSPAuth
std::string | sid
std::string | kv
std::string | server_email_verified
bool | direct_connection
connectinfo * | info
Callbacks & | externalCallbacks
NotificationServerState | _connectionState
void | setCapabilities (uint m_clientId)
void | disconnectNS ()
void | setState (BuddyStatus state, uint clientID)
void | setBLP (char setting)
void | completeConnection (std::map< std::string, int > &allContacts, void *data)
void | setFriendlyName (std::string friendlyName, bool updateServer=false) throw (std::runtime_error)
bool | change_DisplayPicture (std::string filename)
void | setPersonalStatus (personalInfo pInfo)
void | addToList (MSN::ContactList list, Passport buddyName)
void | removeFromList (MSN::ContactList list, Passport buddyName)
void | addToAddressBook (Passport buddyName, std::string displayName)
void | delFromAddressBook (std::string contactId, std::string passport)
void | enableContactOnAddressBook (std::string contactId, std::string passport)
void | disableContactOnAddressBook (std::string contactId, std::string passport)
void | blockContact (Passport buddyName)
void | unblockContact (Passport buddyName)
void | addToGroup (std::string groupId, std::string contactId)
void | removeFromGroup (std::string groupId, std::string contactId)
void | addGroup (std::string groupName)
void | removeGroup (std::string groupId)
void | renameGroup (std::string groupId, std::string newGroupName)
void | synchronizeContactList (std::string lastChange="0")
void | sendPing ()
void | requestSwitchboardConnection (const void *tag)
void | get_oim (std::string id, bool markAsRead)
void | delete_oim (std::string id)
void | send_oim (Soap::OIM oim)
void | getInboxUrl ()
virtual void | connect (const std::string &hostname, unsigned int 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)
virtual void | removeCallback (int trid)
virtual void | socketConnectionCompleted ()
NotificationServerState | connectionState () const
virtual NotificationServerConnection * | myNotificationServer ()
void | gotTickets (Soap &soapConnection, std::vector< MSN::Soap::sitesToAuth > sitesToAuthList)
void | gotLists (Soap &soapConnection)
void | gotAddressBook (Soap &soapConnection)
void | gotOIM (Soap &soapConnection, bool success, std::string id, std::string message)
void | gotOIMLockkey (Soap &soapConnection, std::string lockkey)
void | gotOIMSendConfirmation (Soap &soapConnection, int id, bool sent)
void | gotOIMDeleteConfirmation (Soap &soapConnection, std::string id, bool deleted)
void | gotSoapMailData (Soap &soapConnection, std::string maildata)
void | gotChangeDisplayNameConfirmation (Soap &soapConnection, std::string displayName, bool changed)
void | gotDelContactFromGroupConfirmation (Soap &soapConnection, bool deleted, std::string newVersion, std::string groupId, std::string contactId)
void | gotAddContactToGroupConfirmation (Soap &soapConnection, bool added, std::string newVersion, std::string groupId, std::string contactId)
void | gotAddGroupConfirmation (Soap &soapConnection, bool added, std::string newVersion, std::string groupName, std::string groupId)
void | gotDelGroupConfirmation (Soap &soapConnection, bool removed, std::string newVersion, std::string groupId)
void | gotRenameGroupConfirmation (Soap &soapConnection, bool renamed, std::string newVersion, std::string newGroupName, std::string groupId)
void | gotAddContactToAddressBookConfirmation (Soap &soapConnection, bool added, std::string newVersion, std::string passport, std::string displayName, std::string guid)
void | gotDelContactFromAddressBookConfirmation (Soap &soapConnection, bool removed, std::string newVersion, std::string contactId, std::string passport)
void | gotEnableContactOnAddressBookConfirmation (Soap &soapConnection, bool enabled, std::string newVersion, std::string contactId, std::string passport)
void | gotDisableContactOnAddressBookConfirmation (Soap &soapConnection, bool disabled, std::string newVersion, std::string contactId, std::string passport)
void | gotAddContactToListConfirmation (Soap &soapConnection, bool added, std::string newVersion, std::string passport, MSN::ContactList list)
void | gotDelContactFromListConfirmation (Soap &soapConnection, bool deleted, std::string newVersion, std::string passport, MSN::ContactList list)
virtual void | handleIncomingData ()
void | setConnectionState (NotificationServerState s)
void | assertConnectionStateIs (NotificationServerState s)
void | assertConnectionStateIsNot (NotificationServerState s)
void | assertConnectionStateIsAtLeast (NotificationServerState s)

## 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.

## Constructor & Destructor Documentation

MSN::NotificationServerConnection::NotificationServerConnection | ( | Passport | username,
|  | std::string | password,
|  | Callbacks & | cb |
| ) |  |  |

Create a NotificationServerConnection with the specified username and password.

## Member Function Documentation

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

Add a new group.

void MSN::NotificationServerConnection::addToAddressBook | ( | Passport | buddyName,
|  | std::string | displayName |
| ) |  |  |

Add contact buddyName to address book with displayName Automatically adds to allow list too.

void MSN::NotificationServerConnection::addToGroup | ( | std::string | groupId,
|  | std::string | contactId |
| ) |  |  |

Add a contact contactId to the group groupId .

void MSN::NotificationServerConnection::addToList | ( | MSN::ContactList | list,
|  | Passport | buddyName |
| ) |  |  |

Add buddy named buddyName to the list named list.

void MSN::NotificationServerConnection::blockContact | ( | Passport | buddyName | ) |

Block a contact. This user won't be able to see your status anymore.

bool MSN::NotificationServerConnection::change_DisplayPicture | ( | std::string | filename | ) |

Points to our display picture. It must be a png file, size: 96x96.

Parameters:

  | filename | Path to the PNG file to be sent as avatar of this contact

void MSN::NotificationServerConnection::completeConnection | ( | std::map< std::string, int > & | allContacts,
|  | void * | data |
| ) |  |  |

It must be called to complete the connection. Add all your contacts to allContacts, (both Forward, allow and block lists). The integer value of allContacts is the sum of all lists this contact is present. For example: If the contact is both on your allow and forward list, the number must be 3 (2+1).

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

Connect ourself to hostname on port.

Implements MSN::Connection.

Connection * MSN::NotificationServerConnection::connectionWithSocket | ( | void * | sock | ) |

Return a connection that is associated with fd.

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

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

void MSN::NotificationServerConnection::delete_oim | ( | std::string | id | ) |

Erase the Offline Instant Message identified by id

void MSN::NotificationServerConnection::delFromAddressBook | ( | std::string | contactId,
|  | std::string | passport |
| ) |  |  |

Delete contact passport with contactId from address book.

void MSN::NotificationServerConnection::disableContactOnAddressBook | ( | std::string | contactId,
|  | std::string | passport |
| ) |  |  |

Do not delete the contact, just disable it.

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::enableContactOnAddressBook | ( | std::string | contactId,
|  | std::string | passport |
| ) |  |  |

Enable a contact on address book. You will use it when you have disabled a contact before. This contact is still on your Address Book, but it is not a messenger contact. This function will turn this contact into a messenger contact again.

void MSN::NotificationServerConnection::get_oim | ( | std::string | id,
|  | bool | markAsRead |
| ) |  |  |

Retrieve the Offline Instant Message identified by id

void MSN::NotificationServerConnection::removeFromGroup | ( | std::string | groupId,
|  | std::string | contactId |
| ) |  |  |

Remove a contact from a group.

void MSN::NotificationServerConnection::removeFromList | ( | MSN::ContactList | list,
|  | Passport | buddyName |
| ) |  |  |

Remove buddy named buddyName from the list named list.

void MSN::NotificationServerConnection::removeGroup | ( | std::string | groupId | ) |

Remove a group.

void MSN::NotificationServerConnection::renameGroup | ( | std::string | groupId,
|  | std::string | newGroupName |
| ) |  |  |

Rename a group.

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

Request a switchboard connection.

void MSN::NotificationServerConnection::send_oim | ( | Soap::OIM | oim | ) |

Send an Offline Instant Message

void MSN::NotificationServerConnection::sendPing | ( |  | ) |

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

void MSN::NotificationServerConnection::setBLP | ( | char | setting | ) |

Set Black List policy

void MSN::NotificationServerConnection::setCapabilities | ( | uint | m_clientId | ) |

Set our capabilities. This is the sum of MSNClientInformationFields enum fields

void MSN::NotificationServerConnection::setFriendlyName | ( | std::string | friendlyName,
|  | bool | updateServer = `false` |
| ) |  |  | throw (std::runtime_error)

Set our friendly name to friendlyName.

Parameters:

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

void MSN::NotificationServerConnection::setPersonalStatus | ( | personalInfo | pInfo | ) |

Sets our personal info. Current media, personal message...

void MSN::NotificationServerConnection::setState | ( | BuddyStatus | state,
|  | uint | clientID |
| ) |  |  |

Set our online state to state and our capabilites to clientID.

void MSN::NotificationServerConnection::socketConnectionCompleted | ( |  | ) | `[virtual]`

The connection has been established.

Reimplemented from MSN::Connection.

const std::vector< 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::synchronizeContactList | ( | std::string | lastChange = `"0"` | ) |

Request the server side buddy list.

Parameters:

  | lastChange | 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.

void MSN::NotificationServerConnection::unblockContact | ( | Passport | buddyName | ) |

Unblock a contact. This user will be able to see your status again.