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

Contents of /botnetop.mod/botnetop.c

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


Revision 1.4 - (show annotations) (download) (as text)
Mon Aug 28 18:23:31 2000 UTC (18 years, 8 months ago) by sup
Branch: MAIN
Changes since 1.3: +31 -6 lines
File MIME type: text/x-chdr
Updated to 0.5.0

1 /*
2 * botnetop.c -- part of botnetop.mod
3 *
4 * $Id: botnetop.c,v 1.3 2000/08/25 20:19:17 sup Exp $
5 */
6 /*
7 * Copyright (C) 2000 Teemu Hjelt <temex@iki.fi>
8 *
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 #define MODULE_NAME "botnetop"
25 #define MAKING_BOTNETOP
26 #define MODULE_VERSION "0.5.0"
27 #include "../module.h"
28 #include "../irc.mod/irc.h"
29 #include "../server.mod/server.h"
30 #include "../channels.mod/channels.h"
31
32 #undef global
33 static Function *global = NULL, *irc_funcs = NULL, *server_funcs = NULL, *channels_funcs = NULL;
34
35 #include "botnetop.h"
36
37 static int strict_host = 1;
38 static int bop_delay = 20;
39 static int bop_maxreq = 3;
40 static int bop_modeop = 0;
41 static int bop_linkop = 1;
42 static int bop_osync = 0;
43 static int bop_addhost = 0;
44 static int bop_setneed = 0;
45 static int bop_cycle = 0;
46 static int bop_log = 2;
47 static char bop_cycle_msg[256] = "Please part the channel so the bots can cycle!";
48 static struct delay_t *start_delay = NULL;
49
50 #include "misc.c"
51 #include "botcmds.c"
52 #include "ircbinds.c"
53 #include "botbinds.c"
54 #include "needbinds.c"
55 #include "tclcmds.c"
56 #include "delay.c"
57
58 static int botnetop_expmem()
59 {
60 int size = 0;
61 struct delay_t *d = start_delay;
62
63 while (d) {
64 size += sizeof(struct delay_t);
65 d = d->next;
66 }
67 return size;
68 }
69
70 static void botnetop_report(int idx, int details)
71 {
72 int dtot = 0;
73 struct delay_t *d = start_delay;
74
75 while (d) {
76 dtot++;
77 d = d->next;
78 }
79 if (details) {
80 dprintf(idx, " Tcl commands: bop_reqop, bop_letmein\n");
81 dprintf(idx, " %d delay record%s using %d bytes\n", dtot, dtot == 1 ? "" : "s", botnetop_expmem());
82 }
83 }
84
85 static tcl_ints botnetop_tcl_ints[] =
86 {
87 {"strict-host", &strict_host, 0},
88 {"bop_delay", &bop_delay, 0},
89 {"bop_maxreq", &bop_maxreq, 0},
90 {"bop_modeop", &bop_modeop, 0},
91 {"bop_linkop", &bop_linkop, 0},
92 {"bop_osync", &bop_osync, 0},
93 {"bop_addhost", &bop_addhost, 0},
94 {"bop_setneed", &bop_setneed, 0},
95 {"bop_cycle", &bop_cycle, 0},
96 {"bop_log", &bop_log, 0},
97 {0, 0, 0}
98 };
99
100 static tcl_strings botnetop_tcl_strings[] =
101 {
102 {"bop_cycle_msg", bop_cycle_msg, 256, 0},
103 {0, 0, 0, 0}
104 };
105
106 static char *botnetop_close()
107 {
108 Context;
109 del_hook(HOOK_SECONDLY, (Function) check_delays);
110 rem_builtins(H_join, botnetop_join);
111 rem_builtins(H_mode, botnetop_mode);
112 rem_builtins(H_link, botnetop_link);
113 rem_builtins(H_bot, botnetop_bot);
114 rem_builtins(H_need, botnetop_need);
115 rem_tcl_ints(botnetop_tcl_ints);
116 rem_tcl_strings(botnetop_tcl_strings);
117 rem_tcl_commands(botnetop_tcl_cmds);
118 delay_free_mem();
119 module_undepend(MODULE_NAME);
120 return NULL;
121 }
122
123 char *botnetop_start();
124
125 static Function botnetop_table[] =
126 {
127 (Function) botnetop_start,
128 (Function) botnetop_close,
129 (Function) botnetop_expmem,
130 (Function) botnetop_report,
131 };
132
133 char *botnetop_start(Function * global_funcs)
134 {
135 global = global_funcs;
136 Context;
137 module_register(MODULE_NAME, botnetop_table, 0, 5);
138 if (!(irc_funcs = module_depend(MODULE_NAME, "irc", 1, 0)))
139 return "You need the irc module to use the botnetop module.";
140 if (!(server_funcs = module_depend(MODULE_NAME, "server", 1, 0)))
141 return "You need the server module to use the botnetop module.";
142 if (!(channels_funcs = module_depend(MODULE_NAME, "channels", 1, 0)))
143 return "You need the channels module to use the botnetop module.";
144 if (!module_depend(MODULE_NAME, "eggdrop", 105, 0))
145 return "This module requires eggdrop1.5.0 or later";
146 add_hook(HOOK_SECONDLY, (Function) check_delays);
147 add_builtins(H_join, botnetop_join);
148 add_builtins(H_mode, botnetop_mode);
149 add_builtins(H_link, botnetop_link);
150 add_builtins(H_bot, botnetop_bot);
151 add_builtins(H_need, botnetop_need);
152 add_tcl_ints(botnetop_tcl_ints);
153 add_tcl_strings(botnetop_tcl_strings);
154 add_tcl_commands(botnetop_tcl_cmds);
155 putlog(LOG_MISC, "*", "botnetop.mod v%s by Sup loaded.", MODULE_VERSION);
156 return NULL;
157 }
158

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23