1 diff -burN eggdrop1.6.17.orig/src/chan.h eggdrop1.6.17/src/chan.h
2 --- eggdrop1.6.17.orig/src/chan.h 2004-11-01 12:48:53.752584640 +0100
3 +++ eggdrop1.6.17/src/chan.h 2004-11-01 13:38:31.701867536 +0100
5 int mode_mns_prot; /* modes to reject */
6 int limit_prot; /* desired limit */
7 char key_prot[121]; /* desired password */
8 + char topic_prot[501]; /* desired topic */
9 char pls[21]; /* positive mode changes */
10 char mns[21]; /* negative mode changes */
11 char *key; /* new key to set */
12 diff -burN eggdrop1.6.17.orig/src/chanprog.c eggdrop1.6.17/src/chanprog.c
13 --- eggdrop1.6.17.orig/src/chanprog.c 2004-11-01 12:48:53.766582512 +0100
14 +++ eggdrop1.6.17/src/chanprog.c 2004-11-01 13:38:31.704867080 +0100
20 +/* If we have a protected topic and the bot is opped, halfoped,
21 + * or the channel is -t, change the topic. (Sup 11May2001)
23 +void check_topic(struct chanset_t *chan)
25 + memberlist *m = NULL;
27 + if (chan->topic_prot[0]) {
28 + m = ismember(chan, botname);
31 + if (chan->channel.topic) {
32 + if (!egg_strcasecmp(chan->topic_prot, chan->channel.topic))
35 + if (chan_hasop(m) || !channel_optopic(chan) || chan_hashalfop(m))
36 + dprintf(DP_SERVER, "TOPIC %s :%s\n", chan->name, chan->topic_prot);
39 diff -burN eggdrop1.6.17.orig/src/mod/channels.mod/channels.c eggdrop1.6.17/src/mod/channels.mod/channels.c
40 --- eggdrop1.6.17.orig/src/mod/channels.mod/channels.c 2004-11-01 12:48:53.673596648 +0100
41 +++ eggdrop1.6.17/src/mod/channels.mod/channels.c 2004-11-01 13:39:57.089886584 +0100
44 char s[121], w[1024], w2[1024], name[163];
45 char need1[242], need2[242], need3[242], need4[242], need5[242];
47 struct chanset_t *chan;
48 struct udef_struct *ul;
51 convert_element(chan->dname, name);
52 get_mode_protect(chan, w);
53 convert_element(w, w2);
54 + convert_element(chan->topic_prot, topic);
55 convert_element(chan->need_op, need1);
56 convert_element(chan->need_invite, need2);
57 convert_element(chan->need_key, need3);
59 convert_element(chan->need_limit, need5);
60 /* Do not indent me (adds extra spaces to chan file). */
62 -"channel %s %s%schanmode %s idle-kick %d stopnethack-mode %d revenge-mode %d \
63 +"channel %s %s%schanmode %s topic %s idle-kick %d stopnethack-mode %d revenge-mode %d \
64 need-op %s need-invite %s need-key %s need-unban %s need-limit %s \
65 flood-chan %d:%d flood-ctcp %d:%d flood-join %d:%d flood-kick %d:%d \
66 flood-deop %d:%d flood-nick %d:%d aop-delay %d:%d ban-time %d exempt-time %d \
68 %cseen %cinactive %cdynamicexempts %cuserexempts %cdynamicinvites \
69 %cuserinvites %cnodesynch ",
70 channel_static(chan) ? "set" : "add", name, channel_static(chan) ?
71 - " " : " { ", w2, chan->idle_kick, chan->stopnethack_mode,
72 + " " : " { ", w2, topic, chan->idle_kick, chan->stopnethack_mode,
73 chan->revenge_mode, need1, need2, need3, need4, need5,
74 chan->flood_pub_thr, chan->flood_pub_time,
75 chan->flood_ctcp_thr, chan->flood_ctcp_time,
76 diff -burN eggdrop1.6.17.orig/src/mod/channels.mod/cmdschan.c eggdrop1.6.17/src/mod/channels.mod/cmdschan.c
77 --- eggdrop1.6.17.orig/src/mod/channels.mod/cmdschan.c 2004-11-01 12:48:53.670597104 +0100
78 +++ eggdrop1.6.17/src/mod/channels.mod/cmdschan.c 2004-11-01 13:38:31.711866016 +0100
80 channel_static(chan) ? "static" : "dynamic", chan->dname);
81 get_mode_protect(chan, work);
82 dprintf(idx, "Protect modes (chanmode): %s\n", work[0] ? work : "None");
83 + dprintf(idx, "Protect topic: %s\n", chan->topic_prot[0] ? chan->topic_prot : "None");
85 dprintf(idx, "Idle Kick after (idle-kick): %d\n", chan->idle_kick);
87 diff -burN eggdrop1.6.17.orig/src/mod/channels.mod/help/chaninfo.help eggdrop1.6.17/src/mod/channels.mod/help/chaninfo.help
88 --- eggdrop1.6.17.orig/src/mod/channels.mod/help/chaninfo.help 2004-11-01 12:48:53.669597256 +0100
89 +++ eggdrop1.6.17/src/mod/channels.mod/help/chaninfo.help 2004-11-01 13:38:31.713865712 +0100
91 It shows any of the following:
92 %bchanmode%b These modes are enforced on the channel. Both + and -
93 modes can be enforced.
94 + %btopic%b which topic is enforced on the channel
95 %bidle-kick%b Kick idle users that are not +f or above on the channel
96 after how many minutes (set this to 0 to disable).
98 diff -burN eggdrop1.6.17.orig/src/mod/channels.mod/tclchan.c eggdrop1.6.17/src/mod/channels.mod/tclchan.c
99 --- eggdrop1.6.17.orig/src/mod/channels.mod/tclchan.c 2004-11-01 12:48:53.671596952 +0100
100 +++ eggdrop1.6.17/src/mod/channels.mod/tclchan.c 2004-11-01 13:38:31.716865256 +0100
101 @@ -1223,6 +1223,15 @@
104 chan->invite_time = atoi(item[i]);
105 + } else if (!strcmp(item[i], "topic")) {
109 + Tcl_AppendResult(irp, "channel topic needs argument", NULL);
112 + strncpyz(chan->topic_prot, item[i], sizeof(chan->topic_prot));
114 } else if (!strcmp(item[i], "+enforcebans"))
115 chan->status |= CHAN_ENFORCEBANS;
116 else if (!strcmp(item[i], "-enforcebans"))
117 diff -burN eggdrop1.6.17.orig/src/mod/irc.mod/chan.c eggdrop1.6.17/src/mod/irc.mod/chan.c
118 --- eggdrop1.6.17.orig/src/mod/irc.mod/chan.c 2004-11-01 12:48:53.738586768 +0100
119 +++ eggdrop1.6.17/src/mod/irc.mod/chan.c 2004-11-01 13:38:31.721864496 +0100
120 @@ -1500,12 +1500,14 @@
122 struct chanset_t *chan;
124 + struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
126 chname = newsplit(&msg);
128 u = get_user_by_host(from);
129 nick = splitnick(&from);
130 chan = findchan(chname);
131 + get_user_flagrec(u, &fr, chname);
133 putlog(LOG_JOIN, chan->dname, "Topic changed on %s by %s!%s: %s",
134 chan->dname, nick, from, msg);
135 @@ -1514,6 +1516,8 @@
137 set_topic(chan, msg);
138 check_tcl_topc(nick, from, u, chan->dname, msg);
139 + if (egg_strcasecmp(botname, nick) && !glob_master(fr) && !chan_master(fr))
144 @@ -1532,6 +1536,7 @@
146 set_topic(chan, NULL);
147 check_tcl_topc("*", "*", NULL, chan->dname, "");
152 @@ -1551,6 +1556,7 @@
154 set_topic(chan, msg);
155 check_tcl_topc("*", "*", NULL, chan->dname, msg);
160 diff -burN eggdrop1.6.17.orig/src/mod/irc.mod/cmdsirc.c eggdrop1.6.17/src/mod/irc.mod/cmdsirc.c
161 --- eggdrop1.6.17.orig/src/mod/irc.mod/cmdsirc.c 2004-11-01 12:48:53.740586464 +0100
162 +++ eggdrop1.6.17/src/mod/irc.mod/cmdsirc.c 2004-11-01 13:38:31.724864040 +0100
164 static void cmd_topic(struct userrec *u, int idx, char *par)
166 struct chanset_t *chan;
167 + struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
169 if (par[0] && (strchr(CHANMETA, par[0]) != NULL)) {
170 char *chname = newsplit(&par);
172 dprintf(idx, "I'm not a channel op or halfop on %s and the channel is "
173 "+t.\n", chan->dname);
175 + if (chan->topic_prot[0]) {
176 + get_user_flagrec(u, &fr, chan->dname);
177 + if (!glob_master(fr) && !chan_master(fr)) {
178 + dprintf(idx, "The topic of %s is protected.\n", chan->dname);
182 dprintf(DP_SERVER, "TOPIC %s :%s\n", chan->name, par);
183 dprintf(idx, "Changing topic...\n");
184 putlog(LOG_CMDS, "*", "#%s# (%s) topic %s", dcc[idx].nick,
185 diff -burN eggdrop1.6.17.orig/src/mod/irc.mod/mode.c eggdrop1.6.17/src/mod/irc.mod/mode.c
186 --- eggdrop1.6.17.orig/src/mod/irc.mod/mode.c 2004-11-01 12:48:53.739586616 +0100
187 +++ eggdrop1.6.17/src/mod/irc.mod/mode.c 2004-11-01 13:38:31.727863584 +0100
194 recheck_channel(chan, 1);
199 static void got_halfop(struct chanset_t *chan, char *nick, char *from,
203 m->flags |= WASHALFOP;
206 recheck_channel(chan, 1);
211 static void got_deop(struct chanset_t *chan, char *nick, char *from,
212 @@ -1241,6 +1245,8 @@
213 (chan->mode_mns_prot & todo)))
214 add_mode(chan, ms2[0] == '+' ? '-' : '+', *chg, "");
216 + if ((ms2[0] == '-') && ((*chg == 't') || (*chg == 'h')))
221 diff -burN eggdrop1.6.17.orig/src/mod/module.h eggdrop1.6.17/src/mod/module.h
222 --- eggdrop1.6.17.orig/src/mod/module.h 2004-11-01 12:48:53.681595432 +0100
223 +++ eggdrop1.6.17/src/mod/module.h 2004-11-01 13:38:31.729863280 +0100
225 #define rem_tcl_coups ((void (*) (tcl_coups *))global[210])
226 #define botname ((char *)(global[211]))
228 -/* 212: remove_gunk() -- UNUSED (drummer) */
229 +#define check_topic ((void (*)(struct chanset_t *))global[212])
230 #define check_tcl_chjn ((void (*) (const char *,const char *,int,char,int,const char *))global[213])
231 #define sanitycheck_dcc ((int (*)(char *, char *, char *, char *))global[214])
232 #define isowner ((int (*)(char *))global[215])
233 diff -burN eggdrop1.6.17.orig/src/modules.c eggdrop1.6.17/src/modules.c
234 --- eggdrop1.6.17.orig/src/modules.c 2004-11-01 12:48:53.762583120 +0100
235 +++ eggdrop1.6.17/src/modules.c 2004-11-01 13:38:31.732862824 +0100
237 (Function) rem_tcl_coups,
240 - (Function) 0, /* remove_gunk() -- UNUSED! (drummer) */
241 + (Function) check_topic,
242 (Function) check_tcl_chjn,
243 (Function) sanitycheck_dcc,
245 diff -burN eggdrop1.6.17.orig/src/patch.h eggdrop1.6.17/src/patch.h
246 --- eggdrop1.6.17.orig/src/patch.h 2004-11-01 12:48:53.765582664 +0100
247 +++ eggdrop1.6.17/src/patch.h 2004-11-01 13:38:31.734862520 +0100
252 -/* PATCH GOES HERE */
257 diff -burN eggdrop1.6.17.orig/src/proto.h eggdrop1.6.17/src/proto.h
258 --- eggdrop1.6.17.orig/src/proto.h 2004-11-01 12:48:53.769582056 +0100
259 +++ eggdrop1.6.17/src/proto.h 2004-11-01 13:38:31.735862368 +0100
261 void set_chanlist(const char *host, struct userrec *rec);
262 void clear_chanlist(void);
263 void clear_chanlist_member(const char *nick);
264 +void check_topic(struct chanset_t *);
267 int check_dcc_attrs(struct userrec *, int);