]> jfr.im git - irc/quakenet/newserv.git/blame - helpmod2/hchannel.h
overflow in G's welcome command
[irc/quakenet/newserv.git] / helpmod2 / hchannel.h
CommitLineData
c86edd1d
Q
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
17enum
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,
135d6084 43
9af95c3d 44 H_TICKET_MESSAGE = 1 << 20,
135d6084 45 H_HIGHLIGHT_PREVENTION = 1 << 21,
c86edd1d
Q
46
47 /* the following are not real channel flags, they're used only internally */
48 H_UNUSED_1 = 1 << 28,
49 H_UNUSED_2 = 1 << 29,
50 H_JOIN_FLOOD = 1 << 30,
51 H_EVERYONEOUT = 1 << 31
52};
53
54#define H_CHANFLAGS_DEFAULT (H_CHANNEL_COMMANDS)
55
135d6084 56#define HCHANNEL_CONF_COUNT 21
c86edd1d 57
32d04a20
P
58#define HCHANNEL_WELCOME_LEN 400
59
c86edd1d
Q
60typedef struct hchannel_struct
61{
62 channel *real_channel;
32d04a20 63 char welcome[HCHANNEL_WELCOME_LEN];
c86edd1d
Q
64 int flags;
65
66 int jf_control; /* join flood control */
67 hcensor *censor; /* censor, keeps the bad words out */
68 int autoqueue; /* H_QUEUE_MAINTAIN value */
69 int max_idle; /* automatic idler removal */
70 htopic *topic;
71 hterm *channel_hterms; /* local terms */
72 struct hchannel_struct *report_to; /* where to report this channels statistics */
73
74 /* this is also the queue, so it's "sorted" */
75 struct hchannel_user_struct *channel_users;
76
3a839281 77 time_t last_activity;
78 time_t last_staff_activity;
c86edd1d
Q
79 hstat_channel *stats;
80
81 hlc_profile *lc_profile;
82
83 struct hticket_struct *htickets;
9af95c3d 84 sstring *ticket_message;
c86edd1d
Q
85
86 struct hchannel_struct *next;
87} hchannel;
88
89typedef struct hchannel_user_struct
90{
91 struct huser_struct *husr;
92 time_t time_joined;
93 struct hchannel_user_struct *next;
94} hchannel_user;
95
96extern hchannel *hchannels;
97
98hchannel *hchannel_add(const char *);
99int hchannel_del(hchannel *);
100void hchannel_del_all(void);
101hchannel *hchannel_get_by_channel(channel *);
102hchannel *hchannel_get_by_name(const char *);
103const char *hchannel_get_name(hchannel*);
104
105hchannel_user *hchannel_on_channel(hchannel*, struct huser_struct *);
106hchannel_user *hchannel_add_user(hchannel*, struct huser_struct *);
107hchannel_user *hchannel_del_user(hchannel*, struct huser_struct *);
108
109int hchannel_authority(hchannel*, struct huser_struct *);
110
111/* returns the setting state for a channel, the int is the flag, not 1 << parameter */
112const char *hchannel_get_state(hchannel*, int);
113/* returns a setting name */
114const char *hchannel_get_sname(int);
115void hchannel_conf_change(hchannel *, int);
116void hchannel_mode_check(hchannel*);
117
118void hchannel_remove_inactive_users(void);
119void hchannel_report(void);
120
121void hchannel_set_topic(hchannel *);
122
123/*int hchannel_on_queue(hchannel *, struct huser_struct *);*/
124int hchannels_on_queue(struct huser_struct*);
125int hchannels_on_desk(struct huser_struct*);
126
127int hchannel_count_users(hchannel *, hlevel);
128int hchannel_count_queue(hchannel *);
129
130void hchannels_dnmo(struct huser_struct*);
131
132int hchannel_is_valid(hchannel *);
133
134/* somewhat of a hack, but channels have to be loaded before accounts */
135void hchannels_match_accounts(void);
136
137int hchannel_count(void);
138
135d6084 139int hchannel_highlight_detection(hchannel *, const char *);
140
c86edd1d
Q
141void hchannel_activate_join_flood(hchannel*);
142/* goes to schedule */
143void hchannel_deactivate_join_flood();
144
145#endif