Logo Search packages:      
Sourcecode: kmess version File versions

offlineimservice.h

/***************************************************************************
                          offlineimservice.h -  description
                             -------------------
    begin                : Thu Sep 07 2006
    copyright            : (C) 2006 by Diederik van der Boor
    email                : "vdboor" --at-- "codingdomain.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef OFFLINEIMSERVICE_H
#define OFFLINEIMSERVICE_H

#include "extra/httpsoapconnection.h"

class ChatMessage;
class QDateTime;

/**
 * @brief SOAP calls to the Offline-IM webserice.
 *
 * This class implements the method calls of the Offline-IM webservice.
 * The respones of these methods are processed internally;
 * a signal is fired to return the processed results.
 * The following methods of the Offline-IM webservice are available:
 * - deleteMessages()
 * - getMessage()
 * - getMetaData()
 *
 * For additional documentation about Offline-IM,
 * see: http://msnpiki.msnfanatic.com/index.php/MSNP13:Offline_IM
 *
 * @author Diederik van der Boor
 * @ingroup NetworkCore
 */
00043 class OfflineImService : public HttpSoapConnection
{
  Q_OBJECT

  public:  // public methods
    // The constructor
                         OfflineImService( const QString &authT, const QString &authP, QObject *parent = 0 );
    // The destructor
    virtual             ~OfflineImService();

    // Delete messages from the storage space
    void                 deleteMessages( const QStringList &messageIds );
    // Request an offline message.
    void                 getMessage( const QString &messageId, bool markAsRead = false );
    // Request the Mail-Data field over SOAP.
    void                 getMetaData();

  private:
    // Extract the e-mail address from an RFC822 formatted string.
    QString              extractRFC822Address( const QString &address );
    // Process the getMessage response
    void                 processGetMessageResult( QDomElement &resultRoot );
    // Process server responses
    void                 slotRequestFinished( QDomElement &resultRoot );

  private:
    /// The <code>t</code> value of the passport cookie.
00070     QString              authT_;
    /// The <code>p</code> value of the passport cookie.
00072     QString              authP_;
    /// The passport header to send with SOAP
00074     QString              passportCookieHeader_;

  signals:
    /**
     * @brief Fired when the response of the getMetaData() call arrived.
     * @param  metaData  The received data.
     */
    void                 metaDataReceived( QDomElement metaData );

    /**
     * @brief Fired when the response of the getMessage() call arrived.
     *
     * When multiple messages are downloaded,
     * use the date value to order the messages.
     * The runId and sequenceNum fields may appear in a different order.
     *
     * @param  messageId    Identifier of the offline message.
     * @param  from         The contact who sent the message.
     * @param  to           The recipient of the message; the current user.
     * @param  date         The original date of the message.
     * @param  body         The message body; the message typed by the sender.
     * @param  runId        Identifier of the chat session.
     * @param  sequenceNum  Identifier of the message in the chat session.
     */
    void                 messageReceived( const QString &messageId, const QString &from, const QString &to,
                                          const QDateTime &date, const QString &body,
                                          const QString &runId, int sequenceNum );
};

#endif

Generated by  Doxygen 1.6.0   Back to index