X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=fa2069899a1c6344531c73352d4abfbbd8cff73f;hp=22df0c942745d35830434ddd2f52c51802b15e67;hb=e89cfe68c0b4d117ce79d0d38fcc085de77a3083;hpb=83e369bbb28a21f21dc939cce93189f98ca8502b diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index 22df0c94..fa206989 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * 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 * @@ -171,6 +171,7 @@ void IrcUser::setLastAwayMessage(const int &lastAwayMessage) { } void IrcUser::setHost(const QString &host) { + so_sync(so_arg_cast(host)); if(!host.isEmpty() && _host != host) { _host = host; emit hostSet(host); @@ -218,7 +219,6 @@ void IrcUser::joinChannel(IrcChannel *channel) { if(!_channels.contains(channel)) { _channels.insert(channel); channel->joinIrcUsers(this); - connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed())); } } @@ -233,7 +233,7 @@ void IrcUser::partChannel(IrcChannel *channel) { channel->part(this); emit channelParted(channel->name()); if(_channels.isEmpty() && !network()->isMe(this)) - deleteLater(); + quit(); } } @@ -246,13 +246,24 @@ void IrcUser::partChannel(const QString &channelname) { } } +void IrcUser::quit() { + QList 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(sender()); if(_channels.contains(channel)) { _channels.remove(channel); - if(_channels.isEmpty()) - deleteLater(); + if(_channels.isEmpty() && !network()->isMe(this)) + quit(); } } @@ -282,3 +293,13 @@ void IrcUser::removeUserModes(const QString &modes) { } emit userModesRemoved(modes); } + +void IrcUser::setLastChannelActivity(BufferId buffer, const QDateTime &time) { + _lastActivity[buffer] = time; + emit lastChannelActivityUpdated(buffer, time); +} + +void IrcUser::setLastSpokenTo(BufferId buffer, const QDateTime &time) { + _lastSpokenTo[buffer] = time; + emit lastSpokenToUpdated(buffer, time); +}