/***************************************************************************
- * 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 *
#include "ircchannel.h"
-#include "networkinfo.h"
+#include "network.h"
//#include "nicktreemodel.h"
#include "signalproxy.h"
#include "ircuser.h"
#include <QDebug>
-IrcChannel::IrcChannel(const QString &channelname, NetworkInfo *networkinfo)
- : QObject(networkinfo),
+IrcChannel::IrcChannel(const QString &channelname, Network *network)
+ : SyncableObject(network),
_initialized(false),
_name(channelname),
_topic(QString()),
- networkInfo(networkinfo)
+ network(network)
{
- setObjectName(QString::number(networkInfo->networkId()) + "/" + channelname);
+ setObjectName(QString::number(network->networkId().toInt()) + "/" + channelname);
}
IrcChannel::~IrcChannel() {
return isvalid;
}
-bool IrcChannel::initialized() const {
- return _initialized;
-}
-
QString IrcChannel::name() const {
return _name;
}
}
QString IrcChannel::userModes(const QString &nick) const {
- return userModes(networkInfo->ircUser(nick));
+ return userModes(network->ircUser(nick));
}
QTextCodec *IrcChannel::codecForEncoding() const {
}
QString IrcChannel::decodeString(const QByteArray &text) const {
- if(!codecForDecoding()) return networkInfo->decodeString(text);
+ if(!codecForDecoding()) return network->decodeString(text);
return ::decodeString(text, _codecForDecoding);
}
if(codecForEncoding()) {
return _codecForEncoding->fromUnicode(string);
}
- return networkInfo->encodeString(string);
+ return network->encodeString(string);
}
// ====================
}
void IrcChannel::join(const QString &nick) {
- join(networkInfo->ircUser(nick));
+ join(network->ircUser(nick));
}
void IrcChannel::part(IrcUser *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);
+ if(network->isMe(ircuser))
+ deleteLater();
}
}
void IrcChannel::part(const QString &nick) {
- part(networkInfo->ircUser(nick));
+ part(network->ircUser(nick));
}
// SET USER MODE
}
void IrcChannel::setUserModes(const QString &nick, const QString &modes) {
- setUserModes(networkInfo->ircUser(nick), modes);
+ setUserModes(network->ircUser(nick), modes);
}
// ADD USER MODE
}
void IrcChannel::addUserMode(const QString &nick, const QString &mode) {
- addUserMode(networkInfo->ircUser(nick), mode);
+ addUserMode(network->ircUser(nick), mode);
}
// REMOVE USER MODE
}
void IrcChannel::removeUserMode(const QString &nick, const QString &mode) {
- removeUserMode(networkInfo->ircUser(nick), mode);
+ removeUserMode(network->ircUser(nick), mode);
}
// INIT SET USER MODES
emit ircUserNickSet(ircUser, nick);
}
-void IrcChannel::setInitialized() {
- _initialized = true;
- emit initDone();
-}
-