-void IrcUser::joinChannel(IrcChannel *channel) {
- Q_ASSERT(channel);
- if(!_channels.contains(channel)) {
- _channels.insert(channel);
- channel->joinIrcUsers(this);
- connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed()));
- }
+
+void IrcUser::partChannel(IrcChannel *channel)
+{
+ if (_channels.contains(channel)) {
+ _channels.remove(channel);
+ disconnect(channel, 0, this, 0);
+ channel->part(this);
+ QString channelName = channel->name();
+ SYNC_OTHER(partChannel, ARG(channelName))
+ if (_channels.isEmpty() && !network()->isMe(this))
+ quit();
+ }