X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fircchannel.cpp;h=28d6c6ed46f9d0294607f4d068dc23fc71efc4b8;hb=924e2c01204da172a071d34485936b379372e497;hp=95d0ed11d208370c3d35327acd14bc5f84a92697;hpb=902c95728306e5ba115de84800fc8d5d239c9d62;p=quassel.git diff --git a/src/common/ircchannel.cpp b/src/common/ircchannel.cpp index 95d0ed11..28d6c6ed 100644 --- a/src/common/ircchannel.cpp +++ b/src/common/ircchannel.cpp @@ -107,7 +107,10 @@ void IrcChannel::join(IrcUser *ircuser) { if(!_userModes.contains(ircuser) && ircuser) { _userModes[ircuser] = QString(); ircuser->joinChannel(name()); - // no emit here since the join is propagated by IrcUser + connect(ircuser, SIGNAL(destroyed()), this, SLOT(ircUserDestroyed())); + // if you wonder why there is no counterpart to ircUserJoined: + // the joines are propagted by the ircuser. the signal ircUserJoined is only for convenience + emit ircUserJoined(ircuser); } } @@ -119,7 +122,9 @@ void IrcChannel::part(IrcUser *ircuser) { if(isKnownUser(ircuser)) { _userModes.remove(ircuser); ircuser->partChannel(name()); - // no emit here since the part is propagated by IrcUser + // if you wonder why there is no counterpart to ircUserParted: + // the joines are propagted by the ircuser. the signal ircUserParted is only for convenience + emit ircUserParted(ircuser); } } @@ -175,10 +180,10 @@ void IrcChannel::removeUserMode(const QString &nick, const QString &mode) { // INIT SET USER MODES QVariantMap IrcChannel::initUserModes() const { QVariantMap usermodes; - QHashIterator iter(_userModes); - while(iter.hasNext()) { - iter.next(); + QHash::const_iterator iter = _userModes.constBegin(); + while(iter != _userModes.constEnd()) { usermodes[iter.key()->nick()] = iter.value(); + iter++; } return usermodes; } @@ -192,7 +197,9 @@ void IrcChannel::initSetUserModes(const QVariantMap &usermodes) { } void IrcChannel::ircUserDestroyed() { - part(qobject_cast(sender())); + IrcUser *ircUser = static_cast(sender()); + Q_ASSERT(ircUser); + _userModes.remove(ircUser); } void IrcChannel::setInitialized() {