]> jfr.im git - irc/quakenet/newserv.git/blob - helpmod2/huser.h
GLINES: fix null pointer deref in trustgline / trustungline
[irc/quakenet/newserv.git] / helpmod2 / huser.h
1 /* new H user, a little more than N's user */
2 #ifndef HUSER_H
3 #define HUSER_H
4
5 #include <time.h>
6
7 #include "hchannel.h"
8 #include "haccount.h"
9
10 #include "hed.h"
11 #include "helpmod_entries.h"
12
13 #define H_USRFLAGS_DEFAULT 0
14
15 typedef struct huser_struct
16 {
17 /* the real N user, channel information etc. can be gotten from this */
18 nick *real_user;
19 int flags;
20 haccount *account;
21
22 helpmod_entry state; /* for old H */
23
24 time_t last_activity;
25
26 /* for the lamer control, global -> can detect lame amsg's */
27 char last_line[512];
28 int last_line_repeats;
29
30 double spam_val;
31 int flood_val;
32
33 int lc[5];
34 /* end lamer control */
35
36 helpmod_editor *editor;
37
38 struct huser_channel_struct *hchannels;
39
40 struct huser_struct *next;
41 } huser;
42
43 enum
44 {
45 HCUMODE_OP = 1 << 0,
46 HCUMODE_VOICE = 1 << 1,
47 HQUEUE_DONE = 1 << 2,
48 H_IDLE_WARNING = 1 << 3
49 };
50
51 typedef struct huser_channel_struct
52 {
53 int flags;
54 struct hchannel_struct *hchan;
55
56 time_t last_activity;
57 /* for queue, tells us who was the oper for this user */
58 huser *responsible_oper;
59
60 struct huser_channel_struct *next;
61 } huser_channel;
62
63
64 extern huser *husers;
65
66 huser *huser_add(nick*);
67 void huser_del(huser*);
68 void huser_del_all();
69 huser *huser_get(nick*);
70
71 /* indicates that the user did something, channel is optional */
72 void huser_activity(huser*, hchannel *);
73
74 void huser_clear_inactives(void);
75 int huser_count(void);
76 void huser_reset_states(void);
77
78 hlevel huser_get_level(huser*);
79 int huser_get_account_flags(huser*);
80
81 const char *huser_get_nick(huser *);
82 const char *huser_get_ident(huser *);
83 const char *huser_get_host(huser *);
84 const char *huser_get_auth(huser *);
85 const char *huser_get_realname(huser *);
86
87 /* defines the "being on queue" and being on desk (getting service) */
88 int on_queue(huser*, huser_channel*);
89 int on_desk(huser*, huser_channel*);
90
91 /* trojan removal */
92 int huser_is_trojan(huser*);
93
94 huser_channel *huser_add_channel(huser*, struct hchannel_struct*);
95 void huser_del_channel(huser*, struct hchannel_struct*);
96 /* returns 0 if the user is not on the channel, non-zero otherwise */
97 huser_channel *huser_on_channel(huser*, struct hchannel_struct*);
98
99 /* returns non-zero if the given huser pointer is valid */
100 int huser_valid(huser*);
101
102 #endif