libmsn: MSN::Callbacks Class Reference

# MSN::Callbacks Class Reference

`#include <externals.h>`

List of all members.

## Public Member Functions
virtual void | registerSocket (void *sock, int read, int write, bool isSSL)=0
virtual void | unregisterSocket (void *sock)=0
virtual void | closeSocket (void *sock)=0
virtual void | showError (MSN::Connection *conn, std::string msg)=0
virtual void | buddyChangedStatus (MSN::NotificationServerConnection *conn, MSN::Passport buddy, std::string friendlyname, MSN::BuddyStatus state, unsigned int clientID, std::string msnobject)=0
virtual void | buddyOffline (MSN::NotificationServerConnection *conn, MSN::Passport buddy)=0
virtual void | log (int writing, const char *buf)=0
virtual void | gotFriendlyName (MSN::NotificationServerConnection *conn, std::string friendlyname)=0
virtual void | gotBuddyListInfo (MSN::NotificationServerConnection *conn, MSN::ListSyncInfo *data)=0
virtual void | buddyChangedPersonalInfo (MSN::NotificationServerConnection *conn, MSN::Passport fromPassport, MSN::personalInfo pInfo)=0
virtual void | gotLatestListSerial (MSN::NotificationServerConnection *conn, std::string lastChange)=0
virtual void | gotGTC (MSN::NotificationServerConnection *conn, char c)=0
virtual void | gotBLP (MSN::NotificationServerConnection *conn, char c)=0
virtual void | addedListEntry (MSN::NotificationServerConnection *conn, MSN::ContactList list, MSN::Passport buddy, std::string friendlyname)=0
virtual void | removedListEntry (MSN::NotificationServerConnection *conn, MSN::ContactList list, MSN::Passport buddy)=0
virtual void | addedGroup (MSN::NotificationServerConnection *conn, bool added, std::string groupName, std::string groupId)=0
virtual void | removedGroup (MSN::NotificationServerConnection *conn, bool removed, std::string groupId)=0
virtual void | renamedGroup (MSN::NotificationServerConnection *conn, bool renamed, std::string newGroupName, std::string groupId)=0
virtual void | addedContactToGroup (MSN::NotificationServerConnection *conn, bool added, std::string groupId, std::string contactId)=0
virtual void | removedContactFromGroup (MSN::NotificationServerConnection *conn, bool removed, std::string groupId, std::string contactId)=0
virtual void | addedContactToAddressBook (MSN::NotificationServerConnection *conn, bool added, std::string passport, std::string displayName, std::string guid)=0
virtual void | removedContactFromAddressBook (MSN::NotificationServerConnection *conn, bool removed, std::string contactId, std::string passport)=0
virtual void | enabledContactOnAddressBook (MSN::NotificationServerConnection *conn, bool enabled, std::string contactId, std::string passport)=0
virtual void | disabledContactOnAddressBook (MSN::NotificationServerConnection *conn, bool disabled, std::string contactId)=0
virtual void | gotSwitchboard (MSN::SwitchboardServerConnection *conn, const void *tag)=0
virtual void | buddyJoinedConversation (MSN::SwitchboardServerConnection *conn, MSN::Passport buddy, std::string friendlyname, int is_initial)=0
virtual void | buddyLeftConversation (MSN::SwitchboardServerConnection *conn, MSN::Passport buddy)=0
virtual void | gotInstantMessage (MSN::SwitchboardServerConnection *conn, MSN::Passport buddy, std::string friendlyname, MSN::Message *msg)=0
virtual void | gotMessageSentACK (MSN::SwitchboardServerConnection *conn, int trID)=0
virtual void | gotEmoticonNotification (MSN::SwitchboardServerConnection *conn, MSN::Passport buddy, std::string alias, std::string msnobject)=0
virtual void | failedSendingMessage (MSN::Connection *conn)=0
virtual void | gotNudge (MSN::SwitchboardServerConnection *conn, MSN::Passport username)=0
virtual void | gotVoiceClipNotification (MSN::SwitchboardServerConnection *conn, MSN::Passport username, std::string msnobject)=0
virtual void | gotWinkNotification (MSN::SwitchboardServerConnection *conn, MSN::Passport username, std::string msnobject)=0
virtual void | gotInk (MSN::SwitchboardServerConnection *conn, MSN::Passport username, std::string image)=0
virtual void | gotActionMessage (MSN::SwitchboardServerConnection *conn, MSN::Passport username, std::string message)=0
virtual void | buddyTyping (MSN::SwitchboardServerConnection *conn, MSN::Passport buddy, std::string friendlyname)=0
virtual void | gotInitialEmailNotification (MSN::NotificationServerConnection *conn, int msgs_inbox, int unread_inbox, int msgs_folders, int unread_folders)=0
virtual void | gotNewEmailNotification (MSN::NotificationServerConnection *conn, std::string from, std::string subject)=0
virtual void | fileTransferProgress (MSN::SwitchboardServerConnection *conn, unsigned int sessionID, long long unsigned transferred, long long unsigned total)=0
virtual void | fileTransferFailed (MSN::SwitchboardServerConnection *conn, unsigned int sessionID, MSN::fileTransferError error)=0
virtual void | fileTransferSucceeded (MSN::SwitchboardServerConnection *conn, unsigned int sessionID)=0
virtual void | fileTransferInviteResponse (MSN::SwitchboardServerConnection *conn, unsigned int sessionID, bool response)=0
virtual void | gotVoiceClipFile (MSN::SwitchboardServerConnection *conn, unsigned int sessionID, std::string file)=0
virtual void | gotEmoticonFile (MSN::SwitchboardServerConnection *conn, unsigned int sessionID, std::string alias, std::string file)=0
virtual void | gotWinkFile (MSN::SwitchboardServerConnection *conn, unsigned int sessionID, std::string file)=0
virtual void | gotNewConnection (MSN::Connection *conn)=0
virtual void | gotOIMList (MSN::NotificationServerConnection *conn, std::vector< MSN::eachOIM > OIMs)=0
virtual void | gotOIM (MSN::NotificationServerConnection *conn, bool success, std::string id, std::string message)=0
virtual void | gotOIMSendConfirmation (MSN::NotificationServerConnection *conn, bool success, int id)=0
virtual void | gotOIMDeleteConfirmation (MSN::NotificationServerConnection *conn, bool success, std::string id)=0
virtual void | gotContactDisplayPicture (MSN::SwitchboardServerConnection *conn, MSN::Passport passport, std::string filename)=0
virtual void | connectionReady (MSN::Connection *conn)=0
virtual void | closingConnection (MSN::Connection *conn)=0
virtual void | changedStatus (MSN::NotificationServerConnection *conn, MSN::BuddyStatus state)=0
virtual void * | connectToServer (std::string server, int port, bool *connected, bool isSSL=false)=0
virtual void | askFileTransfer (MSN::SwitchboardServerConnection *conn, MSN::fileTransferInvite ft)=0
virtual size_t | getDataFromSocket (void *sock, char *data, size_t size)=0
virtual size_t | writeDataToSocket (void *sock, char *data, size_t size)=0

