X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=a313fc685ab110b49282c9903b15e854106b96f8;hp=91b3a2b2ea7d16ff8f341bc5699619188cff6691;hb=b797e5f581b10a517c30f78cb53f813af741e261;hpb=e008cd12ef319c4b5f9fe5a8cc1524829551771d diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index 91b3a2b2..a313fc68 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-07 by the Quassel IRC Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -29,7 +29,7 @@ #include IrcUser::IrcUser(const QString &hostmask, NetworkInfo *networkinfo) - : QObject(networkinfo), + : SyncableObject(networkinfo), _initialized(false), _nick(nickFromMask(hostmask)), _user(userFromMask(hostmask)), @@ -136,7 +136,6 @@ void IrcUser::setHost(const QString &host) { void IrcUser::setNick(const QString &nick) { if(!nick.isEmpty() && nick != _nick) { - QString oldnick(_nick); _nick = nick; updateObjectName(); emit nickSet(nick); @@ -144,14 +143,14 @@ void IrcUser::setNick(const QString &nick) { } void IrcUser::updateObjectName() { - QString oldName(objectName()); - setObjectName(QString::number(networkInfo->networkId()) + "/" + _nick); - if(!oldName.isEmpty()) { - emit renameObject(oldName, objectName()); + QString newName = QString::number(networkInfo->networkId()) + "/" + _nick; + QString oldName = objectName(); + if(oldName != newName) { + setObjectName(newName); + emit renameObject(oldName, newName); } } - void IrcUser::updateHostmask(const QString &mask) { if(mask == hostmask()) return; @@ -165,9 +164,9 @@ void IrcUser::updateHostmask(const QString &mask) { void IrcUser::joinChannel(IrcChannel *channel) { Q_ASSERT(channel); if(!_channels.contains(channel)) { + _channels.insert(channel); channel->join(this); connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed())); - _channels.insert(channel); emit channelJoined(channel->name()); } }