X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fidentity.cpp;h=eff50215611f2f3df17cc68f5cedf75f8226d19a;hp=7d19204efc1c152e68f94aea8663dba85627bf96;hb=5d05ab030c24ff57b0e5d00d9d66869c2f934a49;hpb=cedc301cd2f6dc644ddbf9fc9ae4fe605be2e9da diff --git a/src/common/identity.cpp b/src/common/identity.cpp index 7d19204e..eff50215 100644 --- a/src/common/identity.cpp +++ b/src/common/identity.cpp @@ -23,38 +23,42 @@ #include "identity.h" -Identity::Identity(IdentityId id, QObject *parent) : SyncableObject(parent), _identityId(id) { +Identity::Identity(IdentityId id, QObject *parent) + : SyncableObject(parent), + _identityId(id) +{ init(); setToDefaults(); } -Identity::Identity(const Identity &other, QObject *parent) : SyncableObject(parent), - _identityId(other.id()), - _identityName(other.identityName()), - _realName(other.realName()), - _nicks(other.nicks()), - _awayNick(other.awayNick()), - _awayNickEnabled(other.awayNickEnabled()), - _awayReason(other.awayReason()), - _awayReasonEnabled(other.awayReasonEnabled()), - _autoAwayEnabled(other.autoAwayEnabled()), - _autoAwayTime(other.autoAwayTime()), - _autoAwayReason(other.autoAwayReason()), - _autoAwayReasonEnabled(other.autoAwayReasonEnabled()), - _detachAwayEnabled(other.detachAwayEnabled()), - _detachAwayReason(other.detachAwayReason()), - _detachAwayReasonEnabled(other.detachAwayReasonEnabled()), - _ident(other.ident()), - _kickReason(other.kickReason()), - _partReason(other.partReason()), - _quitReason(other.quitReason()) - +Identity::Identity(const Identity &other, QObject *parent) + : SyncableObject(parent), + _identityId(other.id()), + _identityName(other.identityName()), + _realName(other.realName()), + _nicks(other.nicks()), + _awayNick(other.awayNick()), + _awayNickEnabled(other.awayNickEnabled()), + _awayReason(other.awayReason()), + _awayReasonEnabled(other.awayReasonEnabled()), + _autoAwayEnabled(other.autoAwayEnabled()), + _autoAwayTime(other.autoAwayTime()), + _autoAwayReason(other.autoAwayReason()), + _autoAwayReasonEnabled(other.autoAwayReasonEnabled()), + _detachAwayEnabled(other.detachAwayEnabled()), + _detachAwayReason(other.detachAwayReason()), + _detachAwayReasonEnabled(other.detachAwayReasonEnabled()), + _ident(other.ident()), + _kickReason(other.kickReason()), + _partReason(other.partReason()), + _quitReason(other.quitReason()) { init(); } void Identity::init() { setObjectName(QString::number(id().toInt())); + setAllowClientUpdates(true); } void Identity::setToDefaults() { @@ -80,92 +84,12 @@ void Identity::setToDefaults() { setQuitReason(tr("http://quassel-irc.org - Chat comfortably. Anywhere.")); } -bool Identity::isValid() const { - return (id().toInt() > 0); -} - -IdentityId Identity::id() const { - return _identityId; -} - -QString Identity::identityName() const { - return _identityName; -} - -QString Identity::realName() const { - return _realName; -} - -QStringList Identity::nicks() const { - return _nicks; -} - -QString Identity::awayNick() const { - return _awayNick; -} - -bool Identity::awayNickEnabled() const { - return _awayNickEnabled; -} - -QString Identity::awayReason() const { - return _awayReason; -} - -bool Identity::awayReasonEnabled() const { - return _awayReasonEnabled; -} - -bool Identity::autoAwayEnabled() const { - return _autoAwayEnabled; -} - -int Identity::autoAwayTime() const { - return _autoAwayTime; -} - -QString Identity::autoAwayReason() const { - return _autoAwayReason; -} - -bool Identity::autoAwayReasonEnabled() const { - return _autoAwayReasonEnabled; -} - -bool Identity::detachAwayEnabled() const { - return _detachAwayEnabled; -} - -QString Identity::detachAwayReason() const { - return _detachAwayReason; -} - -bool Identity::detachAwayReasonEnabled() const { - return _detachAwayReasonEnabled; -} - -QString Identity::ident() const { - return _ident; -} - -QString Identity::kickReason() const { - return _kickReason; -} - -QString Identity::partReason() const -{return _partReason;} - -QString Identity::quitReason() const { - return _quitReason; -} - /*** setters ***/ // NOTE: DO NOT USE ON SYNCHRONIZED OBJECTS! void Identity::setId(IdentityId _id) { _identityId = _id; setObjectName(QString::number(id().toInt())); - //emit idSet(id); } void Identity::setIdentityName(const QString &identityName) { @@ -213,7 +137,7 @@ void Identity::setAutoAwayTime(int time) { emit autoAwayTimeSet(time); } -void Identity::setAutoAwayReason(const QString & reason) { +void Identity::setAutoAwayReason(const QString &reason) { _autoAwayReason = reason; emit autoAwayReasonSet(reason); } @@ -228,7 +152,7 @@ void Identity::setDetachAwayEnabled(bool enabled) { emit detachAwayEnabledSet(enabled); } -void Identity::setDetachAwayReason(const QString & reason) { +void Identity::setDetachAwayReason(const QString &reason) { _detachAwayReason = reason; emit detachAwayReasonSet(reason); } @@ -238,22 +162,22 @@ void Identity::setDetachAwayReasonEnabled(bool enabled) { emit detachAwayReasonEnabledSet(enabled); } -void Identity::setIdent(const QString & ident) { +void Identity::setIdent(const QString &ident) { _ident = ident; emit identSet(ident); } -void Identity::setKickReason(const QString & reason) { +void Identity::setKickReason(const QString &reason) { _kickReason = reason; emit kickReasonSet(reason); } -void Identity::setPartReason(const QString & reason) { +void Identity::setPartReason(const QString &reason) { _partReason = reason; emit partReasonSet(reason); } -void Identity::setQuitReason(const QString & reason) { +void Identity::setQuitReason(const QString &reason) { _quitReason = reason; emit quitReasonSet(reason); } @@ -269,7 +193,7 @@ for(int idx = metaObject()->propertyOffset(); idx < metaObject()->propertyCount( } } } -#include + bool Identity::operator==(const Identity &other) { for(int idx = metaObject()->propertyOffset(); idx < metaObject()->propertyCount(); idx++) { QMetaProperty metaProp = metaObject()->property(idx);