## Detailed Description

The application should implement these callback functions to be able to receive notifications from the library.

## Member Function Documentation

virtual void MSN::Callbacks::addedContactToAddressBook | ( | MSN::NotificationServerConnection * | conn,
|  | bool | added,
|  | std::string | passport,
|  | std::string | displayName,
|  | std::string | guid |
| ) |  |  | `[pure virtual]`

Notifies your application that a contact was added to the Address Book, or not, depending on the 'added' boolean variable.

virtual void MSN::Callbacks::addedContactToGroup | ( | MSN::NotificationServerConnection * | conn,
|  | bool | added,
|  | std::string | groupId,
|  | std::string | contactId |
| ) |  |  | `[pure virtual]`

Notifies your application that a contact was added to a group, or not, depending on the 'added' boolean variable.

virtual void MSN::Callbacks::addedGroup | ( | MSN::NotificationServerConnection * | conn,
|  | bool | added,
|  | std::string | groupName,
|  | std::string | groupId |
| ) |  |  | `[pure virtual]`

Notifies your application that a new group was created, or not, depending on the 'added' boolean variable. The application should track the groupId to permorm actions with it.

virtual void MSN::Callbacks::addedListEntry | ( | MSN::NotificationServerConnection * | conn,
|  | MSN::ContactList | list,
|  | MSN::Passport | buddy,
|  | std::string | friendlyname |
| ) |  |  | `[pure virtual]`

