X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fidentity.h;h=6345046201f7f35f607aafa3df6340c39b83e7e7;hp=bd1eaa50bdbf00a37b3787cb9ee3009d7bb07ff6;hb=20b5edb626156df8c472df8250b5f2faaf37835e;hpb=5d05ab030c24ff57b0e5d00d9d66869c2f934a49 diff --git a/src/common/identity.h b/src/common/identity.h index bd1eaa50..63450462 100644 --- a/src/common/identity.h +++ b/src/common/identity.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -21,6 +21,7 @@ #ifndef IDENTITY_H #define IDENTITY_H +#include #include #include #include @@ -30,6 +31,7 @@ #include "syncableobject.h" class Identity : public SyncableObject { + SYNCABLE_OBJECT Q_OBJECT Q_PROPERTY(IdentityId identityId READ id WRITE setId STORED false) @@ -55,10 +57,12 @@ class Identity : public SyncableObject { public: Identity(IdentityId id = 0, QObject *parent = 0); Identity(const Identity &other, QObject *parent = 0); + inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; } + void setToDefaults(); - bool operator==(const Identity &other); - bool operator!=(const Identity &other); + bool operator==(const Identity &other) const; + bool operator!=(const Identity &other) const; inline bool isValid() const { return id().isValid(); } @@ -103,28 +107,28 @@ public slots: void setPartReason(const QString &reason); void setQuitReason(const QString &reason); - void update(const Identity &other); + void copyFrom(const Identity &other); signals: void idSet(IdentityId id); - void identityNameSet(const QString &name); - void realNameSet(const QString &realName); +// void identityNameSet(const QString &name); +// void realNameSet(const QString &realName); void nicksSet(const QStringList &nicks); - void awayNickSet(const QString &awayNick); - void awayNickEnabledSet(bool); - void awayReasonSet(const QString &awayReason); - void awayReasonEnabledSet(bool); - void autoAwayEnabledSet(bool); - void autoAwayTimeSet(int); - void autoAwayReasonSet(const QString &); - void autoAwayReasonEnabledSet(bool); - void detachAwayEnabledSet(bool); - void detachAwayReasonSet(const QString &); - void detachAwayReasonEnabledSet(bool); - void identSet(const QString &); - void kickReasonSet(const QString &); - void partReasonSet(const QString &); - void quitReasonSet(const QString &); +// void awayNickSet(const QString &awayNick); +// void awayNickEnabledSet(bool); +// void awayReasonSet(const QString &awayReason); +// void awayReasonEnabledSet(bool); +// void autoAwayEnabledSet(bool); +// void autoAwayTimeSet(int); +// void autoAwayReasonSet(const QString &); +// void autoAwayReasonEnabledSet(bool); +// void detachAwayEnabledSet(bool); +// void detachAwayReasonSet(const QString &); +// void detachAwayReasonEnabledSet(bool); +// void identSet(const QString &); +// void kickReasonSet(const QString &); +// void partReasonSet(const QString &); +// void quitReasonSet(const QString &); private: IdentityId _identityId; @@ -144,6 +148,8 @@ private: QString _ident, _kickReason, _partReason, _quitReason; void init(); + QString defaultNick(); + QString defaultRealName(); friend QDataStream &operator>>(QDataStream &in, Identity &identity); }; @@ -153,4 +159,30 @@ QDataStream &operator>>(QDataStream &in, Identity &identity); Q_DECLARE_METATYPE(Identity) -#endif +#ifdef HAVE_SSL +#include +#include + +class CertManager : public SyncableObject { + SYNCABLE_OBJECT + Q_OBJECT + Q_PROPERTY(QByteArray sslKey READ sslKeyPem WRITE setSslKey STORED false) + Q_PROPERTY(QByteArray sslCert READ sslCertPem WRITE setSslCert STORED false) + +public: + CertManager(IdentityId id, QObject *parent = 0) : SyncableObject(QString::number(id.toInt()), parent) {} + inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; } + + virtual const QSslKey &sslKey() const = 0; + inline QByteArray sslKeyPem() const { return sslKey().toPem(); } + virtual const QSslCertificate &sslCert() const = 0; + inline QByteArray sslCertPem() const { return sslCert().toPem(); } + +public slots: + inline virtual void setSslKey(const QByteArray &encoded) { SYNC(ARG(encoded)) } + inline virtual void setSslCert(const QByteArray &encoded) { SYNC(ARG(encoded)) } +}; + +#endif // HAVE_SSL + +#endif // IDENTITY_H