+
+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);
+ SYNC(NO_ARG)
+ emit quited();
+}
+
+
+void IrcUser::channelDestroyed()
+{
+ // private slot!
+ IrcChannel *channel = static_cast<IrcChannel *>(sender());
+ if (_channels.contains(channel)) {
+ _channels.remove(channel);
+ if (_channels.isEmpty() && !network()->isMe(this))
+ quit();
+ }
+}
+
+
+void IrcUser::setUserModes(const QString &modes)
+{
+ _userModes = modes;
+ SYNC(ARG(modes))
+ emit userModesSet(modes);
+}
+
+
+void IrcUser::addUserModes(const QString &modes)
+{
+ if (modes.isEmpty())
+ return;
+
+ for (int i = 0; i < modes.count(); i++) {
+ if (!_userModes.contains(modes[i]))
+ _userModes += modes[i];
+ }
+
+ SYNC(ARG(modes))
+ emit userModesAdded(modes);
+}
+
+
+void IrcUser::removeUserModes(const QString &modes)
+{
+ if (modes.isEmpty())
+ return;
+
+ for (int i = 0; i < modes.count(); i++) {
+ _userModes.remove(modes[i]);
+ }
+ SYNC(ARG(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);
+}