Notifies your application that some list was modified by adding some new contact. If ContactList is MSN::LST_RL, it means someone added you to its Address Book. So at this point the application should prompt to the user about adding or blocking this new contact.

virtual void MSN::Callbacks::askFileTransfer | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::fileTransferInvite | ft |
| ) |  |  | `[pure virtual]`

Notifies your application that someone is trying to send you a file.

virtual void MSN::Callbacks::buddyChangedPersonalInfo | ( | MSN::NotificationServerConnection * | conn,
|  | MSN::Passport | fromPassport,
|  | MSN::personalInfo | pInfo |
| ) |  |  | `[pure virtual]`

Notifies the application that a contact has updated his/her personal info. Example: Current Song, personal messages.. Check all the possibilities in MSN::personalInfo struct

virtual void MSN::Callbacks::buddyChangedStatus | ( | MSN::NotificationServerConnection * | conn,
|  | MSN::Passport | buddy,
|  | std::string | friendlyname,
|  | MSN::BuddyStatus | state,
|  | unsigned int | clientID,
|  | std::string | msnobject |
| ) |  |  | `[pure virtual]`

Notifies the application about a buddy status change. msnobject is the object describing avatar file. To get it you should call requestDisplayPicture() on a switchboard connection with this user.

virtual void MSN::Callbacks::buddyJoinedConversation | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::Passport | buddy,
|  | std::string | friendlyname,
|  | int | is_initial |
| ) |  |  | `[pure virtual]`

Notifies your application that a contact joined to a switchboard connection

virtual void MSN::Callbacks::buddyLeftConversation | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::Passport | buddy |
| ) |  |  | `[pure virtual]`

Notifies your application that a contact left a switchboard connection

virtual void MSN::Callbacks::buddyOffline | ( | MSN::NotificationServerConnection * | conn,
|  | MSN::Passport | buddy |
| ) |  |  | `[pure virtual]`

Notifies the application about a user who went offline

virtual void MSN::Callbacks::buddyTyping | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::Passport | buddy,
|  | std::string | friendlyname |
| ) |  |  | `[pure virtual]`

Notifies your application that a buddy is typing.

virtual void MSN::Callbacks::changedStatus | ( | MSN::NotificationServerConnection * | conn,
|  | MSN::BuddyStatus | state |
| ) |  |  | `[pure virtual]`

Notifies your application that a contact has changed his/her status ex: Online, Away, Out to Lunch..

virtual void MSN::Callbacks::closeSocket | ( | void * | sock | ) | `[pure virtual]`

Asks the application to close the socket

virtual void MSN::Callbacks::closingConnection | ( | MSN::Connection * | conn | ) | `[pure virtual]`

Notifies your application that the connection "conn" is closed

virtual void MSN::Callbacks::connectionReady | ( | MSN::Connection * | conn | ) | `[pure virtual]`

Notifies your application that the connection "conn" is ready

virtual void* MSN::Callbacks::connectToServer | ( | std::string | server,
|  | int | port,
|  | bool * | connected,
|  | bool | isSSL = `false` |
| ) |  |  | `[pure virtual]`

