Author: Isomer <isomer@coders.net>
[ircu2.10.12-pk.git] / include / whocmds.h
1 /*
2  * whocmds.h
3  *
4  * $Id$
5  */
6 #ifndef INCLUDED_whocmds_h
7 #define INCLUDED_whocmds_h
8 #ifndef INCLUDED_config_h
9 #include "config.h"
10 #endif
11
12 struct Client;
13 struct Channel;
14
15
16 /*
17  * m_who() 
18  * m_who with support routines rewritten by Nemesi, August 1997
19  * - Alghoritm have been flattened (no more recursive)
20  * - Several bug fixes
21  * - Strong performance improvement
22  * - Added possibility to have specific fields in the output
23  * See readme.who for further details.
24  */
25
26 /* Macros used only in here by m_who and its support functions */
27
28 #define WHOSELECT_OPER 1
29 #define WHOSELECT_EXTRA 2
30
31 #define WHO_FIELD_QTY 1
32 #define WHO_FIELD_CHA 2
33 #define WHO_FIELD_UID 4
34 #define WHO_FIELD_NIP 8
35 #define WHO_FIELD_HOS 16
36 #define WHO_FIELD_SER 32
37 #define WHO_FIELD_NIC 64
38 #define WHO_FIELD_FLA 128
39 #define WHO_FIELD_DIS 256
40 #define WHO_FIELD_REN 512
41 #define WHO_FIELD_IDL 1024
42
43 #define WHO_FIELD_DEF ( WHO_FIELD_NIC | WHO_FIELD_UID | WHO_FIELD_HOS | WHO_FIELD_SER )
44
45 #define IS_VISIBLE_USER(s,ac) ((s==ac) || (!IsInvisible(ac)))
46
47 #if defined(SHOW_INVISIBLE_LUSERS) || defined(SHOW_ALL_INVISIBLE_USERS)
48 #define SEE_LUSER(s, ac, b) (IS_VISIBLE_USER(s, ac) || ((b & WHOSELECT_EXTRA) && MyConnect(ac) && IsAnOper(s)))
49 #else
50 #define SEE_LUSER(s, ac, b) (IS_VISIBLE_USER(s, ac))
51 #endif
52
53 #ifdef SHOW_ALL_INVISIBLE_USERS
54 #define SEE_USER(s, ac, b) (SEE_LUSER(s, ac, b) || ((b & WHOSELECT_EXTRA) && IsOper(s)))
55 #else
56 #define SEE_USER(s, ac, b) (SEE_LUSER(s, ac, b))
57 #endif
58
59 #ifdef UNLIMIT_OPER_QUERY
60 #define SHOW_MORE(sptr, counter) (IsAnOper(sptr) || (!(counter-- < 0)) )
61 #else
62 #define SHOW_MORE(sptr, counter) (!(counter-- < 0))
63 #endif
64
65 #ifdef OPERS_SEE_IN_SECRET_CHANNELS
66 #ifdef LOCOP_SEE_IN_SECRET_CHANNELS
67 #define SEE_CHANNEL(s, chptr, b) (!SecretChannel(chptr) || ((b & WHOSELECT_EXTRA) && IsAnOper(s)))
68 #else
69 #define SEE_CHANNEL(s, chptr, b) (!SecretChannel(chptr) || ((b & WHOSELECT_EXTRA) && IsOper(s)))
70 #endif
71 #else
72 #define SEE_CHANNEL(s, chptr, b) (!SecretChannel(chptr))
73 #endif
74
75 #define MAX_WHOIS_LINES 50
76
77 /*
78  * Prototypes
79  */
80 extern void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
81                    int fields, char* qrt);
82
83
84 #endif /* INCLUDED_whocmds_h */