#include <QDebug>
-IrcChannel::IrcChannel(const QString &channelname, Network *network)
- : SyncableObject(network),
+IrcChannel::IrcChannel(const QString &channelname, Network *network) : SyncableObject(network),
_initialized(false),
_name(channelname),
_topic(QString()),
- network(network)
+ network(network),
+ _codecForEncoding(0),
+ _codecForDecoding(0)
{
setObjectName(QString::number(network->networkId().toInt()) + "/" + channelname);
}
IrcChannel::~IrcChannel() {
-
}
// ====================
return ::decodeString(text, _codecForDecoding);
}
-QByteArray IrcChannel::encodeString(const QString string) const {
+QByteArray IrcChannel::encodeString(const QString &string) const {
if(codecForEncoding()) {
return _codecForEncoding->fromUnicode(string);
}
void IrcChannel::join(IrcUser *ircuser) {
if(!_userModes.contains(ircuser) && ircuser) {
_userModes[ircuser] = QString();
- ircuser->joinChannel(name());
+ 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()));
void IrcChannel::part(IrcUser *ircuser) {
if(isKnownUser(ircuser)) {
_userModes.remove(ircuser);
- ircuser->partChannel(name());
+ 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();
IrcUser *ircUser = static_cast<IrcUser *>(sender());
Q_ASSERT(ircUser);
_userModes.remove(ircUser);
- emit ircUserParted(ircUser);
- //qDebug() << "DEST" << name() << ircUsers().count();
+ // no further propagation.
+ // this leads only to fuck ups.
}
void IrcChannel::ircUserNickSet(QString nick) {