Asks your application to create a socket with "server" at port "port". This function must return a socket reference that will be used for getDataFromSocket() and writeDataToSocket()

virtual void MSN::Callbacks::disabledContactOnAddressBook | ( | MSN::NotificationServerConnection * | conn,
|  | bool | disabled,
|  | std::string | contactId |
| ) |  |  | `[pure virtual]`

Notifies your application that a contact was disabled on Address Book, or not, depending on the 'disabled' boolean variable.

virtual void MSN::Callbacks::enabledContactOnAddressBook | ( | MSN::NotificationServerConnection * | conn,
|  | bool | enabled,
|  | std::string | contactId,
|  | std::string | passport |
| ) |  |  | `[pure virtual]`

Notifies your application that a contact was enabled on Address Book, or not, depending on the 'enabled' boolean variable.

virtual void MSN::Callbacks::failedSendingMessage | ( | MSN::Connection * | conn | ) | `[pure virtual]`

Notifies your application that a message could not be delivered

virtual void MSN::Callbacks::fileTransferFailed | ( | MSN::SwitchboardServerConnection * | conn,
|  | unsigned int | sessionID,
|  | MSN::fileTransferError | error |
| ) |  |  | `[pure virtual]`

Notifies your application that some file transfer has failed

virtual void MSN::Callbacks::fileTransferInviteResponse | ( | MSN::SwitchboardServerConnection * | conn,
|  | unsigned int | sessionID,
|  | bool | response |
| ) |  |  | `[pure virtual]`

Notifies your application that the other contact replied a file transfer invitation. if "response" is true, then the other contact has accepted, if false, rejected.

virtual void MSN::Callbacks::fileTransferProgress | ( | MSN::SwitchboardServerConnection * | conn,
|  | unsigned int | sessionID,
|  | long long unsigned | transferred,
|  | long long unsigned | total |
| ) |  |  | `[pure virtual]`

Notifies your application about a progress of a file transfer.

virtual void MSN::Callbacks::fileTransferSucceeded | ( | MSN::SwitchboardServerConnection * | conn,
|  | unsigned int | sessionID |
| ) |  |  | `[pure virtual]`

Notifies your application that some file transfer has succeeded.

virtual size_t MSN::Callbacks::getDataFromSocket | ( | void * | sock,
|  | char * | data,
|  | size_t | size |
| ) |  |  | `[pure virtual]`

Asks your application to get `size` bytes of data available in `sock` and store them in `data`. It must return the real size written to `data`

virtual void MSN::Callbacks::gotActionMessage | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::Passport | username,
|  | std::string | message |
| ) |  |  | `[pure virtual]`

Notifies your application that you got an action.

virtual void MSN::Callbacks::gotBLP | ( | MSN::NotificationServerConnection * | conn,
|  | char | c |
| ) |  |  | `[pure virtual]`

This is a response to a previous sent BLP command.

virtual void MSN::Callbacks::gotBuddyListInfo | ( | MSN::NotificationServerConnection * | conn,
|  | MSN::ListSyncInfo * | data |
| ) |  |  | `[pure virtual]`

Notifies the application that you have received your lists (Address Book, allow list, block list, reverse list and pending list) You must call completeConnection on notification server connection to complete the initial process. An example can be found in msntest.cpp

virtual void MSN::Callbacks::gotContactDisplayPicture | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::Passport | passport,
|  | std::string | filename |
| ) |  |  | `[pure virtual]`

Notifies your application that you got a new display picture from "passaport"

virtual void MSN::Callbacks::gotEmoticonFile | ( | MSN::SwitchboardServerConnection * | conn,
|  | unsigned int | sessionID,
|  | std::string | alias,
|  | std::string | file |
| ) |  |  | `[pure virtual]`

Notifies your application that the other contact sent you an emoticon

virtual void MSN::Callbacks::gotEmoticonNotification | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::Passport | buddy,
|  | std::string | alias,
|  | std::string | msnobject |
| ) |  |  | `[pure virtual]`

