| abstractroster.h | | abstractroster.h | |
| | | | |
| skipping to change at line 61 | | skipping to change at line 61 | |
| class Client; | | class Client; | |
| class IQ; | | class IQ; | |
| class Presence; | | class Presence; | |
| class AbstractRoster; | | class AbstractRoster; | |
| class AbstractRosterPrivate; | | class AbstractRosterPrivate; | |
| class SimpleRosterPrivate; | | class SimpleRosterPrivate; | |
| class RosterItem; | | class RosterItem; | |
| class RosterItemPrivate; | | class RosterItemPrivate; | |
| class AbstractRosterQuery; | | class AbstractRosterQuery; | |
| | | | |
|
| class ItemFactory : public XmlStreamFactory<RosterItem> | | class JREEN_AUTOTEST_EXPORT ItemFactory : public XmlStreamFactory<RosterIte
m> | |
| { | | { | |
| public: | | public: | |
| }; | | }; | |
| | | | |
| enum AbstractRosterIqContext | | enum AbstractRosterIqContext | |
| { | | { | |
| SyncContext, | | SyncContext, | |
| LoadRoster, | | LoadRoster, | |
| AddRosterItem, | | AddRosterItem, | |
| RemoveRosterItem | | RemoveRosterItem | |
| | | | |
| skipping to change at line 140 | | skipping to change at line 140 | |
| protected slots: | | protected slots: | |
| virtual void handleIQ(const Jreen::IQ &iq); | | virtual void handleIQ(const Jreen::IQ &iq); | |
| virtual void handleIQ(const Jreen::IQ &iq, int context); | | virtual void handleIQ(const Jreen::IQ &iq, int context); | |
| protected: | | protected: | |
| virtual void onItemAdded(QSharedPointer<RosterItem> item); | | virtual void onItemAdded(QSharedPointer<RosterItem> item); | |
| virtual void onItemUpdated(QSharedPointer<RosterItem> item); | | virtual void onItemUpdated(QSharedPointer<RosterItem> item); | |
| virtual void onItemRemoved(const QString &jid); | | virtual void onItemRemoved(const QString &jid); | |
| virtual void onLoaded(const QList<QSharedPointer<RosterItem> > &item
s); | | virtual void onLoaded(const QList<QSharedPointer<RosterItem> > &item
s); | |
| QScopedPointer<AbstractRosterPrivate> d_ptr; | | QScopedPointer<AbstractRosterPrivate> d_ptr; | |
| friend class AbstractRosterQuery; | | friend class AbstractRosterQuery; | |
|
| friend class AbstractRosterQueryFactory; | | friend class JREEN_AUTOTEST_EXPORT AbstractRosterQueryFactory; | |
| friend class RosterItem; | | friend class RosterItem; | |
| }; | | }; | |
| | | | |
| class JREEN_EXPORT SimpleRoster : public AbstractRoster | | class JREEN_EXPORT SimpleRoster : public AbstractRoster | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| Q_DECLARE_PRIVATE(SimpleRoster) | | Q_DECLARE_PRIVATE(SimpleRoster) | |
| public: | | public: | |
| SimpleRoster(Client *client, SimpleRosterPrivate *data = 0); | | SimpleRoster(Client *client, SimpleRosterPrivate *data = 0); | |
| virtual ~SimpleRoster(); | | virtual ~SimpleRoster(); | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| client.h | | client.h | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| | | | |
| #ifndef CLIENT_H | | #ifndef CLIENT_H | |
| #define CLIENT_H | | #define CLIENT_H | |
| | | | |
| #include <QObject> | | #include <QObject> | |
| #include <QSet> | | #include <QSet> | |
| #include "jreen.h" | | #include "jreen.h" | |
| #include "presence.h" | | #include "presence.h" | |
| #include "disco.h" | | #include "disco.h" | |
| | | | |
|
| class QNetworkProxyFactory; | | class JREEN_AUTOTEST_EXPORT QNetworkProxyFactory; | |
| class QNetworkProxy; | | class QNetworkProxy; | |
| | | | |
| namespace Jreen | | namespace Jreen | |
| { | | { | |
| | | | |
| class ClientPrivate; | | class ClientPrivate; | |
| class JID; | | class JID; | |
| class Message; | | class Message; | |
| class IQ; | | class IQ; | |
| class IQReply; | | class IQReply; | |
| | | | |
| skipping to change at line 83 | | skipping to change at line 83 | |
| { | | { | |
| User, | | User, | |
| HostUnknown, | | HostUnknown, | |
| ItemNotFound, | | ItemNotFound, | |
| AuthorizationError, | | AuthorizationError, | |
| RemoteStreamError, | | RemoteStreamError, | |
| RemoteConnectionFailed, | | RemoteConnectionFailed, | |
| InternalServerError, | | InternalServerError, | |
| SystemShutdown, | | SystemShutdown, | |
| Conflict, | | Conflict, | |
|
| Unknown | | Unknown, | |
| | | NoCompressionSupport, | |
| | | NoEncryptionSupport, | |
| | | NoAuthorizationSupport, | |
| | | NoSupportedFeature | |
| }; | | }; | |
|
| | | | |
| | | enum Feature { | |
| | | InvalidFeature = -1, | |
| | | Compression = 0, | |
| | | Encryption, | |
| | | Authorization | |
| | | }; | |
| | | | |
| | | enum FeatureConfig { | |
| | | Force, | |
| | | Disable, | |
| | | Auto | |
| | | }; | |
| | | | |
| Client(const JID &jid, const QString &password = QString(), int port
= -1); | | Client(const JID &jid, const QString &password = QString(), int port
= -1); | |
| Client(); | | Client(); | |
| virtual ~Client(); | | virtual ~Client(); | |
| void setPingInterval(int interval); | | void setPingInterval(int interval); | |
| const JID &jid(); | | const JID &jid(); | |
| void setJID(const JID &jid); | | void setJID(const JID &jid); | |
| void setPassword(const QString &password); | | void setPassword(const QString &password); | |
| void setServer(const QString &server); | | void setServer(const QString &server); | |
| void setResource(const QString &resource); | | void setResource(const QString &resource); | |
| void setPort(int port); | | void setPort(int port); | |
| void setProxy(const QNetworkProxy &proxy); | | void setProxy(const QNetworkProxy &proxy); | |
|
| | | void setFeatureConfig(Feature feature, FeatureConfig config); | |
| | | FeatureConfig featureConfig(Feature feature) const; | |
| | | bool isFeatureActivated(Feature feature) const; | |
| QNetworkProxy proxy() const; | | QNetworkProxy proxy() const; | |
| void setProxyFactory(QNetworkProxyFactory *factory); | | void setProxyFactory(QNetworkProxyFactory *factory); | |
| QNetworkProxyFactory *proxyFactory() const; | | QNetworkProxyFactory *proxyFactory() const; | |
| void addXmlStreamHandler(XmlStreamHandler *handler); | | void addXmlStreamHandler(XmlStreamHandler *handler); | |
| QSet<QString> serverFeatures() const; | | QSet<QString> serverFeatures() const; | |
| Disco::IdentityList serverIdentities() const; | | Disco::IdentityList serverIdentities() const; | |
| const QString &server() const; | | const QString &server() const; | |
| int port() const; | | int port() const; | |
| QString password() const; | | QString password() const; | |
| const QString getID(); | | const QString getID(); | |
| | | | |
| skipping to change at line 118 | | skipping to change at line 139 | |
| MessageSessionManager *messageSessionManager(); | | MessageSessionManager *messageSessionManager(); | |
| AbstractRoster *roster(); | | AbstractRoster *roster(); | |
| bool isConnected() const; | | bool isConnected() const; | |
| void send(const Stanza &stanza); | | void send(const Stanza &stanza); | |
| void send(const Presence &pres); | | void send(const Presence &pres); | |
| IQReply *send(const IQ &iq); | | IQReply *send(const IQ &iq); | |
| /* Q_DECL_DEPRECATED */ void send(const IQ &iq, QObject *handler, co
nst char *member, int context); | | /* Q_DECL_DEPRECATED */ void send(const IQ &iq, QObject *handler, co
nst char *member, int context); | |
| void setConnection(Connection *conn); | | void setConnection(Connection *conn); | |
| Connection *connection() const; | | Connection *connection() const; | |
| void registerPayload(AbstractPayloadFactory *factory); | | void registerPayload(AbstractPayloadFactory *factory); | |
|
| void registerStreamFeature(StreamFeature *stream_feature); | | void registerStreamFeature(StreamFeature *streamFeature); | |
| | | void removeStreamFeature(StreamFeature *streamFeature); | |
| public slots: | | public slots: | |
| void setPresence(); | | void setPresence(); | |
| void setPresence(Jreen::Presence::Type type, const QString &text = Q
String(), int priority = -129); | | void setPresence(Jreen::Presence::Type type, const QString &text = Q
String(), int priority = -129); | |
| void connectToServer(); | | void connectToServer(); | |
| void disconnectFromServer(bool force = false); | | void disconnectFromServer(bool force = false); | |
| signals: | | signals: | |
| void connected(); | | void connected(); | |
| void disconnected(Jreen::Client::DisconnectReason); | | void disconnected(Jreen::Client::DisconnectReason); | |
| void authorized(); | | void authorized(); | |
| void presenceReceived(const Jreen::Presence &presence); | | void presenceReceived(const Jreen::Presence &presence); | |
| | | | |
| skipping to change at line 149 | | skipping to change at line 171 | |
| virtual void handlePresence(const Presence &presence); | | virtual void handlePresence(const Presence &presence); | |
| virtual void handleIQ(const IQ &iq); | | virtual void handleIQ(const IQ &iq); | |
| virtual void handleMessage(const Message &message); | | virtual void handleMessage(const Message &message); | |
| private: | | private: | |
| QScopedPointer<ClientPrivate> d_ptr; | | QScopedPointer<ClientPrivate> d_ptr; | |
| Q_PRIVATE_SLOT(d_func(), void _q_iq_received(const Jreen::IQ &iq, in
t context)) | | Q_PRIVATE_SLOT(d_func(), void _q_iq_received(const Jreen::IQ &iq, in
t context)) | |
| Q_PRIVATE_SLOT(d_func(), void _q_new_data()) | | Q_PRIVATE_SLOT(d_func(), void _q_new_data()) | |
| Q_PRIVATE_SLOT(d_func(), void _q_read_more()) | | Q_PRIVATE_SLOT(d_func(), void _q_read_more()) | |
| Q_PRIVATE_SLOT(d_func(), void _q_send_header()) | | Q_PRIVATE_SLOT(d_func(), void _q_send_header()) | |
| Q_PRIVATE_SLOT(d_func(), void _q_connected()) | | Q_PRIVATE_SLOT(d_func(), void _q_connected()) | |
|
| Q_PRIVATE_SLOT(d_func(), void _q_disconnected()) | | Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(Jreen::Connection::Soc
ketState)) | |
| }; | | }; | |
| | | | |
| } | | } | |
| | | | |
| #endif // CLIENT_H | | #endif // CLIENT_H | |
| | | | |
End of changes. 6 change blocks. |
| 4 lines changed or deleted | | 26 lines changed or added | |
|
| dataform.h | | dataform.h | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 43 | |
| #include <QHash> | | #include <QHash> | |
| #include <QVariant> | | #include <QVariant> | |
| | | | |
| namespace Jreen | | namespace Jreen | |
| { | | { | |
| | | | |
| // XEP-0004 | | // XEP-0004 | |
| // http://xmpp.org/extensions/xep-0004.html | | // http://xmpp.org/extensions/xep-0004.html | |
| | | | |
| class DataFormFieldPrivate; | | class DataFormFieldPrivate; | |
|
| | | class DataFormMediaPrivate; | |
| | | class Stanza; | |
| | | | |
| | | class JREEN_EXPORT DataFormMedia | |
| | | { | |
| | | Q_DECLARE_PRIVATE(DataFormMedia) | |
| | | public: | |
| | | typedef QSharedPointer<DataFormMedia> Ptr; | |
| | | | |
| | | class UriPrivate; | |
| | | class JREEN_EXPORT Uri | |
| | | { | |
| | | public: | |
| | | Uri(); | |
| | | Uri(const QUrl &url, const QString &type); | |
| | | Uri(const Uri &o); | |
| | | Uri &operator =(const Uri &o); | |
| | | ~Uri(); | |
| | | | |
| | | bool operator==(const Uri &o) const; | |
| | | | |
| | | QUrl url() const; | |
| | | void setUrl(const QUrl &url); | |
| | | QString type() const; | |
| | | void setType(const QString &type); | |
| | | private: | |
| | | QSharedDataPointer<UriPrivate> d; | |
| | | }; | |
| | | | |
| | | DataFormMedia(); | |
| | | ~DataFormMedia(); | |
| | | | |
| | | void appendUri(const Uri &uri); | |
| | | void appendUri(const QUrl &url, const QString &type); | |
| | | void setUries(const QList<Uri> &uries); | |
| | | QList<Uri> uries() const; | |
| | | | |
| | | QSize size() const; | |
| | | void setSize(const QSize &size); | |
| | | int width() const; | |
| | | void setWidth(int width); | |
| | | int height() const; | |
| | | void setHeight(int height); | |
| | | | |
| | | private: | |
| | | Q_DISABLE_COPY(DataFormMedia) | |
| | | QScopedPointer<DataFormMediaPrivate> d_ptr; | |
| | | }; | |
| | | | |
| class JREEN_EXPORT DataFormField | | class JREEN_EXPORT DataFormField | |
| { | | { | |
| public: | | public: | |
| enum Type | | enum Type | |
| { | | { | |
|
| | | Invalid = -1, | |
| Boolean, /**< The field enables an entity to
gather or provide an either-or | | Boolean, /**< The field enables an entity to
gather or provide an either-or | |
| * choice between two options. The default value is "false".
*/ | | * choice between two options. The default value is "false".
*/ | |
| Fixed, /**< The field is intended for data
description (e.g., human-readable | | Fixed, /**< The field is intended for data
description (e.g., human-readable | |
| * text such as "section" headers) rather than data gathering
or | | * text such as "section" headers) rather than data gathering
or | |
| * provision. The <value/> child SHOULD NOT contain newlines | | * provision. The <value/> child SHOULD NOT contain newlines | |
| * (the \n and \r characters); instead an application SHOULD | | * (the \n and \r characters); instead an application SHOULD | |
| * generate multiple fixed fields, each with one <value/> chi
ld. */ | | * generate multiple fixed fields, each with one <value/> chi
ld. */ | |
| Hidden, /**< The field is not shown to the
form-submitting entity, but | | Hidden, /**< The field is not shown to the
form-submitting entity, but | |
| * instead is returned with the form. The form-submitting ent
ity | | * instead is returned with the form. The form-submitting ent
ity | |
| * SHOULD NOT modify the value of a hidden field, but MAY do
so | | * SHOULD NOT modify the value of a hidden field, but MAY do
so | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 135 | |
| * and MUST NOT insert new options. */ | | * and MUST NOT insert new options. */ | |
| TextMulti, /**< The field enables an entity to
gather or provide multiple | | TextMulti, /**< The field enables an entity to
gather or provide multiple | |
| * lines of text. */ | | * lines of text. */ | |
| TextPrivate, /**< The field enables an entity to gather
or provide a single | | TextPrivate, /**< The field enables an entity to gather
or provide a single | |
| * line or word of text, which shall be obscured in an interf
ace | | * line or word of text, which shall be obscured in an interf
ace | |
| * (e.g., with multiple instances of the asterisk character).
*/ | | * (e.g., with multiple instances of the asterisk character).
*/ | |
| TextSingle, /**< The field enables an entity to
gather or provide a single | | TextSingle, /**< The field enables an entity to
gather or provide a single | |
| * line or word of text, which may be shown in an interface. | | * line or word of text, which may be shown in an interface. | |
| * This field type is the default and MUST be assumed if a fo
rm-submitting | | * This field type is the default and MUST be assumed if a fo
rm-submitting | |
| * entity receives a field type it does not understand. */ | | * entity receives a field type it does not understand. */ | |
|
| None, | | None | |
| Invalid | | | |
| }; | | }; | |
| | | | |
| DataFormField(Type type = Invalid, const QString &var = QString(), c
onst QString &label = QString()); | | DataFormField(Type type = Invalid, const QString &var = QString(), c
onst QString &label = QString()); | |
| DataFormField(const DataFormField &that); | | DataFormField(const DataFormField &that); | |
| DataFormField &operator =(const DataFormField &that); | | DataFormField &operator =(const DataFormField &that); | |
| ~DataFormField(); | | ~DataFormField(); | |
| | | | |
| Type type() const; | | Type type() const; | |
| bool isRequired() const; | | bool isRequired() const; | |
| void setRequired(bool required); | | void setRequired(bool required); | |
| QString var() const; | | QString var() const; | |
| void setVar(const QString &var); | | void setVar(const QString &var); | |
| QString label() const; | | QString label() const; | |
| void setLabel(const QString &label); | | void setLabel(const QString &label); | |
| QString description() const; | | QString description() const; | |
| void setDescription(const QString &desc); | | void setDescription(const QString &desc); | |
| | | | |
|
| | | DataFormMedia::Ptr media() const; | |
| | | void setMedia(const DataFormMedia::Ptr &media); | |
| | | | |
| void setValues(const QStringList &values); | | void setValues(const QStringList &values); | |
| QStringList values() const; | | QStringList values() const; | |
| void setValue(const QString &value); | | void setValue(const QString &value); | |
| QString value() const; | | QString value() const; | |
| | | | |
| template <typename T> T cast() const | | template <typename T> T cast() const | |
| { return T(static_cast<DataFormField::Type>(T::StaticType) == type()
? *this : DataFormField()); } | | { return T(static_cast<DataFormField::Type>(T::StaticType) == type()
? *this : DataFormField()); } | |
| | | | |
| protected: | | protected: | |
| QExplicitlySharedDataPointer<DataFormFieldPrivate> d_ptr; | | QExplicitlySharedDataPointer<DataFormFieldPrivate> d_ptr; | |
| | | | |
| skipping to change at line 332 | | skipping to change at line 384 | |
| public: | | public: | |
| enum Type | | enum Type | |
| { | | { | |
| Form, // The form-processing entity is asking the form-su
bmitting entity to complete a form. | | Form, // The form-processing entity is asking the form-su
bmitting entity to complete a form. | |
| Submit, // The form-submitting entity is submitting data to
the form-processing entity. The submission MAY include fields that were no
t provided in the empty form, but the form-processing entity MUST ignore an
y fields that it does not understand. | | Submit, // The form-submitting entity is submitting data to
the form-processing entity. The submission MAY include fields that were no
t provided in the empty form, but the form-processing entity MUST ignore an
y fields that it does not understand. | |
| Cancel, // The form-submitting entity has cancelled submiss
ion of data to the form-processing entity. | | Cancel, // The form-submitting entity has cancelled submiss
ion of data to the form-processing entity. | |
| Result, // The form-processing entity is returning data (e.
g., search results) to the form-submitting entity, or the data is a generic
data set. | | Result, // The form-processing entity is returning data (e.
g., search results) to the form-submitting entity, or the data is a generic
data set. | |
| Invalid | | Invalid | |
| }; | | }; | |
| DataForm(Type type = Submit, const QString &title = QString()); | | DataForm(Type type = Submit, const QString &title = QString()); | |
|
| | | DataForm(Type type, const QString &title, const QString &instruction
s); | |
| virtual ~DataForm(); | | virtual ~DataForm(); | |
| | | | |
| Type type() const; | | Type type() const; | |
| void setType(Type type); | | void setType(Type type); | |
| QString typeName() const; | | QString typeName() const; | |
| void setTypeName(const QString &type); | | void setTypeName(const QString &type); | |
| QString title() const; | | QString title() const; | |
|
| | | QString instructions() const; | |
| QList<DataFormItem::Ptr> items() const; | | QList<DataFormItem::Ptr> items() const; | |
| DataFormReported::Ptr reported() const; | | DataFormReported::Ptr reported() const; | |
| }; | | }; | |
| | | | |
| template <> | | template <> | |
| Q_INLINE_TEMPLATE DataFormOptionContainer DataFormField::cast() const | | Q_INLINE_TEMPLATE DataFormOptionContainer DataFormField::cast() const | |
| { | | { | |
| bool ok = type() == ListMulti || type() == ListSingle; | | bool ok = type() == ListMulti || type() == ListSingle; | |
| return DataFormOptionContainer(ok ? *this : DataFormField()); | | return DataFormOptionContainer(ok ? *this : DataFormField()); | |
| } | | } | |
| | | | |
End of changes. 6 change blocks. |
| 2 lines changed or deleted | | 56 lines changed or added | |
|
| disco.h | | disco.h | |
| | | | |
| skipping to change at line 160 | | skipping to change at line 160 | |
| QScopedPointer<ItemsPrivate> d_ptr; | | QScopedPointer<ItemsPrivate> d_ptr; | |
| }; | | }; | |
| | | | |
| Disco(Client *client); | | Disco(Client *client); | |
| virtual ~Disco(); | | virtual ~Disco(); | |
| | | | |
| DiscoReply *requestInfo(const Item &item); | | DiscoReply *requestInfo(const Item &item); | |
| DiscoReply *requestItems(const Item &item); | | DiscoReply *requestItems(const Item &item); | |
| | | | |
| void addIdentity(const Identity &identity); | | void addIdentity(const Identity &identity); | |
|
| | | void addIdentity(const QString &category, const QString &type, const
QString &name, const QString &lang = QString()); | |
| const IdentityList &identities() const; | | const IdentityList &identities() const; | |
| IdentityList &identities(); | | IdentityList &identities(); | |
| const QSet<QString> &features() const; | | const QSet<QString> &features() const; | |
| QSet<QString> &features(); | | QSet<QString> &features(); | |
| void addFeature(const QString &feature); | | void addFeature(const QString &feature); | |
| void setSoftwareVersion(const QString &name, const QString &version,
const QString &os = QString()); | | void setSoftwareVersion(const QString &name, const QString &version,
const QString &os = QString()); | |
|
| | | void setSoftwareVersion(const QString &name, const QString &version,
const QString &os, const QString &osVersion); | |
| const DataForm *form() const; | | const DataForm *form() const; | |
| void setForm(DataForm *form); | | void setForm(DataForm *form); | |
| | | | |
| protected: | | protected: | |
| Q_PRIVATE_SLOT(d_func(), void _q_received(const Jreen::IQ &)) | | Q_PRIVATE_SLOT(d_func(), void _q_received(const Jreen::IQ &)) | |
| QScopedPointer<DiscoPrivate> d_ptr; | | QScopedPointer<DiscoPrivate> d_ptr; | |
| }; | | }; | |
| | | | |
| class JREEN_EXPORT DiscoReply : public QObject | | class JREEN_EXPORT DiscoReply : public QObject | |
| { | | { | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 2 lines changed or added | |
|
| logger.h | | logger.h | |
| /**************************************************************************
** | | /**************************************************************************
** | |
| ** | | ** | |
|
| ** qutIM - instant messenger | | ** Jreen | |
| ** | | ** | |
| ** Copyright © 2012 Ruslan Nigmatullin <euroelessar@yandex.ru> | | ** Copyright © 2012 Ruslan Nigmatullin <euroelessar@yandex.ru> | |
| ** | | ** | |
| ***************************************************************************
** | | ***************************************************************************
** | |
| ** | | ** | |
|
| ** $QUTIM_BEGIN_LICENSE$ | | ** $JREEN_BEGIN_LICENSE$ | |
| ** This program is free software: you can redistribute it and/or modify | | ** 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 | | ** it under the terms of the GNU General Public License as published by | |
|
| ** the Free Software Foundation, either version 3 of the License, or | | ** the Free Software Foundation, either version 2 of the License, or | |
| ** (at your option) any later version. | | ** (at your option) any later version. | |
| ** | | ** | |
| ** This program is distributed in the hope that it will be useful, | | ** This program is distributed in the hope that it will be useful, | |
| ** but WITHOUT ANY WARRANTY; without even the implied warranty of | | ** but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| ** See the GNU General Public License for more details. | | ** See the GNU General Public License for more details. | |
| ** | | ** | |
| ** You should have received a copy of the GNU General Public License | | ** You should have received a copy of the GNU General Public License | |
| ** along with this program. If not, see http://www.gnu.org/licenses/. | | ** along with this program. If not, see http://www.gnu.org/licenses/. | |
|
| ** $QUTIM_END_LICENSE$ | | ** $JREEN_END_LICENSE$ | |
| ** | | ** | |
| ***************************************************************************
*/ | | ***************************************************************************
*/ | |
| | | | |
| #ifndef LOGGER_H | | #ifndef LOGGER_H | |
| #define LOGGER_H | | #define LOGGER_H | |
| | | | |
| #include <QtCore/QDebug> | | #include <QtCore/QDebug> | |
| #include "jreen.h" | | #include "jreen.h" | |
| | | | |
| namespace Jreen | | namespace Jreen | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 4 lines changed or added | |
|
| stanza.h | | stanza.h | |
| | | | |
| skipping to change at line 61 | | skipping to change at line 61 | |
| const QString &id() const; | | const QString &id() const; | |
| void addExtension(Payload::Ptr se); | | void addExtension(Payload::Ptr se); | |
| inline void addPayload(Payload::Ptr se) | | inline void addPayload(Payload::Ptr se) | |
| { addExtension(se); } | | { addExtension(se); } | |
| inline void addExtension(Payload* se) | | inline void addExtension(Payload* se) | |
| { addExtension(Payload::Ptr(se)); } | | { addExtension(Payload::Ptr(se)); } | |
| inline void addPayload(Payload* se) | | inline void addPayload(Payload* se) | |
| { addExtension(Payload::Ptr(se)); } | | { addExtension(Payload::Ptr(se)); } | |
| PayloadList payloads() const; | | PayloadList payloads() const; | |
| template< class T > | | template< class T > | |
|
| | | QList<typename T::Ptr> payloads() const | |
| | | { | |
| | | QList<typename T::Ptr> list; | |
| | | foreach (const Payload::Ptr &payload, payloads().values(T::s | |
| | | taticPayloadType())) | |
| | | list << payload.staticCast<T>(); | |
| | | return list; | |
| | | } | |
| | | template< class T > | |
| inline const QSharedPointer<T> payload() const | | inline const QSharedPointer<T> payload() const | |
| { return qSharedPointerCast<T>(payloads().value(reinterpret_cast<T*>
(0)->staticPayloadType())); } | | { return qSharedPointerCast<T>(payloads().value(reinterpret_cast<T*>
(0)->staticPayloadType())); } | |
| template< class T > | | template< class T > | |
| inline bool containsPayload() const | | inline bool containsPayload() const | |
| { return payloads().contains(reinterpret_cast<T*>(0)->staticPayloadT
ype()); } | | { return payloads().contains(reinterpret_cast<T*>(0)->staticPayloadT
ype()); } | |
| void removePayloads(); | | void removePayloads(); | |
| Error::Ptr error() const; | | Error::Ptr error() const; | |
| protected: | | protected: | |
| Stanza(StanzaPrivate &); | | Stanza(StanzaPrivate &); | |
| Stanza &operator =(const Stanza &stanza); | | Stanza &operator =(const Stanza &stanza); | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 9 lines changed or added | |
|
| stanzaextension.h | | stanzaextension.h | |
| | | | |
| skipping to change at line 76 | | skipping to change at line 76 | |
| virtual ~AbstractPayloadFactory(); | | virtual ~AbstractPayloadFactory(); | |
| | | | |
| virtual QStringList features() const = 0; | | virtual QStringList features() const = 0; | |
| virtual int payloadType() const = 0; | | virtual int payloadType() const = 0; | |
| virtual Payload::Ptr createPayload() = 0; | | virtual Payload::Ptr createPayload() = 0; | |
| }; | | }; | |
| | | | |
| typedef QMap<int, AbstractPayloadFactory*> PayloadFactoryMap; | | typedef QMap<int, AbstractPayloadFactory*> PayloadFactoryMap; | |
| | | | |
| template <typename Extension> | | template <typename Extension> | |
|
| class PayloadFactory : public AbstractPayloadFactory | | class JREEN_AUTOTEST_EXPORT PayloadFactory : public AbstractPayloadFactory | |
| { | | { | |
| Q_DISABLE_COPY(PayloadFactory) | | Q_DISABLE_COPY(PayloadFactory) | |
| public: | | public: | |
| PayloadFactory(); | | PayloadFactory(); | |
| virtual ~PayloadFactory(); | | virtual ~PayloadFactory(); | |
| | | | |
| virtual int payloadType() const; | | virtual int payloadType() const; | |
| }; | | }; | |
| | | | |
| //template <typename T> | | //template <typename T> | |
| | | | |
| skipping to change at line 111 | | skipping to change at line 111 | |
| { | | { | |
| } | | } | |
| | | | |
| template <typename Extension> | | template <typename Extension> | |
| Q_INLINE_TEMPLATE int PayloadFactory<Extension>::payloadType() const | | Q_INLINE_TEMPLATE int PayloadFactory<Extension>::payloadType() const | |
| { | | { | |
| return Extension::staticPayloadType(); | | return Extension::staticPayloadType(); | |
| } | | } | |
| | | | |
| template <typename T> | | template <typename T> | |
|
| Q_INLINE_TEMPLATE T se_cast(Payload *se) | | Q_INLINE_TEMPLATE T payload_cast(Payload *se) | |
| { | | { | |
| if (se && reinterpret_cast<T>(0)->staticPayloadType() == se->payload
Type()) | | if (se && reinterpret_cast<T>(0)->staticPayloadType() == se->payload
Type()) | |
| return static_cast<T>(se); | | return static_cast<T>(se); | |
| return 0; | | return 0; | |
| } | | } | |
|
| | | | |
| | | template <typename T> | |
| | | Q_INLINE_TEMPLATE T se_cast(Payload *se) | |
| | | { | |
| | | return payload_cast<T>(se); | |
| | | } | |
| } | | } | |
| | | | |
| #define J_PAYLOAD(Class) \ | | #define J_PAYLOAD(Class) \ | |
| public: \ | | public: \ | |
| typedef QSharedPointer<Class> Ptr; \ | | typedef QSharedPointer<Class> Ptr; \ | |
| static int staticPayloadType() \ | | static int staticPayloadType() \ | |
| { \ | | { \ | |
| static QBasicAtomicInt payloadType = Q_BASIC_ATOMIC_
INITIALIZER(0); \ | | static QBasicAtomicInt payloadType = Q_BASIC_ATOMIC_
INITIALIZER(0); \ | |
| if (!payloadType) { \ | | if (!payloadType) { \ | |
| payloadType = Payload::registerPayloadType(
#Class ); \ | | payloadType = Payload::registerPayloadType(
#Class ); \ | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 8 lines changed or added | |
|