- for(int i = 0; i < modes.count(); i++) {
- if(!_userModes.contains(modes[i]))
- _userModes += modes[i];
- }
+void IrcUser::quit()
+{
+ QList<IrcChannel *> channels = _channels.toList();
+ _channels.clear();
+ foreach(IrcChannel *channel, channels) {
+ disconnect(channel, nullptr, this, nullptr);
+ channel->part(this);
+ }
+ network()->removeIrcUser(this);
+ SYNC(NO_ARG)
+ emit quited();
+}
+
+
+void IrcUser::channelDestroyed()
+{
+ // private slot!
+ auto *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)
+{
+ if (_userModes != modes) {
+ _userModes = modes;
+ SYNC(ARG(modes))
+ emit userModesSet(modes);
+ }
+}