-void IrcUser::setChannelmode(const QString &channel, const QSet<QString> &channelmode) {
- if(channelmodes_.contains(channel))
- channelmodes_[channel] |= channelmode;
- else
- channelmodes_[channel] = channelmode;
+void IrcUser::updateHostmask(const QString &mask) {
+ if(mask == hostmask())
+ return;
+
+ QString user = userFromMask(mask);
+ QString host = hostFromMask(mask);
+
+ // we only need to check user and hostmask.
+ // nick can't have changed since we're identifying IrcUsers by nick
+
+ // we don't use setUser and setHost here.
+ // though this is unpretty code duplication this saves us one emit objectNameSet()
+ // the second one would be erroneous
+
+ if(!user.isEmpty() && _user != user) {
+ _user = user;
+ }
+
+ if(!host.isEmpty() && _host != host) {
+ _host = host;
+ }
+
+ emit hostmaskUpdated(mask);
+ updateObjectName();