Logo Search packages:      
Sourcecode: kmess version File versions  Download package

MsnNotificationConnection Class Reference

The primary connection to the MSN server. More...

#include <msnnotificationconnection.h>

Inheritance diagram for MsnNotificationConnection:
Collaboration diagram for MsnNotificationConnection:

List of all members.


struct  MSNPMSNG
struct  OfflineImMessage

Public Slots

void addContactToGroup (QString handle, QString groupId)
 Add a contact to another group.
void addExistingContact (QString handle, const QStringList &groupsId=QStringList())
 Re-add a known contact to the friends list.
void addGroup (QString name)
 Add a new group.
void addNewContact (QString handle, const QStringList &groupsId=QStringList())
 Add a new contact to the list.
void allowContact (QString handle)
 Adds the given contact to the allow list only.
void blockContact (QString handle)
 Block the given contact.
void changeCurrentMedia (const QString &application, const QString &mediaType, bool enabled, const QString &formatString, const QStringList arguments)
 Change the current media of the user.
void changedMsnObject ()
 Called when the MSN Object of the current user changed.
void changeFriendlyName (QString newName)
 Change the friendly name of the user.
void changePersonalMessage (QString newMessage)
 Change the personal message of the user.
void changePersonalProperties (const QString &cid, int blp)
void changeProperty (QString type, QString value)
 Change a user property.
void changeProperty (QString handle, QString type, QString value)
 Change a contact property.
void moveContact (QString handle, QString fromGroupId, QString toGroupId)
void removeContact (QString handle, bool block=true)
void removeContactFromGroup (QString handle, QString groupId)
void removeCurrentMedia ()
void removeGroup (QString id)
void renameGroup (QString id, QString newName)
void requestSwitchboard (QString handle, ChatInformation::ConnectionType type)
void unblockContact (QString handle)


void addressBookChanged (const QString &id, AddressBookService::AddressBookUpdate update)
void connected ()
void contactAddedUser (const QString handle)
void disconnected ()
void newEmail (QString sender, QString subject, bool inInbox, QString command, QString folder, QString url)
void offlineMessage (const ChatMessage &message)
void pingSent ()
void reconnect (QString handle)
void startSwitchboard (const ChatInformation &chatInfo)
void statusMessage (QString message, bool isError)

Public Member Functions

void changeStatus (const Status newStatus)
 Change the status of the user.
void closeConnection ()
 Close the connection with the server.
QAbstractItemModel * getContactListModel ()
 Return the contact list model.
bool initialize ()
 Initialize the object.
bool isConnected () const
 Return whether or the socket is connected.
 MsnNotificationConnection ()
 The constructor.
bool openConnection ()
void readProperties ()
void saveProperties ()
 ~MsnNotificationConnection ()
 The destructor.

Protected Types

 Ack type parameter for sendMimeMessage() More...

Protected Member Functions

void addSoapClient (HttpSoapConnection *client)
 Internal function to track SOAP clients.
void connectToServer (const QString &server=QString(), const quint16 port=0)
 Connect to the given server via the socket.
void deleteSoapClient (HttpSoapConnection *client)
 Disconnect and delete a SOAP clients.
void deleteSoapClients ()
 Disconnect and delete all SOAP clients.
void disconnectFromServer (bool isTransfer=false)
 Disconnect from the server.
const QString getLocalIp () const
 Return the local IP address of the socket.
bool isErrorCommand (const QString &command) const
 Return whether the given command is an error command.
virtual bool isPayloadCommand (const QString &command) const
 Return whether the given command is a payload command.
void parseMultiPacketMimeMessage (const QStringList &command, const MimeMessage &mimeMessage)
int sendCommand (const QString &prefix, const QString &text="\r\n")
 Send a command to the server.
int sendMimeMessage (AckType ackType, const MimeMessage &message)
 Send a MIME message command to the server.
int sendPayloadMessage (const QString &prefix, const QString &arguments, const QString &payload)
int sendPayloadMessage (const QString &prefix, const QString &arguments, const QByteArray &payload)
void setAcceptedPayloadCommands (QStringList commandList)
void setSendPings (bool sendPings)
bool switchToHttpSocket ()
 If it is possible, switch to the HTTP connection.
bool switchToTcpSocket ()
 Switch back to the TCP connection.
void writeBinaryData (const QByteArray &data)
void writeData (const QString &data)

Private Slots

void checkSwitchboardsTimeout ()
RoamingServicecreateRoamingService ()
 Internal function to create the Roaming Service.
void goOnline ()
 Called when the user is ready to go online.
void loginIncorrect ()
void loginSucceeded ()
 The passport login succeeded.
void receivedMailData (QDomElement mailData)
void receivedOfflineIm (const QString &messageId, const QString &from, const QString &to, const QDateTime &date, const QString &body, const QString &runId, int sequenceNum)
void slotAuthenticationFailed ()
 The authentication process has timed out.
void slotConnected ()
 Called when the connection has been established.
void slotContactAdded (const QString &handle, const QString &contactId, const QStringList &groupsId)
void slotContactAddedToGroup (const QString &contactId, const QString &groupId)
void slotContactBlocked (const QString &handle)
void slotContactDeleted (const QString &contactId)
void slotContactDeletedFromGroup (const QString &contactId, const QString &groupId)
void slotContactUnblocked (const QString &handle)
void slotError (QString error, MsnSocketBase::ErrorType type)
 Shows error dialog boxes.
