X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=5f05f0f42a708e9608d0fa4253690853065d3c62;hb=0d53027b95e4bd9ca369bd909c17cf13612f7dd5;hp=affd64b749ad47f4a32ee2e969be227e4ccc06c5;hpb=dcc90a564e00e206f05db224f1654c8907f149f4;p=quassel.git diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index affd64b7..5f05f0f4 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * 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 * @@ -21,20 +21,20 @@ #include "ircuser.h" #include "util.h" -#include "networkinfo.h" +#include "network.h" #include "signalproxy.h" #include "ircchannel.h" #include #include -IrcUser::IrcUser(const QString &hostmask, NetworkInfo *networkinfo) - : QObject(networkinfo), +IrcUser::IrcUser(const QString &hostmask, Network *network) + : SyncableObject(network), _initialized(false), _nick(nickFromMask(hostmask)), _user(userFromMask(hostmask)), _host(hostFromMask(hostmask)), - networkInfo(networkinfo), + _network(network), _codecForEncoding(0), _codecForDecoding(0) { @@ -48,9 +48,6 @@ IrcUser::~IrcUser() { // ==================== // PUBLIC: // ==================== -bool IrcUser::initialized() const { - return _initialized; -} QString IrcUser::user() const { return _user; @@ -81,6 +78,10 @@ QStringList IrcUser::channels() const { return chanList; } +Network* IrcUser::network() const { + return _network; +} + QTextCodec *IrcUser::codecForEncoding() const { return _codecForEncoding; } @@ -106,7 +107,7 @@ void IrcUser::setCodecForDecoding(QTextCodec *codec) { } QString IrcUser::decodeString(const QByteArray &text) const { - if(!codecForDecoding()) return networkInfo->decodeString(text); + if(!codecForDecoding()) return network()->decodeString(text); return ::decodeString(text, codecForDecoding()); } @@ -114,7 +115,7 @@ QByteArray IrcUser::encodeString(const QString string) const { if(codecForEncoding()) { return codecForEncoding()->fromUnicode(string); } - return networkInfo->encodeString(string); + return network()->encodeString(string); } // ==================== @@ -143,7 +144,7 @@ void IrcUser::setNick(const QString &nick) { } void IrcUser::updateObjectName() { - QString newName = QString::number(networkInfo->networkId()) + "/" + _nick; + QString newName = QString::number(network()->networkId().toInt()) + "/" + _nick; QString oldName = objectName(); if(oldName != newName) { setObjectName(newName); @@ -172,7 +173,7 @@ void IrcUser::joinChannel(IrcChannel *channel) { } void IrcUser::joinChannel(const QString &channelname) { - joinChannel(networkInfo->newIrcChannel(channelname)); + joinChannel(network()->newIrcChannel(channelname)); } void IrcUser::partChannel(IrcChannel *channel) { @@ -185,7 +186,7 @@ void IrcUser::partChannel(IrcChannel *channel) { } void IrcUser::partChannel(const QString &channelname) { - IrcChannel *channel = networkInfo->ircChannel(channelname); + IrcChannel *channel = network()->ircChannel(channelname); if(channel == 0) { qWarning() << "IrcUser::partChannel(): received part for unknown Channel" << channelname; } else { @@ -228,8 +229,3 @@ void IrcUser::initSetChannels(const QStringList channels) { } } -void IrcUser::setInitialized() { - _initialized = true; - emit initDone(); -} -