X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=include%2Fwhocmds.h;h=357a17523b3996bb098b6bc1f6bca358e99989e6;hb=refs%2Fheads%2Fupstream-ssl;hp=e02358a9a408293b886c3b8d862c7424abda6162;hpb=7ec4144c6b646292025b62ebeb1f974e02c03698;p=ircu2.10.12-pk.git diff --git a/include/whocmds.h b/include/whocmds.h index e02358a..357a175 100644 --- a/include/whocmds.h +++ b/include/whocmds.h @@ -1,13 +1,9 @@ -/* - * whocmds.h - * - * $Id$ +/** @file whocmds.h + * @brief Support functions for /WHO-like commands. + * @version $Id$ */ #ifndef INCLUDED_whocmds_h #define INCLUDED_whocmds_h -#ifndef INCLUDED_config_h -#include "config.h" -#endif struct Client; struct Channel; @@ -25,53 +21,66 @@ struct Channel; /* Macros used only in here by m_who and its support functions */ -#define WHOSELECT_OPER 1 -#define WHOSELECT_EXTRA 2 - -#define WHO_FIELD_QTY 1 -#define WHO_FIELD_CHA 2 -#define WHO_FIELD_UID 4 -#define WHO_FIELD_NIP 8 -#define WHO_FIELD_HOS 16 -#define WHO_FIELD_SER 32 -#define WHO_FIELD_NIC 64 -#define WHO_FIELD_FLA 128 -#define WHO_FIELD_DIS 256 -#define WHO_FIELD_REN 512 -#define WHO_FIELD_IDL 1024 - +#define WHOSELECT_OPER 1 /**< Flag for /WHO: Show IRC operators. */ +#define WHOSELECT_EXTRA 2 /**< Flag for /WHO: Pull rank to see users. */ +#define WHOSELECT_DELAY 4 /**< Flag for /WHO: Show join-delayed users. */ + +#define WHO_FIELD_QTY 1 /**< Display query type. */ +#define WHO_FIELD_CHA 2 /**< Show common channel name. */ +#define WHO_FIELD_UID 4 /**< Show username. */ +#define WHO_FIELD_NIP 8 /**< Show IP address. */ +#define WHO_FIELD_HOS 16 /**< Show hostname. */ +#define WHO_FIELD_SER 32 /**< Show server. */ +#define WHO_FIELD_NIC 64 /**< Show nickname. */ +#define WHO_FIELD_FLA 128 /**< Show flags (away, oper, chanop, etc). */ +#define WHO_FIELD_DIS 256 /**< Show hop count (distance). */ +#define WHO_FIELD_REN 512 /**< Show realname (info). */ +#define WHO_FIELD_IDL 1024 /**< Show idle time. */ +#define WHO_FIELD_ACC 2048 /**< Show account name. */ +#define WHO_FIELD_OPL 4096 /**< Show oplevel. */ + +/** Default fields for /WHO */ #define WHO_FIELD_DEF ( WHO_FIELD_NIC | WHO_FIELD_UID | WHO_FIELD_HOS | WHO_FIELD_SER ) +/** Is \a ac plainly visible to \a s? + * @param[in] s Client trying to see \a ac. + * @param[in] ac Client being looked at. + */ #define IS_VISIBLE_USER(s,ac) ((s==ac) || (!IsInvisible(ac))) -#if defined(SHOW_INVISIBLE_LUSERS) || defined(SHOW_ALL_INVISIBLE_USERS) -#define SEE_LUSER(s, ac, b) (IS_VISIBLE_USER(s, ac) || ((b & WHOSELECT_EXTRA) && MyConnect(ac) && IsAnOper(s))) -#else -#define SEE_LUSER(s, ac, b) (IS_VISIBLE_USER(s, ac)) -#endif - -#ifdef SHOW_ALL_INVISIBLE_USERS -#define SEE_USER(s, ac, b) (SEE_LUSER(s, ac, b) || ((b & WHOSELECT_EXTRA) && IsOper(s))) -#else -#define SEE_USER(s, ac, b) (SEE_LUSER(s, ac, b)) -#endif +/** Can \a s see \a ac by using the flags in \a b? + * @param[in] s Client trying to see \a ac. + * @param[in] ac Client being looked at. + * @param[in] b Bitset of extra flags (options: WHOSELECT_EXTRA). + */ +#define SEE_LUSER(s, ac, b) (IS_VISIBLE_USER(s, ac) || \ + ((b & WHOSELECT_EXTRA) && MyConnect(ac) && \ + (HasPriv((s), PRIV_SHOW_INVIS) || \ + HasPriv((s), PRIV_SHOW_ALL_INVIS)))) + +/** Can \a s see \a ac by using the flags in \a b? + * @param[in] s Client trying to see \a ac. + * @param[in] ac Client being looked at. + * @param[in] b Bitset of extra flags (options: WHOSELECT_EXTRA). + */ +#define SEE_USER(s, ac, b) (SEE_LUSER(s, ac, b) || \ + ((b & WHOSELECT_EXTRA) && \ + HasPriv((s), PRIV_SHOW_ALL_INVIS))) -#ifdef UNLIMIT_OPER_QUERY -#define SHOW_MORE(sptr, counter) (IsAnOper(sptr) || (!(counter-- < 0)) ) -#else -#define SHOW_MORE(sptr, counter) (!(counter-- < 0)) -#endif +/** Should we show more clients to \a sptr? + * @param[in] sptr Client listing other users. + * @param[in,out] counter Default count for clients. + */ +#define SHOW_MORE(sptr, counter) (HasPriv(sptr, PRIV_UNLIMIT_QUERY) || (!(counter-- < 0)) ) -#ifdef OPERS_SEE_IN_SECRET_CHANNELS -#ifdef LOCOP_SEE_IN_SECRET_CHANNELS -#define SEE_CHANNEL(s, chptr, b) (!SecretChannel(chptr) || ((b & WHOSELECT_EXTRA) && IsAnOper(s))) -#else -#define SEE_CHANNEL(s, chptr, b) (!SecretChannel(chptr) || ((b & WHOSELECT_EXTRA) && IsOper(s))) -#endif -#else -#define SEE_CHANNEL(s, chptr, b) (!SecretChannel(chptr)) -#endif +/** Can \a s see \a chptr? + * @param[in] s Client trying to see \a chptr. + * @param[in] chptr Channel being looked at. + * @param[in] b Bitset of extra flags (options: WHOSELECT_EXTRA). + */ +#define SEE_CHANNEL(s, chptr, b) (!SecretChannel(chptr) || ((b & WHOSELECT_EXTRA) && HasPriv((s), PRIV_SEE_CHAN))) +/** Maximum number of lines to send in response to a /WHOIS. */ #define MAX_WHOIS_LINES 50 /* @@ -80,5 +89,4 @@ struct Channel; extern void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan, int fields, char* qrt); - #endif /* INCLUDED_whocmds_h */