/[cvs]/botnetop.mod/botnetop.h
ViewVC logotype

Annotation of /botnetop.mod/botnetop.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.8 - (hide annotations) (download) (as text)
Sun Jul 14 09:28:45 2002 UTC (17 years, 4 months ago) by sup
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +135 -56 lines
File MIME type: text/x-csrc
Updated to 1.1.0-gamma

1 sup 1.8 /*
2 sup 1.3 * botnetop.h -- part of botnetop.mod
3 sup 1.8 *
4     * $Id$
5 sup 1.3 */
6     /*
7 sup 1.8 * Copyright (C) 2000, 2001, 2002 Teemu Hjelt <temex@iki.fi>
8 guppy 1.1 *
9     * This program is free software; you can redistribute it and/or
10     * modify it under the terms of the GNU General Public License
11     * as published by the Free Software Foundation; either version 2
12     * of the License, or (at your option) any later version.
13     *
14     * This program is distributed in the hope that it will be useful,
15     * but WITHOUT ANY WARRANTY; without even the implied warranty of
16     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17     * GNU General Public License for more details.
18     *
19     * You should have received a copy of the GNU General Public License
20     * along with this program; if not, write to the Free Software
21     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22     */
23    
24     #ifndef _EGG_MOD_BOTNETOP_BOTNETOP_H
25     #define _EGG_MOD_BOTNETOP_BOTNETOP_H
26    
27     #ifdef MAKING_BOTNETOP
28 sup 1.4
29 sup 1.8 /*
30     * Language messages
31     */
32    
33     #define BOTNETOP_INVITED "invited %s to %s"
34     #define BOTNETOP_INVITED2 "invited %s (using nick %s) to %s"
35     #define BOTNETOP_GAVEOPS "gave ops to %s on %s"
36     #define BOTNETOP_GAVEOPS2 "gave ops to %s (using nick %s) on %s"
37     #define BOTNETOP_GAVEKEY "gave key for %s to %s"
38     #define BOTNETOP_RAISEDLIMIT "raised limit on %s as requested by %s"
39     #define BOTNETOP_UNBANNED "unbanned %s on %s (removed %d bans)"
40     #define BOTNETOP_SETEXEMPT "set exemption %s on %s for %s"
41     #define BOTNETOP_SETINVITE "set invite %s on %s for %s"
42     #define BOTNETOP_REQKEY "requested key for %s from %d bot%s"
43     #define BOTNETOP_REQINVITE "requested invite to %s from %d bot%s"
44     #define BOTNETOP_REQLIMIT "requested limit raise on %s from %d bot%s"
45     #define BOTNETOP_REQUNBAN "requested unban on %s from %d bot%s"
46     #define BOTNETOP_REQOPS "requested ops from %s on %s"
47     #define BOTNETOP_ADDHOST "added host %s to %s"
48    
49     /*
50     * Misc definitions
51     */
52    
53     /* Size of the log entries. Getting a truncated log entry isn't
54     that cruicial and 1024 should be enough for everybody anyway. */
55    
56     #ifndef LOGSIZE
57     # define LOGSIZE 1024+1
58     #endif
59    
60     /* Define this if you want botnetop.mod to introduce
61     few Tcl commands. */
62    
63     #ifdef ENABLE_TCL_COMMANDS
64     # undef ENABLE_TCL_COMMANDS
65     #endif
66 sup 1.4
67 sup 1.8 /*
68     * Delay structure and functions (delay.c)
69     */
70 sup 1.4
71     struct delay_t {
72 sup 1.8 struct delay_t *next; /* Next delay record */
73     char *chan; /* Name of the channel to request ops for */
74     char *handle; /* Handle of the bot to request ops from */
75     int reqs; /* Amount of op requests */
76     time_t reqtime; /* Time when to ask ops */
77     time_t resptime; /* Time when to reset the amount of op reqs */
78 sup 1.4 };
79 sup 1.8 static struct delay_t *find_delay(char *, char *);
80 sup 1.5 static struct delay_t *add_delay(char *, char *);
81     static void del_delay(struct delay_t *);
82     static void check_delay();
83 sup 1.4 static void delay_free_mem();
84 sup 1.5 static int delay_expmem();
85 sup 1.8 static int check_delay_status(char *, char *);
86    
87     /*
88     * Who structure and functions (who.c)
89     */
90 sup 1.5
91     struct who_t {
92 sup 1.8 struct who_t *next; /* Next who record */
93     char *chan; /* Name of the channel bot asked for invite */
94     char *nick; /* Nick of the bot */
95     char *handle; /* Handle of the bot */
96     char *uhost; /* Userhost of the bot */
97     time_t time; /* Time when to delete the who record */
98 sup 1.5 };
99     static struct who_t *find_who(char *);
100     static struct who_t *add_who(char *, char *, char *, char *);
101     static void del_who(struct who_t *);
102     static void check_who();
103     static void who_free_mem();
104     static int who_expmem();
105    
106 sup 1.8 /*
107     * Flood structure and functions (flood.c)
108     */
109    
110     struct flood_t {
111     struct flood_t *next; /* Next flood record */
112     char *chan; /* Name of the channel */
113     int amount; /* Amount of requests */
114     time_t time; /* Time when the counter should be decreased */
115     time_t ignore; /* Time when the ignore should be removed */
116     };
117     static struct flood_t *find_flood(char *);
118     static struct flood_t *add_flood(char *);
119     static void del_flood(struct flood_t *);
120     static void check_flood();
121     static void flood_free_mem();
122     static int flood_expmem();
123     static int check_flood_status(char *);
124    
125     /*
126     * Request structure and functions (request.c)
127     */
128    
129     struct request_t {
130     struct request_t *next; /* Next request record */
131     char *handle; /* Handle of the bot */
132     char *chan; /* Name of the channel */
133 sup 1.5 };
134 sup 1.8 static struct request_t *find_request(char *, char *);
135     static struct request_t *add_request(char *, char *);
136     static void del_request(struct request_t *);
137     static void request_free_mem();
138     static int request_expmem();
139     static int check_request_status(char *, char *);
140    
141     /*
142     * Functions in misc.c
143     */
144    
145     static int matchattr(struct userrec *, char *, char *);
146     static int isop(char *, struct chanset_t *);
147     static int handisop(char *, struct chanset_t *);
148     static int lowbots(struct chanset_t *);
149    
150     /*
151     * Functions in botcmds.c
152     */
153    
154     static int bnop_reqop(char *, char *);
155     static void bnop_askbot(char *, char *);
156     static void bnop_invite(struct chanset_t *, char *, char *, char *);
157     static void bnop_letmein(struct chanset_t *, char *);
158    
159     /*
160     * Macros
161     */
162 sup 1.5
163 sup 1.6 #ifndef strncpyz
164 sup 1.8 # define strncpyz(target, source, len) do { \
165     strncpy((target), (source), (len) - 1); \
166     (target)[(len) - 1] = 0; \
167     } while (0)
168     #endif /* strncpyz */
169    
170     /* If the compat functions aren't defined
171     we just assume that the system has them. */
172    
173     #ifndef egg_strcasecmp
174     # define egg_strcasecmp strcasecmp
175     #endif /* egg_strcasecmp */
176    
177     #ifndef egg_snprintf
178     # define egg_snprintf snprintf
179     #endif /* egg_snprintf */
180 sup 1.4
181 sup 1.8 #endif /* MAKING_BOTNETOP */
182 guppy 1.1
183 sup 1.8 #endif /* _EGG_MOD_BOTNETOP_BOTNETOP_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23