X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcommon%2Fircuser.h;h=652cf85aa8f6b3867d85c67a7721ca378c98d7b1;hb=6718d7a1ccd42d7aae75e57d6974e0b1e0384044;hp=9d203e58c9e6e808ab1ba2d327e2c32605b375c1;hpb=b20c8a054c9d684828e4975126adb63b498a05f8;p=quassel.git diff --git a/src/common/ircuser.h b/src/common/ircuser.h index 9d203e58..652cf85a 100644 --- a/src/common/ircuser.h +++ b/src/common/ircuser.h @@ -106,6 +106,31 @@ public : inline QDateTime lastSpokenTo(BufferId id) const { return _lastSpokenTo.value(id); } void setLastSpokenTo(BufferId id, const QDateTime &time); + /** + * Gets whether or not the away state has changed since it was last acknowledged + * + * Away state is marked as changed by any modification to away status (away/here, message) + * + * NOTE: On servers lacking support for IRCv3 away-notify, this won't update until an autoWHO- + * run for away/here changes, or until sending a message to the user for away message changes. + * + * @see IrcUser::acknowledgeAwayChanged() + * + * @return True if current away state is unchanged from last acknowledgement, otherwise false + */ + inline bool hasAwayChanged() const { return _awayChanged; } + + /** + * Sets the last away state change as acknowledged + * + * @see IrcUser::hasAwayChanged() + */ + inline void acknowledgeAwayChanged() + { + // Don't sync this as individual clients may suppress different kinds of behaviors + _awayChanged = false; + } + public slots: void setUser(const QString &user); void setHost(const QString &host); @@ -117,7 +142,7 @@ public slots: * @param[in] account Account name if logged in, * if logged out, or empty string if unknown */ void setAccount(const QString &account); - void setAway(const bool &away); + void setAway(bool away); void setAwayMessage(const QString &awayMessage); void setIdleTime(const QDateTime &idleTime); void setLoginTime(const QDateTime &loginTime); @@ -125,7 +150,7 @@ public slots: void setIrcOperator(const QString &ircOperator); // setLastAwayMessage is only called by legacy (pre-0.13) cores, which automatically gets // converted to setting the appropriate lastAwayMessageTime. Do not use this in new code. - void setLastAwayMessage(const int &lastAwayMessage); + void setLastAwayMessage(int lastAwayMessage); void setLastAwayMessageTime(const QDateTime &lastAwayMessageTime); void setWhoisServiceReply(const QString &whoisServiceReply); void setSuserHost(const QString &suserHost); @@ -191,6 +216,15 @@ private: return (_nick.toLower() == nickname.toLower()); } + /** + * Sets the last away state change as unacknowledged + * + * @see IrcUser::hasAwayChanged() + */ + inline void markAwayChanged() + { + _awayChanged = true; + } bool _initialized; @@ -222,6 +256,10 @@ private: QHash _lastActivity; QHash _lastSpokenTo; + + // Given it's never been acknowledged, assume changes exist on IrcUser creation + /// Tracks if changes in away state (away/here, message) have yet to be acknowledged + bool _awayChanged = true; };