X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=4c12580d5f3b4702b79670042cc0daf913188e6e;hp=223a02f5c40943f4f3ea463c071210c2acb53aff;hb=56607f81246f04db3a0e71c9a8757d7f75d6cfcf;hpb=0268b7f62826dc48155866f7f27b2987449a29f5 diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index 223a02f5..4c12580d 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)), @@ -145,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); } @@ -227,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) { @@ -249,9 +243,8 @@ void IrcUser::joinChannel(IrcChannel *channel) { Q_ASSERT(channel); if(!_channels.contains(channel)) { _channels.insert(channel); - channel->join(this); + channel->joinIrcUsers(this); connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed())); - emit channelJoined(channel->name()); } } @@ -265,6 +258,8 @@ void IrcUser::partChannel(IrcChannel *channel) { disconnect(channel, 0, this, 0); channel->part(this); emit channelParted(channel->name()); + if(_channels.isEmpty() && network()->isMe(this)) + deleteLater(); } } @@ -282,6 +277,8 @@ void IrcUser::channelDestroyed() { IrcChannel *channel = static_cast(sender()); if(_channels.contains(channel)) { _channels.remove(channel); + if(_channels.isEmpty()) + deleteLater(); } }