1 diff -urN eggdrop1.6.15/src/chan.h eggdrop1.6.15-topicprot/src/chan.h
2 --- eggdrop1.6.15/src/chan.h Mon May 5 00:05:32 2003
3 +++ eggdrop1.6.15-topicprot/src/chan.h Wed May 7 10:51:30 2003
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 -urN eggdrop1.6.15/src/chanprog.c eggdrop1.6.15-topicprot/src/chanprog.c
13 --- eggdrop1.6.15/src/chanprog.c Mon May 5 00:05:32 2003
14 +++ eggdrop1.6.15-topicprot/src/chanprog.c Wed May 7 10:53:11 2003
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 -urN eggdrop1.6.15/src/mod/channels.mod/channels.c eggdrop1.6.15-topicprot/src/mod/channels.mod/channels.c
40 --- eggdrop1.6.15/src/mod/channels.mod/channels.c Mon May 5 00:05:32 2003
41 +++ eggdrop1.6.15-topicprot/src/mod/channels.mod/channels.c Wed May 7 11:07:16 2003
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);
58 convert_element(chan->need_unban, need4);
59 convert_element(chan->need_limit, need5);
61 - "channel %s %s%schanmode %s idle-kick %d stopnethack-mode %d \
62 + "channel %s %s%schanmode %s topic %s idle-kick %d stopnethack-mode %d \
63 revenge-mode %d need-op %s need-invite %s need-key %s \
64 need-unban %s need-limit %s flood-chan %d:%d flood-ctcp %d:%d \
65 flood-join %d:%d flood-kick %d:%d flood-deop %d:%d \
67 %cdynamicexempts %cuserexempts %cdynamicinvites \
68 %cuserinvites %cnodesynch ",
69 channel_static(chan) ? "set" : "add", name, channel_static(chan) ?
70 - " " : " { ", w2, chan->idle_kick, chan->stopnethack_mode,
71 + " " : " { ", w2, topic, chan->idle_kick, chan->stopnethack_mode,
72 chan->revenge_mode, need1, need2, need3, need4, need5,
73 chan->flood_pub_thr, chan->flood_pub_time,
74 chan->flood_ctcp_thr, chan->flood_ctcp_time,
75 diff -urN eggdrop1.6.15/src/mod/channels.mod/cmdschan.c eggdrop1.6.15-topicprot/src/mod/channels.mod/cmdschan.c
76 --- eggdrop1.6.15/src/mod/channels.mod/cmdschan.c Mon May 5 00:05:32 2003
77 +++ eggdrop1.6.15-topicprot/src/mod/channels.mod/cmdschan.c Wed May 7 11:09:01 2003
79 channel_static(chan) ? "static" : "dynamic", chan->dname);
80 get_mode_protect(chan, work);
81 dprintf(idx, "Protect modes (chanmode): %s\n", work[0] ? work : "None");
82 + dprintf(idx, "Protect topic: %s\n", chan->topic_prot[0] ? chan->topic_prot : "None");
84 dprintf(idx, "Idle Kick after (idle-kick): %d\n", chan->idle_kick);
86 diff -urN eggdrop1.6.15/src/mod/channels.mod/help/chaninfo.help eggdrop1.6.15-topicprot/src/mod/channels.mod/help/chaninfo.help
87 --- eggdrop1.6.15/src/mod/channels.mod/help/chaninfo.help Mon May 5 00:05:32 2003
88 +++ eggdrop1.6.15-topicprot/src/mod/channels.mod/help/chaninfo.help Wed May 7 11:09:44 2003
90 It shows any of the following:
91 %bchanmode%b These modes are enforced on the channel. Both + and -
92 modes can be enforced.
93 + %btopic%b which topic is enforced on the channel
94 %bidle-kick%b Kick idle users that are not +f or above on the channel
95 after how many minutes (set this to 0 to disable).
97 diff -urN eggdrop1.6.15/src/mod/channels.mod/tclchan.c eggdrop1.6.15-topicprot/src/mod/channels.mod/tclchan.c
98 --- eggdrop1.6.15/src/mod/channels.mod/tclchan.c Mon May 5 00:05:32 2003
99 +++ eggdrop1.6.15-topicprot/src/mod/channels.mod/tclchan.c Wed May 7 11:10:59 2003
100 @@ -1223,6 +1223,15 @@
103 chan->invite_time = atoi(item[i]);
104 + } else if (!strcmp(item[i], "topic")) {
108 + Tcl_AppendResult(irp, "channel topic needs argument", NULL);
111 + strncpyz(chan->topic_prot, item[i], sizeof(chan->topic_prot));
113 } else if (!strcmp(item[i], "+enforcebans"))
114 chan->status |= CHAN_ENFORCEBANS;
115 else if (!strcmp(item[i], "-enforcebans"))
116 diff -urN eggdrop1.6.15/src/mod/irc.mod/chan.c eggdrop1.6.15-topicprot/src/mod/irc.mod/chan.c
117 --- eggdrop1.6.15/src/mod/irc.mod/chan.c Mon May 5 00:05:32 2003
118 +++ eggdrop1.6.15-topicprot/src/mod/irc.mod/chan.c Wed May 7 11:13:46 2003
119 @@ -1473,12 +1473,14 @@
121 struct chanset_t *chan;
123 + struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
125 chname = newsplit(&msg);
127 u = get_user_by_host(from);
128 nick = splitnick(&from);
129 chan = findchan(chname);
130 + get_user_flagrec(u, &fr, chname);
132 putlog(LOG_JOIN, chan->dname, "Topic changed on %s by %s!%s: %s",
133 chan->dname, nick, from, msg);
134 @@ -1487,6 +1489,8 @@
136 set_topic(chan, msg);
137 check_tcl_topc(nick, from, u, chan->dname, msg);
138 + if (egg_strcasecmp(botname, nick) && !glob_master(fr) && !chan_master(fr))
143 @@ -1505,6 +1509,7 @@
145 set_topic(chan, NULL);
146 check_tcl_topc("*", "*", NULL, chan->dname, "");
151 @@ -1524,6 +1529,7 @@
153 set_topic(chan, msg);
154 check_tcl_topc("*", "*", NULL, chan->dname, msg);
159 diff -urN eggdrop1.6.15/src/mod/irc.mod/cmdsirc.c eggdrop1.6.15-topicprot/src/mod/irc.mod/cmdsirc.c
160 --- eggdrop1.6.15/src/mod/irc.mod/cmdsirc.c Mon May 5 00:05:32 2003
161 +++ eggdrop1.6.15-topicprot/src/mod/irc.mod/cmdsirc.c Wed May 7 11:15:35 2003
163 static void cmd_topic(struct userrec *u, int idx, char *par)
165 struct chanset_t *chan;
166 + struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
168 if (par[0] && (strchr(CHANMETA, par[0]) != NULL)) {
169 char *chname = newsplit(&par);
171 dprintf(idx, "I'm not a channel op or halfop on %s and the channel is "
172 "+t.\n", chan->dname);
174 + if (chan->topic_prot[0]) {
175 + get_user_flagrec(u, &fr, chan->dname);
176 + if (!glob_master(fr) && !chan_master(fr)) {
177 + dprintf(idx, "The topic of %s is protected.\n", chan->dname);
181 dprintf(DP_SERVER, "TOPIC %s :%s\n", chan->name, par);
182 dprintf(idx, "Changing topic...\n");
183 putlog(LOG_CMDS, "*", "#%s# (%s) topic %s", dcc[idx].nick,
184 diff -urN eggdrop1.6.15/src/mod/irc.mod/mode.c eggdrop1.6.15-topicprot/src/mod/irc.mod/mode.c
185 --- eggdrop1.6.15/src/mod/irc.mod/mode.c Mon May 5 00:05:32 2003
186 +++ eggdrop1.6.15-topicprot/src/mod/irc.mod/mode.c Wed May 7 11:18:41 2003
193 recheck_channel(chan, 1);
198 static void got_halfop(struct chanset_t *chan, char *nick, char *from,
202 m->flags |= WASHALFOP;
205 recheck_channel(chan, 1);
210 static void got_deop(struct chanset_t *chan, char *nick, char *from,
211 @@ -1223,6 +1227,8 @@
212 (chan->mode_mns_prot & todo)))
213 add_mode(chan, ms2[0] == '+' ? '-' : '+', *chg, "");
215 + if ((ms2[0] == '-') && ((*chg == 't') || (*chg == 'h')))
220 diff -urN eggdrop1.6.15/src/mod/module.h eggdrop1.6.15-topicprot/src/mod/module.h
221 --- eggdrop1.6.15/src/mod/module.h Mon May 5 00:05:32 2003
222 +++ eggdrop1.6.15-topicprot/src/mod/module.h Wed May 7 11:19:36 2003
224 #define rem_tcl_coups ((void (*) (tcl_coups *))global[210])
225 #define botname ((char *)(global[211]))
227 -/* 212: remove_gunk() -- UNUSED (drummer) */
228 +#define check_topic ((void (*)(struct chanset_t *))global[212])
229 #define check_tcl_chjn ((void (*) (const char *,const char *,int,char,int,const char *))global[213])
230 #define sanitycheck_dcc ((int (*)(char *, char *, char *, char *))global[214])
231 #define isowner ((int (*)(char *))global[215])
232 diff -urN eggdrop1.6.15/src/modules.c eggdrop1.6.15-topicprot/src/modules.c
233 --- eggdrop1.6.15/src/modules.c Mon May 5 00:05:33 2003
234 +++ eggdrop1.6.15-topicprot/src/modules.c Wed May 7 11:20:12 2003
236 (Function) rem_tcl_coups,
239 - (Function) 0, /* remove_gunk() -- UNUSED! (drummer) */
240 + (Function) check_topic,
241 (Function) check_tcl_chjn,
242 (Function) sanitycheck_dcc,
244 diff -urN eggdrop1.6.15/src/patch.h eggdrop1.6.15-topicprot/src/patch.h
245 --- eggdrop1.6.15/src/patch.h Mon May 5 00:08:01 2003
246 +++ eggdrop1.6.15-topicprot/src/patch.h Wed May 7 11:21:14 2003
251 -/* PATCH GOES HERE */
256 diff -urN eggdrop1.6.15/src/proto.h eggdrop1.6.15-topicprot/src/proto.h
257 --- eggdrop1.6.15/src/proto.h Mon May 5 00:05:33 2003
258 +++ eggdrop1.6.15-topicprot/src/proto.h Wed May 7 11:21:48 2003
260 void set_chanlist(const char *host, struct userrec *rec);
261 void clear_chanlist(void);
262 void clear_chanlist_member(const char *nick);
263 +void check_topic(struct chanset_t *);
266 int check_dcc_attrs(struct userrec *, int);