X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircchannel.cpp;h=04ff1435d678a127854e9b6264ad4e9a14586eb5;hp=fd983608024164178ae205b64a94d8a45b0990ce;hb=c6fc5ae878a4f92b658c3da2861bcc7da9c2594f;hpb=d816b49993aa24d4d2e88975eb92a28cf329a381 diff --git a/src/common/ircchannel.cpp b/src/common/ircchannel.cpp index fd983608..04ff1435 100644 --- a/src/common/ircchannel.cpp +++ b/src/common/ircchannel.cpp @@ -43,6 +43,9 @@ IrcChannel::IrcChannel(const QString &channelname, Network *network) setObjectName(QString::number(network->networkId().toInt()) + "/" + channelname); } +IrcChannel::~IrcChannel() { +} + // ==================== // PUBLIC: // ==================== @@ -144,9 +147,8 @@ void IrcChannel::joinIrcUsers(const QList &users, const QStringList & _userModes[ircuser] = modes[i]; ircuser->joinChannel(this); - //qDebug() << "JOIN" << name() << ircuser->nick() << ircUsers().count(); connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickSet(QString))); - connect(ircuser, SIGNAL(destroyed()), this, SLOT(ircUserDestroyed())); + // 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 @@ -185,13 +187,22 @@ void IrcChannel::part(IrcUser *ircuser) { if(isKnownUser(ircuser)) { _userModes.remove(ircuser); ircuser->partChannel(this); - //qDebug() << "PART" << name() << ircuser->nick() << ircUsers().count(); // if you wonder why there is no counterpart to ircUserParted: // the joines are propagted by the ircuser. the signal ircUserParted is only for convenience disconnect(ircuser, 0, this, 0); emit ircUserParted(ircuser); - if(network->isMe(ircuser)) - deleteLater(); + + if(network->isMe(ircuser)) { + // we left -> clean up the channel and destroy it + QList users = _userModes.keys(); + _userModes.clear(); + foreach(IrcUser *user, users) { + disconnect(user, 0, this, 0); + user->partChannel(this); + } + emit parted(); + network->removeIrcChannel(this); + } } }