]> jfr.im git - irc/quakenet/newserv.git/blob - helpmod2/hchannel.h
Added files that weren't in the initial import.
[irc/quakenet/newserv.git] / helpmod2 / hchannel.h
1 /* new H channel entries */
2 #ifndef HCHANNEL_H
3 #define HCHANNEL_H
4
5 #include <time.h>
6
7 #include "../channel/channel.h"
8
9 #include "hlamer.h"
10 #include "hcensor.h"
11 #include "hterm.h"
12 #include "htopic.h"
13 #include "hstat.h"
14 #include "hdef.h"
15 #include "hticket.h"
16
17 enum
18 {
19 H_PASSIVE = 1 << 0,
20 H_WELCOME = 1 << 1,
21 H_JOINFLOOD_PROTECTION = 1 << 2,
22 H_QUEUE = 1 << 3,
23
24 H_QUEUE_SPAMMY = 1 << 4,
25 H_QUEUE_MAINTAIN = 1 << 5,
26 H_REPORT = 1 << 6,
27 H_CENSOR = 1 << 7,
28
29 H_LAMER_CONTROL = 1 << 8,
30 H_ANTI_IDLE = 1 << 9,
31 H_MAINTAIN_M = 1 << 10,
32 H_MAINTAIN_I = 1 << 11,
33
34 H_HANDLE_TOPIC = 1 << 12,
35 H_DO_STATS = 1 << 13,
36 H_TROJAN_REMOVAL = 1 << 14,
37 H_CHANNEL_COMMANDS = 1 << 15,
38
39 H_OPER_ONLY = 1 << 16,
40 H_DISALLOW_LAME_TEXT = 1 << 17,
41 H_QUEUE_TIMEOUT = 1 << 18,
42 H_REQUIRE_TICKET = 1 << 19,
43
44 /* the following are not real channel flags, they're used only internally */
45 H_UNUSED_1 = 1 << 28,
46 H_UNUSED_2 = 1 << 29,
47 H_JOIN_FLOOD = 1 << 30,
48 H_EVERYONEOUT = 1 << 31
49 };
50
51 #define H_CHANFLAGS_DEFAULT (H_CHANNEL_COMMANDS)
52
53 #define HCHANNEL_CONF_COUNT 19
54
55 typedef struct hchannel_struct
56 {
57 channel *real_channel;
58 char welcome[400];
59 int flags;
60
61 int jf_control; /* join flood control */
62 hcensor *censor; /* censor, keeps the bad words out */
63 int autoqueue; /* H_QUEUE_MAINTAIN value */
64 int max_idle; /* automatic idler removal */
65 htopic *topic;
66 hterm *channel_hterms; /* local terms */
67 struct hchannel_struct *report_to; /* where to report this channels statistics */
68
69 /* this is also the queue, so it's "sorted" */
70 struct hchannel_user_struct *channel_users;
71
72 hstat_channel *stats;
73
74 hlc_profile *lc_profile;
75
76 struct hticket_struct *htickets;
77
78 struct hchannel_struct *next;
79 } hchannel;
80
81 typedef struct hchannel_user_struct
82 {
83 struct huser_struct *husr;
84 time_t time_joined;
85 struct hchannel_user_struct *next;
86 } hchannel_user;
87
88 extern hchannel *hchannels;
89
90 hchannel *hchannel_add(const char *);
91 int hchannel_del(hchannel *);
92 void hchannel_del_all(void);
93 hchannel *hchannel_get_by_channel(channel *);
94 hchannel *hchannel_get_by_name(const char *);
95 const char *hchannel_get_name(hchannel*);
96
97 hchannel_user *hchannel_on_channel(hchannel*, struct huser_struct *);
98 hchannel_user *hchannel_add_user(hchannel*, struct huser_struct *);
99 hchannel_user *hchannel_del_user(hchannel*, struct huser_struct *);
100
101 int hchannel_authority(hchannel*, struct huser_struct *);
102
103 /* returns the setting state for a channel, the int is the flag, not 1 << parameter */
104 const char *hchannel_get_state(hchannel*, int);
105 /* returns a setting name */
106 const char *hchannel_get_sname(int);
107 void hchannel_conf_change(hchannel *, int);
108 void hchannel_mode_check(hchannel*);
109
110 void hchannel_remove_inactive_users(void);
111 void hchannel_report(void);
112
113 void hchannel_set_topic(hchannel *);
114
115 /*int hchannel_on_queue(hchannel *, struct huser_struct *);*/
116 int hchannels_on_queue(struct huser_struct*);
117 int hchannels_on_desk(struct huser_struct*);
118
119 int hchannel_count_users(hchannel *, hlevel);
120 int hchannel_count_queue(hchannel *);
121
122 void hchannels_dnmo(struct huser_struct*);
123
124 int hchannel_is_valid(hchannel *);
125
126 /* somewhat of a hack, but channels have to be loaded before accounts */
127 void hchannels_match_accounts(void);
128
129 int hchannel_count(void);
130
131 void hchannel_activate_join_flood(hchannel*);
132 /* goes to schedule */
133 void hchannel_deactivate_join_flood();
134
135 #endif