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

Annotation of /botnetop.mod/botcmds.c

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


Revision 1.6 - (hide 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 sup 1.3 /*
2     * botcmds.c -- part of botnetop.mod
3     *
4 sup 1.6 * $Id: botcmds.c,v 1.5 2000/10/13 20:22:48 sup Exp $
5 sup 1.3 */
6     /*
7 guppy 1.1 * 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 sup 1.3 static void bnop_askbot(char *hand, char *chname)
25 guppy 1.1 {
26 sup 1.5 int i;
27 guppy 1.1 char data[256];
28     struct chanset_t *chan = NULL;
29     struct userrec *u;
30    
31 sup 1.5 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 guppy 1.1 }
40     }
41     }
42    
43 sup 1.3 static void bnop_reqop(char *chname)
44 guppy 1.1 {
45 sup 1.5 int i;
46 guppy 1.1 char data[256];
47     tand_t *bot;
48     struct chanset_t *chan = NULL;
49     struct userrec *u;
50    
51 sup 1.5 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 guppy 1.1 }
61     }
62     }
63     }
64    
65 sup 1.3 static void bnop_letmein(char *needthis, char *chname)
66 guppy 1.1 {
67 sup 1.5 int i;
68     int bots = 0;
69 guppy 1.1 char data[256];
70     tand_t *bot;
71     struct chanset_t *chan = NULL;
72 sup 1.5 struct needs_t *n = NULL;
73 guppy 1.1 struct userrec *u;
74    
75     if ((!(chan = findchan_by_dname(chname))) || (ismember(chan, botname)))
76     return;
77 sup 1.5 if (!(n = find_needs(chname)))
78     n = add_needs(chname);
79 guppy 1.1 if (!egg_strcasecmp(needthis, "needkey")) {
80 sup 1.5 if (n->key)
81     return;
82     for (bot = tandbot; bot; bot = bot->next) {
83 guppy 1.1 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 sup 1.5 egg_snprintf(data, sizeof data, "wantkey %s %s", chan->dname, botname);
88 guppy 1.1 botnet_send_zapf(i, botnetnick, bot->bot, data);
89 sup 1.5 bots++;
90 guppy 1.1 }
91     }
92     }
93 sup 1.5 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 guppy 1.1 } else if (!egg_strcasecmp(needthis, "needinvite")) {
98 sup 1.5 if (n->invite)
99     return;
100     for (bot = tandbot; bot; bot = bot->next) {
101 guppy 1.1 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 sup 1.5 egg_snprintf(data, sizeof data, "wantinvite %s %s %s", chan->dname, botname, strchr("~+-^=", botuserhost[0]) ? botuserhost + 1 : botuserhost);
107 guppy 1.1 else
108 sup 1.5 egg_snprintf(data, sizeof data, "wantinvite %s %s", chan->dname, botname);
109 guppy 1.1 botnet_send_zapf(i, botnetnick, bot->bot, data);
110 sup 1.5 bots++;
111 guppy 1.1 }
112     }
113     }
114 sup 1.5 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 guppy 1.1 } else if (!egg_strcasecmp(needthis, "needlimit")) {
119 sup 1.5 if (n->limit)
120     return;
121     for (bot = tandbot; bot; bot = bot->next) {
122 guppy 1.1 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 sup 1.5 egg_snprintf(data, sizeof data, "wantlimit %s %s", chan->dname, botname);
127 guppy 1.1 botnet_send_zapf(i, botnetnick, bot->bot, data);
128 sup 1.5 bots++;
129 guppy 1.1 }
130     }
131     }
132 sup 1.5 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 guppy 1.1 } else if (!egg_strcasecmp(needthis, "needunban")) {
137 sup 1.5 if (n->unban)
138     return;
139     for (bot = tandbot; bot; bot = bot->next) {
140 guppy 1.1 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 sup 1.5 egg_snprintf(data, sizeof data, "wantunban %s %s %s!%s", chan->dname, botname, botname, botuserhost);
145 guppy 1.1 botnet_send_zapf(i, botnetnick, bot->bot, data);
146 sup 1.5 bots++;
147 guppy 1.1 }
148     }
149     }
150 sup 1.5 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 guppy 1.1 }
155     }

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23