/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel Project *
+ * Copyright (C) 2005-09 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
if(!_channels.contains(channel)) {
_channels.insert(channel);
channel->joinIrcUsers(this);
- connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed()));
}
}
channel->part(this);
emit channelParted(channel->name());
if(_channels.isEmpty() && !network()->isMe(this))
- deleteLater();
+ quit();
}
}
}
}
+void IrcUser::quit() {
+ QList<IrcChannel *> channels = _channels.toList();
+ _channels.clear();
+ foreach(IrcChannel *channel, channels) {
+ disconnect(channel, 0, this, 0);
+ channel->part(this);
+ }
+ network()->removeIrcUser(this);
+ emit quited();
+}
+
void IrcUser::channelDestroyed() {
// private slot!
IrcChannel *channel = static_cast<IrcChannel*>(sender());
if(_channels.contains(channel)) {
_channels.remove(channel);
- if(_channels.isEmpty())
- deleteLater();
+ if(_channels.isEmpty() && !network()->isMe(this))
+ quit();
}
}