~ubuntu-branches/ubuntu/wily/psi/wily-proposed

« back to all changes in this revision

Viewing changes to src/sxe/sxesession.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2009-09-25 17:49:51 UTC
  • mfrom: (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090925174951-lvm7kdap82o8xhn3
Tags: 0.13-1
* Updated to upstream version 0.13
* Set Standards-Version to 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef SXDESESSION_H
22
22
#define SXDESESSION_H
23
23
 
24
 
#define SXDENS "http://jabber.org/protocol/sxe" 
 
24
#define SXENS "http://jabber.org/protocol/sxe" 
 
25
/*  ^^^^ make sure corresponds to NS used for parsing in iris/src/xmpp/xmpp-im/types.cpp ^^^^ */
25
26
 
26
27
#include <QObject>
27
28
#include <QList>
49
50
 
50
51
    private:
51
52
        struct IncomingEdit {
52
 
            Jid sender;
53
 
            QString sxeid;
54
 
            SxeEdit* edit;
 
53
            QString id;
 
54
            QDomElement xml;
55
55
        };
56
56
 
57
57
    public:
67
67
        /*! \brief Initializes the shared document. Only used if starting a new session; not when joining one. */
68
68
        void initializeDocument(const QDomDocument &doc);
69
69
        /*! \brief Processes the incoming SXE element and remembers its identifying information.*/
70
 
        void processIncomingSxeElement(const QDomElement &, const Jid &sender);
 
70
        void processIncomingSxeElement(const QDomElement &, const QString &id);
71
71
        /*! \brief Returns a const reference to the target document.*/
72
72
        const QDomDocument& document() const;
73
73
        /*! \brief Returns true if the target is a groupchat.*/
74
 
        const bool groupChat() const;
 
74
        bool groupChat() const;
75
75
        /*! \brief Returns true if the target is a groupchat.*/
76
 
        const bool serverSupport() const;
 
76
        bool serverSupport() const;
77
77
        /*! \brief Returns the target contact's JID.*/
78
78
        const Jid target() const;
79
79
        /*! \brief Returns the session identifier.*/
82
82
        const Jid ownJid() const;
83
83
        /*! \brief Returns the session identifier.*/
84
84
        const QList<QString> features() const;
 
85
 
85
86
        /*! \brief Starts queueing new edits to the document.
86
87
         *  Queueing should be started just before sending <document-begin/>.
87
88
         */
90
91
         *  Queueing should be stopped after sending <document-end/>.
91
92
         */
92
93
        void stopQueueing();
93
 
        /*! \brief Erases the sxe elements from the incoming queue up to and including the sxe identified by the parameters.
94
 
         *  The parameters correspond to the attributes of the last-edit element.
95
 
         */
96
 
        void eraseQueueUntil(QString sender, QString id);
97
 
        /*! \brief Sets whether configure edits are accepted regardless of version.
98
 
         *  Default is false. Should be set true if the session state is Negotiation::DocumentBegun.
99
 
         *  Initializes the document with \a doc if provided.
100
 
         */
101
 
        void setImporting(bool, const QDomDocument &doc = QDomDocument());
102
 
        /*! \brief Return a id with information identifying the last processed sxe element.*/
103
 
        QHash<QString, QString> lastSxe() const;
104
 
        /*! \brief Sets the information identifying the last processed sxe.*/
105
 
        void setLastSxe(const QString &sender, const QString &id);
106
 
 
 
94
 
 
95
        /*! \brief Initializes the document with the prolog of \a doc if provided.
 
96
         * Should be used when <document-begin/> is received when joining.
 
97
         */
 
98
        void startImporting(const QDomDocument &doc = QDomDocument());
 
99
        /*! \brief Enters the normal editing mode.
 
100
         * Should be used when <document-end/> is received when joining.
 
101
         */
 
102
        void stopImporting();
 
103
 
 
104
        /*! \brief Add the given ID to the list of used IDs for <sxe/> elements.*/
 
105
        void addUsedSxeId(QString id);
 
106
        /*! \brief Return the list of used IDs for <sxe/> elements.*/
 
107
        QList<QString> usedSxeIds();
 
108
 
 
109
        void setUUIDPrefix(const QString uuidPrefix = QString());
107
110
        /*! \brief Returns a random UUID without enclosing { }. */
108
111
        static QString generateUUID();
109
112
        /*! \brief Returns the prolog of the document as a string. */
183
186
            Returns true iff \a meta1 was removed. */
184
187
        bool removeSmaller(SxeRecord* meta1, SxeRecord* meta2);
185
188
        /*! \brief Processes an incoming sxe element.*/
186
 
        bool processSxe(const QDomElement &sxe);
 
189
        bool processSxe(const QDomElement &sxe, const QString &id);
187
190
        /*! \brief Queues an outgoing edit to be sent when flushed.*/
188
191
        void queueOutgoingEdit(SxeEdit* edit);
189
192
        /*! \brief Creates the record of node with rid \a id. Returns a pointer to it. */
236
239
        bool importing_;
237
240
        /*! \brief A list of supported features for the session.*/
238
241
        QList<QString> features_;
239
 
         /*! \brief A string that identifies the last edit that was processed.*/
240
 
        QHash<QString, QString> lastSxe_;
241
 
        /*! \brief The highest primary weight value in the document.*/
242
 
        int highestWeight_;
 
242
         /*! \brief Identifiers for the <sxe/> elements that have been processed already.*/
 
243
        QList<QString> usedSxeIds_;
 
244
        /*! \brief A unique id is generated as "uuidPrefix.counter".*/
 
245
        QString uuidPrefix_;
 
246
        int uuidMaxPostfix_;
243
247
        /*! \brief The main DOM document.*/
244
248
        QDomDocument doc_;
245
249
};