X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=efa7541557dc327024e8653e9be1c02a68c9631c;hp=704934b74bf9bab4fb0f523eee11bde810707d68;hb=1ed8c48b0e7d309e1a92c905a19fcb7128b73d3d;hpb=7a6e882282779ac24e015c53e3d9fc746c08063d diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index 704934b7..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)), @@ -49,7 +48,6 @@ IrcUser::IrcUser(const QString &hostmask, Network *network) } IrcUser::~IrcUser() { - //qDebug() << nick() << "destroyed."; } // ==================== @@ -146,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); } @@ -228,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) { @@ -266,6 +259,8 @@ void IrcUser::partChannel(IrcChannel *channel) { disconnect(channel, 0, this, 0); channel->part(this); emit channelParted(channel->name()); + if(_channels.isEmpty()) + deleteLater(); } } @@ -281,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); } }