Notifies your application that received an emoticon notification. To get it you should call requestEmoticon() and pass msnobject to it

virtual void MSN::Callbacks::gotFriendlyName | ( | MSN::NotificationServerConnection * | conn,
|  | std::string | friendlyname |
| ) |  |  | `[pure virtual]`

Notifies the application that your friendly name now is 'friendlyname'. Probably this is the reply to a previous setFriendlyName() call.

virtual void MSN::Callbacks::gotGTC | ( | MSN::NotificationServerConnection * | conn,
|  | char | c |
| ) |  |  | `[pure virtual]`

This is a response to a previous sent GTC command.

virtual void MSN::Callbacks::gotInitialEmailNotification | ( | MSN::NotificationServerConnection * | conn,
|  | int | msgs_inbox,
|  | int | unread_inbox,
|  | int | msgs_folders,
|  | int | unread_folders |
| ) |  |  | `[pure virtual]`

Notifies your application that you got an initial email notification.

virtual void MSN::Callbacks::gotInk | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::Passport | username,
|  | std::string | image |
| ) |  |  | `[pure virtual]`

Notifies your application that you got a new Ink.

virtual void MSN::Callbacks::gotInstantMessage | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::Passport | buddy,
|  | std::string | friendlyname,
|  | MSN::Message * | msg |
| ) |  |  | `[pure virtual]`

Notifies your application that received an instant message

virtual void MSN::Callbacks::gotLatestListSerial | ( | MSN::NotificationServerConnection * | conn,
|  | std::string | lastChange |
| ) |  |  | `[pure virtual]`

Notifies the application that one change was made to your lists, and the current timestamp is lastChange. This number should be used on initial process to specify what version of your lists you already have. If the server version is not the same, it will provide only the diff between your version and the current one. THE PARTIAL LIST FETCH IS NOT WORKING YET.

virtual void MSN::Callbacks::gotMessageSentACK | ( | MSN::SwitchboardServerConnection * | conn,
|  | int | trID |
| ) |  |  | `[pure virtual]`

Notifies your application that the "trID" message was received by the other contact

virtual void MSN::Callbacks::gotNewConnection | ( | MSN::Connection * | conn | ) | `[pure virtual]`

Notifies your application that there is a new connection

virtual void MSN::Callbacks::gotNewEmailNotification | ( | MSN::NotificationServerConnection * | conn,
|  | std::string | from,
|  | std::string | subject |
| ) |  |  | `[pure virtual]`

Notifies your application that you got an email notification.

virtual void MSN::Callbacks::gotNudge | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::Passport | username |
| ) |  |  | `[pure virtual]`

Notifies your application that you got a nudge

virtual void MSN::Callbacks::gotOIM | ( | MSN::NotificationServerConnection * | conn,
|  | bool | success,
|  | std::string | id,
|  | std::string | message |
| ) |  |  | `[pure virtual]`

Notifies your application that you got (or not) one previously requested OIM.

virtual void MSN::Callbacks::gotOIMDeleteConfirmation | ( | MSN::NotificationServerConnection * | conn,
|  | bool | success,
|  | std::string | id |
| ) |  |  | `[pure virtual]`

Notifies your application if a previously request to delete one OIM was successful.

virtual void MSN::Callbacks::gotOIMList | ( | MSN::NotificationServerConnection * | conn,
|  | std::vector< MSN::eachOIM > | OIMs |
| ) |  |  | `[pure virtual]`

Notifies your application that you got a new OIM list.

virtual void MSN::Callbacks::gotOIMSendConfirmation | ( | MSN::NotificationServerConnection * | conn,
|  | bool | success,
|  | int | id |
| ) |  |  | `[pure virtual]`

Notifies your application if a previously sent OIM was delivered.

virtual void MSN::Callbacks::gotSwitchboard | ( | MSN::SwitchboardServerConnection * | conn,
|  | const void * | tag |
| ) |  |  | `[pure virtual]`

