X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=efa7541557dc327024e8653e9be1c02a68c9631c;hp=e8ccc370b09f27977a08c11bd6354416f127b240;hb=1ed8c48b0e7d309e1a92c905a19fcb7128b73d3d;hpb=2d19986a8bafafec55b5d3b0474f7d76eb5f33b2 diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index e8ccc370..efa75415 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -28,8 +28,7 @@ #include #include -IrcUser::IrcUser(const QString &hostmask, Network *network) - : SyncableObject(network), +IrcUser::IrcUser(const QString &hostmask, Network *network) : SyncableObject(network), _initialized(false), _nick(nickFromMask(hostmask)), _user(userFromMask(hostmask)), @@ -40,6 +39,7 @@ IrcUser::IrcUser(const QString &hostmask, Network *network) _server(), _idleTime(QDateTime::currentDateTime()), _ircOperator(), + _lastAwayMessage(0), _network(network), _codecForEncoding(0), _codecForDecoding(0) @@ -48,7 +48,6 @@ IrcUser::IrcUser(const QString &hostmask, Network *network) } IrcUser::~IrcUser() { - //qDebug() << nick() << "destroyed."; } // ==================== @@ -95,6 +94,10 @@ QString IrcUser::ircOperator() const { return _ircOperator; } +int IrcUser::lastAwayMessage() const { + return _lastAwayMessage; +} + QString IrcUser::userModes() const { return _userModes; } @@ -141,7 +144,7 @@ QString IrcUser::decodeString(const QByteArray &text) const { return ::decodeString(text, codecForDecoding()); } -QByteArray IrcUser::encodeString(const QString string) const { +QByteArray IrcUser::encodeString(const QString &string) const { if(codecForEncoding()) { return codecForEncoding()->fromUnicode(string); } @@ -200,6 +203,13 @@ void IrcUser::setIrcOperator(const QString &ircOperator) { } } +void IrcUser::setLastAwayMessage(const int &lastAwayMessage) { + if(lastAwayMessage > _lastAwayMessage) { + _lastAwayMessage = lastAwayMessage; + emit lastAwayMessageSet(lastAwayMessage); + } +} + void IrcUser::setHost(const QString &host) { if(!host.isEmpty() && _host != host) { _host = host; @@ -216,12 +226,7 @@ void IrcUser::setNick(const QString &nick) { } void IrcUser::updateObjectName() { - QString newName = QString::number(network()->networkId().toInt()) + "/" + _nick; - QString oldName = objectName(); - if(oldName != newName) { - setObjectName(newName); - emit renameObject(oldName, newName); - } + renameObject(QString::number(network()->networkId().toInt()) + "/" + _nick); } void IrcUser::updateHostmask(const QString &mask) { @@ -254,6 +259,8 @@ void IrcUser::partChannel(IrcChannel *channel) { disconnect(channel, 0, this, 0); channel->part(this); emit channelParted(channel->name()); + if(_channels.isEmpty()) + deleteLater(); } } @@ -269,10 +276,8 @@ void IrcUser::partChannel(const QString &channelname) { void IrcUser::channelDestroyed() { // private slot! IrcChannel *channel = static_cast(sender()); - Q_ASSERT(channel); if(_channels.contains(channel)) { _channels.remove(channel); - disconnect(channel, 0, this, 0); } }