/[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.4 - (show annotations) (download) (as text)
Mon Aug 28 18:23:31 2000 UTC (18 years, 9 months ago) by sup
Branch: MAIN
Changes since 1.3: +4 -4 lines
File MIME type: text/x-chdr
Updated to 0.5.0

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23