From ca0083cba90c8830f5018b73eb715665a8db9dd7 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Tue, 9 Apr 2013 19:12:09 +0200 Subject: Replace IS_AWAY() and IS_OPER() macros with User::IsAway() and User::IsOper() --- include/users.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/users.h b/include/users.h index 2cebc749d..4d3013ae8 100644 --- a/include/users.h +++ b/include/users.h @@ -329,7 +329,7 @@ class CoreExport User : public Extensible std::string awaymsg; /** Time the user last went away. - * This is ONLY RELIABLE if user IS_AWAY()! + * This is ONLY RELIABLE if user IsAway()! */ time_t awaytime; @@ -411,6 +411,18 @@ class CoreExport User : public Extensible */ std::string ProcessNoticeMasks(const char *sm); + /** Returns whether this user is currently away or not. If true, + * further information can be found in User::awaymsg and User::awaytime + * @return True if the user is away, false otherwise + */ + bool IsAway() const { return (!awaymsg.empty()); } + + /** Returns whether this user is an oper or not. If true, + * oper information can be obtained from User::oper + * @return True if the user is an oper, false otherwise + */ + bool IsOper() const { return (oper != NULL); } + /** Returns true if a notice mask is set * @param sm A notice mask character to check * @return True if the notice mask is set @@ -908,10 +920,6 @@ inline FakeUser* IS_SERVER(User* u) { return u->usertype == USERTYPE_SERVER ? static_cast(u) : NULL; } -/** Is an oper */ -#define IS_OPER(x) (x->oper) -/** Is away */ -#define IS_AWAY(x) (!x->awaymsg.empty()) /** Derived from Resolver, and performs user forward/reverse lookups. */ -- cgit v1.2.3