/***************************************************************************
- * 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 <QDebug>
IrcUser::IrcUser(const QString &hostmask, NetworkInfo *networkinfo)
- : QObject(networkinfo),
+ : SyncableObject(networkinfo),
_initialized(false),
_nick(nickFromMask(hostmask)),
_user(userFromMask(hostmask)),
void IrcUser::setNick(const QString &nick) {
if(!nick.isEmpty() && nick != _nick) {
- QString oldnick(_nick);
_nick = nick;
updateObjectName();
emit nickSet(nick);
}
void IrcUser::updateObjectName() {
- QString oldName(objectName());
- setObjectName(QString::number(networkInfo->networkId()) + "/" + _nick);
- if(!oldName.isEmpty()) {
- emit renameObject(oldName, objectName());
+ QString newName = QString::number(networkInfo->networkId()) + "/" + _nick;
+ QString oldName = objectName();
+ if(oldName != newName) {
+ setObjectName(newName);
+ emit renameObject(oldName, newName);
}
}
-
void IrcUser::updateHostmask(const QString &mask) {
if(mask == hostmask())
return;
void IrcUser::joinChannel(IrcChannel *channel) {
Q_ASSERT(channel);
if(!_channels.contains(channel)) {
+ _channels.insert(channel);
channel->join(this);
connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed()));
- _channels.insert(channel);
emit channelJoined(channel->name());
}
}