/[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.2 - (hide annotations) (download) (as text)
Mon Aug 14 01:47:33 2000 UTC (19 years, 2 months ago) by guppy
Branch: MAIN
Changes since 1.1: +2 -0 lines
File MIME type: text/x-chdr
added Id tags

1 guppy 1.1 /*
2 guppy 1.2 * $Id$
3     *
4 guppy 1.1 * Copyright (C) 2000 Teemu Hjelt <temex@iki.fi>
5     *
6     * This program is free software; you can redistribute it and/or
7     * modify it under the terms of the GNU General Public License
8     * as published by the Free Software Foundation; either version 2
9     * of the License, or (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19     */
20    
21     static void bnop_setneed (char *chname)
22     {
23     struct chanset_t *chan = NULL;
24    
25     if (!(chan = findchan_by_dname(chname)))
26     return;
27     egg_snprintf(chan->need_op, 120, "bop_reqop %s", chan->dname);
28     egg_snprintf(chan->need_key, 120, "bop_letmein needkey %s", chan->dname);
29     egg_snprintf(chan->need_invite, 120, "bop_letmein needinvite %s", chan->dname);
30     egg_snprintf(chan->need_limit, 120, "bop_letmein needlimit %s", chan->dname);
31     egg_snprintf(chan->need_unban, 120, "bop_letmein needunban %s", chan->dname);
32     }
33    
34     static void bnop_askbot (char *hand, char *chname)
35     {
36     char data[256];
37     int i;
38     struct chanset_t *chan = NULL;
39     struct userrec *u;
40    
41     u = get_user_by_handle(userlist, hand);
42     if ((chan = findchan_by_dname(chname)) && (ismember(chan, botname)) && (isop(botname, chan->dname)) && (matchattr(u, "b|-", chan->dname)) && (matchattr(u, "o|o", chan->dname)) && (!matchattr(u, "d|d", chan->dname))) {
43     i = nextbot(hand);
44     if (i >= 0) {
45     sprintf(data, "doyawantops %s %s", chan->dname, botname);
46     botnet_send_zapf(i, botnetnick, hand, data);
47     }
48     }
49     }
50    
51     static void bnop_reqop (char *chname)
52     {
53     char data[256];
54     int i;
55     tand_t *bot;
56     struct chanset_t *chan = NULL;
57     struct userrec *u;
58    
59     for (bot = tandbot; bot != NULL; bot = bot->next) {
60     u = get_user_by_handle(userlist, bot->bot);
61     if ((chan = findchan_by_dname(chname)) && (handisop(bot->bot, chan->dname)) && (matchattr(u, "o|o", chan->dname))) {
62     i = nextbot(bot->bot);
63     if (i >= 0) {
64     sprintf(data, "reqops %s", chan->dname);
65     botnet_send_zapf(i, botnetnick, bot->bot, data);
66     }
67     }
68     }
69     }
70    
71     static void bnop_letmein (char *needthis, char *chname)
72     {
73     char data[256];
74     int i;
75     tand_t *bot;
76     struct chanset_t *chan = NULL;
77     struct userrec *u;
78    
79     if ((!(chan = findchan_by_dname(chname))) || (ismember(chan, botname)))
80     return;
81     if (!egg_strcasecmp(needthis, "needkey")) {
82     for (bot = tandbot; bot != NULL; 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     sprintf(data, "wantkey %s %s", chan->dname, botname);
88     botnet_send_zapf(i, botnetnick, bot->bot, data);
89     }
90     }
91     }
92     if (bop_log >= 1)
93     putlog(LOG_MISC, "*", "botnetop.mod: requested key for %s from all linked bots", chan->dname);
94     } else if (!egg_strcasecmp(needthis, "needinvite")) {
95     for (bot = tandbot; bot != NULL; bot = bot->next) {
96     u = get_user_by_handle(userlist, bot->bot);
97     if ((matchattr(u, "b|-", chan->dname)) && (matchattr(u, "o|o", chan->dname))) {
98     i = nextbot(bot->bot);
99     if (i >= 0) {
100     if (botuserhost[0])
101     sprintf(data, "wantinvite %s %s %s", chan->dname, botname, strchr("~+-^=", botuserhost[0]) ? (botuserhost + 1) : botuserhost);
102     else
103     sprintf(data, "wantinvite %s %s", chan->dname, botname);
104     botnet_send_zapf(i, botnetnick, bot->bot, data);
105     }
106     }
107     }
108     if (bop_log >= 1)
109     putlog(LOG_MISC, "*", "botnetop.mod: requested invite to %s from all linked bots", chan->dname);
110     } else if (!egg_strcasecmp(needthis, "needlimit")) {
111     for (bot = tandbot; bot != NULL; bot = bot->next) {
112     u = get_user_by_handle(userlist, bot->bot);
113     if ((matchattr(u, "b|-", chan->dname)) && (matchattr(u, "o|o", chan->dname))) {
114     i = nextbot(bot->bot);
115     if (i >= 0) {
116     sprintf(data, "wantlimit %s %s", chan->dname, botname);
117     botnet_send_zapf(i, botnetnick, bot->bot, data);
118     }
119     }
120     }
121     if (bop_log >= 1)
122     putlog(LOG_MISC, "*", "botnetop.mod: requested limit raise on %s from all linked bots", chan->dname);
123     } else if (!egg_strcasecmp(needthis, "needunban")) {
124     for (bot = tandbot; bot != NULL; bot = bot->next) {
125     u = get_user_by_handle(userlist, bot->bot);
126     if ((matchattr(u, "b|-", chan->dname)) && (matchattr(u, "o|o", chan->dname))) {
127     i = nextbot(bot->bot);
128     if (i >= 0) {
129     sprintf(data, "wantunban %s %s %s!%s", chan->dname, botname, botname, botuserhost);
130     botnet_send_zapf(i, botnetnick, bot->bot, data);
131     }
132     }
133     }
134     if (bop_log >= 1)
135     putlog(LOG_MISC, "*", "botnetop.mod: requested unban on %s from all linked bots", chan->dname);
136     }
137     }

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23