client.h | client.h | |||
---|---|---|---|---|
skipping to change at line 52 | skipping to change at line 52 | |||
class ClientPrivate; | class ClientPrivate; | |||
class JID; | class JID; | |||
class Message; | class Message; | |||
class IQ; | class IQ; | |||
class IQReply; | class IQReply; | |||
class Connection; | class Connection; | |||
class StreamFeature; | class StreamFeature; | |||
class Disco; | class Disco; | |||
class MessageSessionManager; | class MessageSessionManager; | |||
class AbstractRoster; | class AbstractRoster; | |||
class JingleManager; | ||||
class XmlStreamHandler | class XmlStreamHandler | |||
{ | { | |||
public: | public: | |||
virtual ~XmlStreamHandler() {} | virtual ~XmlStreamHandler() {} | |||
virtual void handleStreamBegin() = 0; | virtual void handleStreamBegin() = 0; | |||
virtual void handleStreamEnd() = 0; | virtual void handleStreamEnd() = 0; | |||
virtual void handleIncomingData(const char *data, qint64 size) = 0; | virtual void handleIncomingData(const char *data, qint64 size) = 0; | |||
virtual void handleOutgoingData(const char *data, qint64 size) = 0; | virtual void handleOutgoingData(const char *data, qint64 size) = 0; | |||
skipping to change at line 131 | skipping to change at line 132 | |||
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(); | |||
Presence &presence(); | Presence &presence(); | |||
Disco *disco(); | Disco *disco(); | |||
MessageSessionManager *messageSessionManager(); | MessageSessionManager *messageSessionManager(); | |||
AbstractRoster *roster(); | AbstractRoster *roster(); | |||
JingleManager *jingleManager(); | ||||
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 *streamFeature); | void registerStreamFeature(StreamFeature *streamFeature); | |||
void removeStreamFeature(StreamFeature *streamFeature); | void removeStreamFeature(StreamFeature *streamFeature); | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added | |||
message.h | message.h | |||
---|---|---|---|---|
skipping to change at line 54 | skipping to change at line 54 | |||
*/ | */ | |||
enum Type | enum Type | |||
{ | { | |||
Chat = 0, /**< A chat message. */ | Chat = 0, /**< A chat message. */ | |||
Error, /**< An error message. */ | Error, /**< An error message. */ | |||
Groupchat, /**< A groupchat message. */ | Groupchat, /**< A groupchat message. */ | |||
Headline, /**< A headline message. */ | Headline, /**< A headline message. */ | |||
Normal, /**< A normal message. */ | Normal, /**< A normal message. */ | |||
Invalid /**< The message stanza is invalid. */ | Invalid /**< The message stanza is invalid. */ | |||
}; | }; | |||
Message(Type type = Invalid); | ||||
Message(Type type, const JID& to, const QString &body = QString(), c onst QString &subject = QString(), | Message(Type type, const JID& to, const QString &body = QString(), c onst QString &subject = QString(), | |||
const QString &thread = QString(), const QString &xm llang = QString()); | const QString &thread = QString(), const QString &xm llang = QString()); | |||
Message(MessagePrivate &p); | Message(MessagePrivate &p); | |||
inline Message &operator =(const Message &stanza) | inline Message &operator =(const Message &stanza) | |||
{ return *static_cast<Message *>(&Jreen::Stanza::operator =(stanza)) ; } | { return *static_cast<Message *>(&Jreen::Stanza::operator =(stanza)) ; } | |||
Type subtype() const; | Type subtype() const; | |||
QString body(const QString &lang = QString()) const; | QString body(const QString &lang = QString()) const; | |||
void setBody(const QString &text, const QString &lang = QString()); | void setBody(const QString &text, const QString &lang = QString()); | |||
QString subject(const QString &lang = QString()) const; | QString subject(const QString &lang = QString()) const; | |||
void setSubject(const QString &text, const QString &lang = QString() ); | void setSubject(const QString &text, const QString &lang = QString() ); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
messagesession.h | messagesession.h | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
#include <QVector> | #include <QVector> | |||
#include <QMap> | #include <QMap> | |||
namespace Jreen | namespace Jreen | |||
{ | { | |||
class MessageSession; | class MessageSession; | |||
class MessageSessionManager; | class MessageSessionManager; | |||
class Client; | class Client; | |||
#define J_MESSAGE_FILTER \ | #define J_MESSAGE_FILTER(Class) \ | |||
public: \ | public: \ | |||
static const Jreen::MessageFilterMeta &meta() \ | typedef QSharedPointer<Class> Ptr; \ | |||
static int staticFilterType() \ | ||||
{ \ | { \ | |||
static Jreen::MessageFilterMeta staticFilterMeta; \ | static QBasicAtomicInt filterType = Q_BASIC_ATOMIC_I | |||
return staticFilterMeta; \ | NITIALIZER(0); \ | |||
if (!filterType) { \ | ||||
filterType = Jreen::Payload::registerPayload | ||||
Type( #Class ); \ | ||||
Class *useFullNameWithNamespaces = reinterpr | ||||
et_cast< ::Class* >(0); \ | ||||
Q_UNUSED(useFullNameWithNamespaces); \ | ||||
} \ | ||||
return filterType; \ | ||||
} \ | ||||
virtual int filterType() const \ | ||||
{ \ | ||||
Q_UNUSED(static_cast<const ::Class*>(this)); \ | ||||
return staticFilterType(); \ | ||||
} \ | } \ | |||
virtual int filterType() const { return meta().type; } \ | ||||
private: | private: | |||
struct MessageFilterMeta | struct MessageFilterMeta | |||
{ | { | |||
MessageFilterMeta(); | MessageFilterMeta(); | |||
const int type; | const int type; | |||
}; | }; | |||
class JREEN_EXPORT MessageFilter | class JREEN_EXPORT MessageFilter | |||
{ | { | |||
End of changes. 3 change blocks. | ||||
6 lines changed or deleted | 19 lines changed or added | |||
stanza.h | stanza.h | |||
---|---|---|---|---|
skipping to change at line 70 | skipping to change at line 70 | |||
template< class T > | template< class T > | |||
QList<typename T::Ptr> payloads() const | QList<typename T::Ptr> payloads() const | |||
{ | { | |||
QList<typename T::Ptr> list; | QList<typename T::Ptr> list; | |||
foreach (const Payload::Ptr &payload, payloads().values(T::s taticPayloadType())) | foreach (const Payload::Ptr &payload, payloads().values(T::s taticPayloadType())) | |||
list << payload.staticCast<T>(); | list << payload.staticCast<T>(); | |||
return list; | return list; | |||
} | } | |||
template< class T > | 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(T::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(T::staticPayloadType()); } | |||
void removePayloads(); | void removePayloads(); | |||
template< class T > | ||||
inline void removePayload() { removePayload(T::staticPayloadType()); | ||||
} | ||||
void removePayload(int id); | ||||
Error::Ptr error() const; | Error::Ptr error() const; | |||
protected: | protected: | |||
Stanza(StanzaPrivate &); | Stanza(StanzaPrivate &); | |||
Stanza &operator =(const Stanza &stanza); | Stanza &operator =(const Stanza &stanza); | |||
StanzaPrivate *d_ptr; | StanzaPrivate *d_ptr; | |||
}; | }; | |||
} | } | |||
#endif // STANZA_H | #endif // STANZA_H | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 6 lines changed or added | |||
stanzaextension.h | stanzaextension.h | |||
---|---|---|---|---|
skipping to change at line 55 | skipping to change at line 55 | |||
class JREEN_EXPORT Payload | class JREEN_EXPORT Payload | |||
{ | { | |||
Q_DISABLE_COPY(Payload) | Q_DISABLE_COPY(Payload) | |||
public: | public: | |||
typedef QSharedPointer<Payload> Ptr; | typedef QSharedPointer<Payload> Ptr; | |||
Payload(); | Payload(); | |||
virtual ~Payload(); | virtual ~Payload(); | |||
static int registerPayloadType(const char *type); | static int registerPayloadType(const char *type); | |||
static const char *payloadName(int type); | ||||
virtual int payloadType() const = 0; | virtual int payloadType() const = 0; | |||
const char *payloadName() const; | ||||
}; | }; | |||
typedef QMultiMap<int, Payload::Ptr> PayloadList; | typedef QMultiMap<int, Payload::Ptr> PayloadList; | |||
class JREEN_EXPORT AbstractPayloadFactory : public XmlStreamFactory<Payload > | class JREEN_EXPORT AbstractPayloadFactory : public XmlStreamFactory<Payload > | |||
{ | { | |||
Q_DISABLE_COPY(AbstractPayloadFactory) | Q_DISABLE_COPY(AbstractPayloadFactory) | |||
public: | public: | |||
AbstractPayloadFactory(); | AbstractPayloadFactory(); | |||
virtual ~AbstractPayloadFactory(); | virtual ~AbstractPayloadFactory(); | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added | |||
util.h | util.h | |||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
{ | { | |||
class JID; | class JID; | |||
namespace Util | namespace Util | |||
{ | { | |||
JREEN_EXPORT QDateTime fromStamp(const QString &stamp); | JREEN_EXPORT QDateTime fromStamp(const QString &stamp); | |||
JREEN_EXPORT QString toStamp(const QDate &date); | JREEN_EXPORT QString toStamp(const QDate &date); | |||
JREEN_EXPORT QString toStamp(const QDateTime &date_time); | JREEN_EXPORT QString toStamp(const QDateTime &date_time); | |||
JREEN_EXPORT QByteArray randomHash(); | JREEN_EXPORT QByteArray randomHash(); | |||
JREEN_EXPORT QString randomStringHash(int len); | ||||
inline int log2(register uint n) | inline int log2(register uint n) | |||
{ | { | |||
register int pos = 0; | register int pos = 0; | |||
while(n > 1) { ++pos; n >>= 1; } | while(n > 1) { ++pos; n >>= 1; } | |||
return (n == 0) ? (-1) : pos; | return (n == 0) ? (-1) : pos; | |||
} | } | |||
inline void writeAttribute(QXmlStreamWriter *writer, | inline void writeAttribute(QXmlStreamWriter *writer, | |||
const QLatin1String &name ,const QString &value) | const QLatin1String &name ,const QString &value) | |||
{ | { | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added | |||