/[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.1.1.1 - (show annotations) (download) (as text) (vendor branch)
Mon Aug 14 01:41:03 2000 UTC (18 years, 10 months ago) by guppy
Branch: botnetop
CVS Tags: botnetop1
Changes since 1.1: +0 -0 lines
File MIME type: text/x-chdr
first checkin

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23