void slotErrorEventActivated (NotificationManager::EventSettings settings, NotificationManager::Buttons button)
void slotGotAddressBookList (const QList< QHash< QString, QVariant > > &contacts)
void slotGotGroup (const QString &id, const QString &name)
 Called when address book services parsed a group.
void slotGotMembershipLists (const QString &serviceType, const QHash< QString, int > &contactsRole)
 Called when address book services retrieved membership lists.
void slotWarning (const QString &warning, bool isImportant)
void unlockNotifications ()
 Unlock notifications after the first seconds of connections.

Private Member Functions

AddressBookServicecreateAddressBookService ()
 Create and return one pointer to address book service.
OfflineImServicecreateOfflineImService ()
 Internal function to create the Offline-IM service.
PassportLoginServicecreatePassportLoginService ()
 Internal function to create the passport login handler.
QByteArray createTripleDes (const QByteArray &key, const QByteArray &secret, const QByteArray &iv)
 Compute a triple des encryption.
void gotAdl (const QStringList &command, const QString &payload="")
void gotChg (const QStringList &command)
void gotChl (const QStringList &command)
void gotCvr (const QStringList &command)
void gotFln (const QStringList &command)
void gotIln (const QStringList &command)
void gotNln (const QStringList &command)
 Handle the NLN command; a contact changed it's status.
void gotOut (const QStringList &command)
void gotPrp (const QStringList &command)
void gotRml (const QStringList &command)
void gotRng (const QStringList &command)
 Received a connection request from a contact.
void gotUbx (const QStringList &command, const QByteArray &payload)
void gotUrl (const QStringList &command)
void gotUsr (const QStringList &command)
 Received a USR command from the server.
void gotVer (const QStringList &command)
void gotXfr (const QStringList &command)
 Received server transfer information.
void parseCommand (const QStringList &command)
 Process a received command.
void parseError (const QStringList &command, const QByteArray &payloadData)
 Process a received error command.
void parseMimeMessage (const QStringList &command, const MimeMessage &message)
 Process a received MIME message.
void parsePayloadMessage (const QStringList &command, const QByteArray &payload)
 Process a received payload message.
void putAdl (const QString &handle="", int list=0)
 Send the ADL command.
void putRml (const QString &handle, int list)
void putUux ()
 Send the personal status and current media fields.
void putVer ()
 Send the version command.

Private Attributes

bool connected_
QHash< QString, int > contactsRole_
bool enableNotifications_
QTimer friendlyNameWaitTimer_
bool goneOnline_
QString initialContactAddedGroup_
bool initialized_
bool initialStatusSent_
bool isInitiatingConnection_
QString lastCurrentMedia_
QString lastPsm_
int lastStatus_
QTimer loginTimer_
QByteArray nonceBase64_
QTimer notificationUnlockTimer_
QList< OfflineImMessage * > offlineImMessages_
QList< ChatInformation * > openRequests_
QStringList pendingOfflineImMessages_


class KMessTest

Detailed Description

The primary connection to the MSN server.

The notification connection is initialized when the user signs in to the MSN Messenger service. When this connection is dropped, the user is signed off as well. The notification connection is used for the following actions:

  • managing the contact list
  • starting new chat sessions
  • receive invitations for a chat session
  • receive status updates about contacts, e.g.:
    • online/offline changes
    • new email
    • personal status messages
    • now playing information
    • new offline-im messages

Most protocol commands are echo'ed back to the client. This allows a Model-View-Controller based protocol handling, see MsnConnection::parseCommand() for details.

When the connection to the notification server is established, the the PassportLoginService class is used to retrieve an authentication token. This token is provided to the USR command complete the login process.

When a contact is updated, it's information in the ContactList class is updated automatically. Contacts are organized in multiple "lists". This differs from the "groups" seen in the main window! See the Contact class for information about "lists" and "groups".

New chat invitations are handled by the XFR command. The server response contains the login data for a chat session (or "chat room") at a switchboard server. This information is used to start the chat session. The information about new chats is forwarded to the ChatMaster first. This class looks for existing chats with a contact, or opens a new chat window instead when needed. The actual chat session is handled by the MsnSwitchboardConnection class. Once the chat session is created, the other contact is invited to the session at the switchboard server.

Some contact commands include an MsnObject argument. This is the "ticket" to request a display picture later, by "inviting" the contact to transfer the data belonging to the MsnObject. Invitations for file and msnobject transfers are not handled by the notification connection however. A chat session needs to be started first. The invitation for the msnobject or file transfer can be sent there.

Note that each connection starts with a version exchange. Clients inform the server about the versions of the protocol it supports. The commands documented here may differ from other clients using a different protocol version. Currently KMess uses MSNP15 for all the notification connection. New features are added to new protocol versions only. Therefore, something as simple as a 'personal status message' required an upgrade to a complete new protocol version. The UBX command - which contains the personal status message - is only sent as of MSNP11.

The CHG and NLN commands include a bitwise flag with the supported client-to-client features. This includes the MSNC version for the invitation system, the type of the client ('normal', 'mobile', 'web messenger') and features like 'winks', 'webcam', 'folder sharing'. By advertising these values, a client promoses the feature is fully supported. Changing the advertised MSNC version changes the type of P2P messages sent by another client. Hence, changing the capabilities value could pose a major impact. The list of known flags can be found in the ContactBase::MsnClientCapabilities enum.

Mike K. Bennett
Valerio Pilo
Antonio Nastasi

Definition at line 116 of file msnnotificationconnection.h.

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index