X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=b793d683c88885853b2e9eafa664e6d0b1d3c76f;hp=32ff7944e0f9c0d56b7c8c8b7a7296d0242d0558;hb=68878dc8366f2f4a0afe132847aad9a51a80cdbf;hpb=b49c64970b6237fc95f8ca88c8bb6bcf04c251d7 diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index 32ff7944..b793d683 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -146,6 +146,15 @@ void IrcUser::setRealName(const QString &realName) } +void IrcUser::setAccount(const QString &account) +{ + if (_account != account) { + _account = account; + SYNC(ARG(account)) + } +} + + void IrcUser::setAway(const bool &away) { if (away != _away) { @@ -346,9 +355,11 @@ void IrcUser::channelDestroyed() void IrcUser::setUserModes(const QString &modes) { - _userModes = modes; - SYNC(ARG(modes)) - emit userModesSet(modes); + if (_userModes != modes) { + _userModes = modes; + SYNC(ARG(modes)) + emit userModesSet(modes); + } } @@ -357,13 +368,19 @@ void IrcUser::addUserModes(const QString &modes) if (modes.isEmpty()) return; + // Don't needlessly sync when no changes are made + bool changesMade = false; for (int i = 0; i < modes.count(); i++) { - if (!_userModes.contains(modes[i])) + if (!_userModes.contains(modes[i])) { _userModes += modes[i]; + changesMade = true; + } } - SYNC(ARG(modes)) - emit userModesAdded(modes); + if (changesMade) { + SYNC(ARG(modes)) + emit userModesAdded(modes); + } }