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

Contents of /botnetop.mod/botcmds.c

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


Revision 1.6 - (show annotations) (download) (as text)
Sat Nov 11 16:13:02 2000 UTC (18 years, 11 months ago) by sup
Branch: MAIN
Changes since 1.5: +1 -14 lines
File MIME type: text/x-chdr
Updated to v1.0.0

1 /*
2 * botcmds.c -- part of botnetop.mod
3 *
4 * $Id: botcmds.c,v 1.5 2000/10/13 20:22:48 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 static void bnop_askbot(char *hand, char *chname)
25 {
26 int i;
27 char data[256];
28 struct chanset_t *chan = NULL;
29 struct userrec *u;
30
31 if ((chan = findchan_by_dname(chname)) && (ismember(chan, botname)) && (isop(botname, chan))) {
32 u = get_user_by_handle(userlist, hand);
33 if ((matchattr(u, "b|-", chan->dname)) && (matchattr(u, "o|o", chan->dname)) && (!matchattr(u, "d|d", chan->dname))) {
34 i = nextbot(hand);
35 if (i >= 0) {
36 egg_snprintf(data, sizeof data, "doyawantops %s %s", chan->dname, botname);
37 botnet_send_zapf(i, botnetnick, hand, data);
38 }
39 }
40 }
41 }
42
43 static void bnop_reqop(char *chname)
44 {
45 int i;
46 char data[256];
47 tand_t *bot;
48 struct chanset_t *chan = NULL;
49 struct userrec *u;
50
51 if ((chan = findchan_by_dname(chname))) {
52 for (bot = tandbot; bot; bot = bot->next) {
53 u = get_user_by_handle(userlist, bot->bot);
54 if ((handisop(bot->bot, chan)) && (matchattr(u, "o|o", chan->dname))) {
55 i = nextbot(bot->bot);
56 if (i >= 0) {
57 egg_snprintf(data, sizeof data, "reqops %s", chan->dname);
58 botnet_send_zapf(i, botnetnick, bot->bot, data);
59 }
60 }
61 }
62 }
63 }
64
65 static void bnop_letmein(char *needthis, char *chname)
66 {
67 int i;
68 int bots = 0;
69 char data[256];
70 tand_t *bot;
71 struct chanset_t *chan = NULL;
72 struct needs_t *n = NULL;
73 struct userrec *u;
74
75 if ((!(chan = findchan_by_dname(chname))) || (ismember(chan, botname)))
76 return;
77 if (!(n = find_needs(chname)))
78 n = add_needs(chname);
79 if (!egg_strcasecmp(needthis, "needkey")) {
80 if (n->key)
81 return;
82 for (bot = tandbot; bot; bot = bot->next) {
83 u = get_user_by_handle(userlist, bot->bot);
84 if ((matchattr(u, "b|-", chan->dname)) && (matchattr(u, "o|o", chan->dname))) {
85 i = nextbot(bot->bot);
86 if (i >= 0) {
87 egg_snprintf(data, sizeof data, "wantkey %s %s", chan->dname, botname);
88 botnet_send_zapf(i, botnetnick, bot->bot, data);
89 bots++;
90 }
91 }
92 }
93 n->key = 1;
94 n->k_time = now;
95 if ((bop_log >= 1) && (bots > 0))
96 putlog(LOG_MISC, "*", "botnetop.mod: requested key for %s from %d bot%s", chan->dname, bots, bots == 1 ? "" : "s");
97 } else if (!egg_strcasecmp(needthis, "needinvite")) {
98 if (n->invite)
99 return;
100 for (bot = tandbot; bot; bot = bot->next) {
101 u = get_user_by_handle(userlist, bot->bot);
102 if ((matchattr(u, "b|-", chan->dname)) && (matchattr(u, "o|o", chan->dname))) {
103 i = nextbot(bot->bot);
104 if (i >= 0) {
105 if (botuserhost[0])
106 egg_snprintf(data, sizeof data, "wantinvite %s %s %s", chan->dname, botname, strchr("~+-^=", botuserhost[0]) ? botuserhost + 1 : botuserhost);
107 else
108 egg_snprintf(data, sizeof data, "wantinvite %s %s", chan->dname, botname);
109 botnet_send_zapf(i, botnetnick, bot->bot, data);
110 bots++;
111 }
112 }
113 }
114 n->invite = 1;
115 n->i_time = now;
116 if ((bop_log >= 1) && (bots > 0))
117 putlog(LOG_MISC, "*", "botnetop.mod: requested invite to %s from %d bot%s", chan->dname, bots, bots == 1 ? "" : "s");
118 } else if (!egg_strcasecmp(needthis, "needlimit")) {
119 if (n->limit)
120 return;
121 for (bot = tandbot; bot; bot = bot->next) {
122 u = get_user_by_handle(userlist, bot->bot);
123 if ((matchattr(u, "b|-", chan->dname)) && (matchattr(u, "o|o", chan->dname))) {
124 i = nextbot(bot->bot);
125 if (i >= 0) {
126 egg_snprintf(data, sizeof data, "wantlimit %s %s", chan->dname, botname);
127 botnet_send_zapf(i, botnetnick, bot->bot, data);
128 bots++;
129 }
130 }
131 }
132 n->limit = 1;
133 n->l_time = now;
134 if ((bop_log >= 1) && (bots > 0))
135 putlog(LOG_MISC, "*", "botnetop.mod: requested limit raise on %s %d bot%s", chan->dname, bots, bots == 1 ? "" : "s");
136 } else if (!egg_strcasecmp(needthis, "needunban")) {
137 if (n->unban)
138 return;
139 for (bot = tandbot; bot; bot = bot->next) {
140 u = get_user_by_handle(userlist, bot->bot);
141 if ((matchattr(u, "b|-", chan->dname)) && (matchattr(u, "o|o", chan->dname))) {
142 i = nextbot(bot->bot);
143 if (i >= 0) {
144 egg_snprintf(data, sizeof data, "wantunban %s %s %s!%s", chan->dname, botname, botname, botuserhost);
145 botnet_send_zapf(i, botnetnick, bot->bot, data);
146 bots++;
147 }
148 }
149 }
150 n->unban = 1;
151 n->u_time = now;
152 if ((bop_log >= 1) && (bots > 0))
153 putlog(LOG_MISC, "*", "botnetop.mod: requested unban on %s from %d bot%s", chan->dname, bots, bots == 1 ? "" : "s");
154 }
155 }

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23