Notifies your application that you got a new switchboard connection

virtual void MSN::Callbacks::gotVoiceClipFile | ( | MSN::SwitchboardServerConnection * | conn,
|  | unsigned int | sessionID,
|  | std::string | file |
| ) |  |  | `[pure virtual]`

Notifies your application that the other contact sent you a voice clip

virtual void MSN::Callbacks::gotVoiceClipNotification | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::Passport | username,
|  | std::string | msnobject |
| ) |  |  | `[pure virtual]`

Notifies your application that you got a new voice clip. To get it you should call requestVoiceClip() and pass msnobject to it

virtual void MSN::Callbacks::gotWinkFile | ( | MSN::SwitchboardServerConnection * | conn,
|  | unsigned int | sessionID,
|  | std::string | file |
| ) |  |  | `[pure virtual]`

Notifies your application that the other contact sent a wink

virtual void MSN::Callbacks::gotWinkNotification | ( | MSN::SwitchboardServerConnection * | conn,
|  | MSN::Passport | username,
|  | std::string | msnobject |
| ) |  |  | `[pure virtual]`

Notifies your application that you got a new wink. To get it you should call requestWink() and pass msnobject to it

virtual void MSN::Callbacks::log | ( | int | writing,
|  | const char * | buf |
| ) |  |  | `[pure virtual]`

Allow your application to log some network traffic

virtual void MSN::Callbacks::registerSocket | ( | void * | sock,
|  | int | read,
|  | int | write,
|  | bool | isSSL |
| ) |  |  | `[pure virtual]`

Asks the application that libmsn only must to be notified when the socket become readable and/or writable.

virtual void MSN::Callbacks::removedContactFromAddressBook | ( | MSN::NotificationServerConnection * | conn,
|  | bool | removed,
|  | std::string | contactId,
|  | std::string | passport |
| ) |  |  | `[pure virtual]`

Notifies your application that a contact was removed from the Address Book, or not, depending on the 'removed' boolean variable.

virtual void MSN::Callbacks::removedContactFromGroup | ( | MSN::NotificationServerConnection * | conn,
|  | bool | removed,
|  | std::string | groupId,
|  | std::string | contactId |
| ) |  |  | `[pure virtual]`

Notifies your application that a contact was removed from a group, or not, depending on the 'removed' boolean variable.

virtual void MSN::Callbacks::removedGroup | ( | MSN::NotificationServerConnection * | conn,
|  | bool | removed,
|  | std::string | groupId |
| ) |  |  | `[pure virtual]`

Notifies your application that an old group was removed, or not, depending on the 'removed' boolean variable.

virtual void MSN::Callbacks::removedListEntry | ( | MSN::NotificationServerConnection * | conn,
|  | MSN::ContactList | list,
|  | MSN::Passport | buddy |
| ) |  |  | `[pure virtual]`

Notifies your application that some list was modified by removing some old contact. If ContactList is MSN::LST_RL, it means this contact has removed you from its Address Book.

virtual void MSN::Callbacks::renamedGroup | ( | MSN::NotificationServerConnection * | conn,
|  | bool | renamed,
|  | std::string | newGroupName,
|  | std::string | groupId |
| ) |  |  | `[pure virtual]`

Notifies your application that an old group was renamed.

virtual void MSN::Callbacks::showError | ( | MSN::Connection * | conn,
|  | std::string | msg |
| ) |  |  | `[pure virtual]`

Allow your application to be notified about errors on library layer

virtual void MSN::Callbacks::unregisterSocket | ( | void * | sock | ) | `[pure virtual]`

Asks the application to never notify libmsn again about events in the socket.

virtual size_t MSN::Callbacks::writeDataToSocket | ( | void * | sock,
|  | char * | data,
|  | size_t | size |
| ) |  |  | `[pure virtual]`

Asks your application to write `size` bytes from `data` to `sock`. It must return the real size written to *sock