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);
}
}
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);
}
}
// INIT SET USER MODES
QVariantMap IrcChannel::initUserModes() const {
QVariantMap usermodes;
- QHashIterator<IrcUser *, QString> iter(_userModes);
- while(iter.hasNext()) {
- iter.next();
+ QHash<IrcUser *, QString>::const_iterator iter = _userModes.constBegin();
+ while(iter != _userModes.constEnd()) {
usermodes[iter.key()->nick()] = iter.value();
+ iter++;
}
return usermodes;
}
void IrcChannel::ircUserDestroyed() {
IrcUser *ircUser = static_cast<IrcUser *>(sender());
Q_ASSERT(ircUser);
- part(ircUser);
+ _userModes.remove(ircUser);
}
void IrcChannel::setInitialized() {