1 diff -urN eggdrop1.6.19/src/chan.h eggdrop1.6.19-topicprot/src/chan.h
2 --- eggdrop1.6.19/src/chan.h 2008-02-16 22:41:03.000000000 +0100
3 +++ eggdrop1.6.19-topicprot/src/chan.h 2008-07-26 11:28:08.000000000 +0200
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.19/src/chanprog.c eggdrop1.6.19-topicprot/src/chanprog.c
13 --- eggdrop1.6.19/src/chanprog.c 2008-02-16 22:41:03.000000000 +0100
14 +++ eggdrop1.6.19-topicprot/src/chanprog.c 2008-07-26 11:28:09.000000000 +0200
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.19/src/mod/channels.mod/channels.c eggdrop1.6.19-topicprot/src/mod/channels.mod/channels.c
40 --- eggdrop1.6.19/src/mod/channels.mod/channels.c 2008-02-16 22:41:06.000000000 +0100
41 +++ eggdrop1.6.19-topicprot/src/mod/channels.mod/channels.c 2008-07-26 11:28:09.000000000 +0200
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_unban, need4);
60 convert_element(chan->need_limit, need5);
62 - "channel add %s { chanmode %s idle-kick %d stopnethack-mode %d "
63 + "channel add %s { chanmode %s idle-kick topic %d stopnethack-mode %d "
64 "revenge-mode %d need-op %s need-invite %s need-key %s "
65 "need-unban %s need-limit %s flood-chan %d:%d flood-ctcp %d:%d "
66 "flood-join %d:%d flood-kick %d:%d flood-deop %d:%d "
68 "%crevenge %crevengebot %cautovoice %csecret %cshared %ccycle "
69 "%cseen %cinactive %cdynamicexempts %cuserexempts %cdynamicinvites "
70 "%cuserinvites %cnodesynch %cstatic }" "\n",
71 - name, w2, chan->idle_kick, chan->stopnethack_mode,
72 + name, 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 -urN eggdrop1.6.19/src/mod/channels.mod/cmdschan.c eggdrop1.6.19-topicprot/src/mod/channels.mod/cmdschan.c
77 --- eggdrop1.6.19/src/mod/channels.mod/cmdschan.c 2008-02-16 22:41:07.000000000 +0100
78 +++ eggdrop1.6.19-topicprot/src/mod/channels.mod/cmdschan.c 2008-07-26 21:59:43.000000000 +0200
80 dprintf(idx, "Settings for %s channel %s:\n",
81 channel_static(chan) ? "static" : "dynamic", chan->dname);
82 get_mode_protect(chan, work);
83 - dprintf(idx, "Protect modes (chanmode): %s\n", work[0] ? work : "None");
84 + dprintf(idx, "Protect topic: %s\n", chan->topic_prot[0] ? chan->topic_prot : "None");
86 dprintf(idx, "Idle Kick after (idle-kick): %d\n", chan->idle_kick);
88 diff -urN eggdrop1.6.19/src/mod/channels.mod/help/chaninfo.help eggdrop1.6.19-topicprot/src/mod/channels.mod/help/chaninfo.help
89 --- eggdrop1.6.19/src/mod/channels.mod/help/chaninfo.help 2003-02-02 05:20:44.000000000 +0100
90 +++ eggdrop1.6.19-topicprot/src/mod/channels.mod/help/chaninfo.help 2008-07-26 11:28:08.000000000 +0200
92 It shows any of the following:
93 %bchanmode%b These modes are enforced on the channel. Both + and -
94 modes can be enforced.
95 + %btopic%b which topic is enforced on the channel
96 %bidle-kick%b Kick idle users that are not +f or above on the channel
97 after how many minutes (set this to 0 to disable).
99 diff -urN eggdrop1.6.19/src/mod/channels.mod/tclchan.c eggdrop1.6.19-topicprot/src/mod/channels.mod/tclchan.c
100 --- eggdrop1.6.19/src/mod/channels.mod/tclchan.c 2008-02-16 22:41:07.000000000 +0100
101 +++ eggdrop1.6.19-topicprot/src/mod/channels.mod/tclchan.c 2008-07-26 11:28:14.000000000 +0200
102 @@ -1223,6 +1223,15 @@
105 chan->invite_time = atoi(item[i]);
106 + } else if (!strcmp(item[i], "topic")) {
110 + Tcl_AppendResult(irp, "channel topic needs argument", NULL);
113 + strncpyz(chan->topic_prot, item[i], sizeof(chan->topic_prot));
115 } else if (!strcmp(item[i], "+enforcebans"))
116 chan->status |= CHAN_ENFORCEBANS;
117 else if (!strcmp(item[i], "-enforcebans"))
118 diff -urN eggdrop1.6.19/src/mod/irc.mod/chan.c eggdrop1.6.19-topicprot/src/mod/irc.mod/chan.c
119 --- eggdrop1.6.19/src/mod/irc.mod/chan.c 2008-02-16 22:41:09.000000000 +0100
120 +++ eggdrop1.6.19-topicprot/src/mod/irc.mod/chan.c 2008-07-26 11:28:08.000000000 +0200
121 @@ -1513,12 +1513,14 @@
123 struct chanset_t *chan;
125 + struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
127 chname = newsplit(&msg);
129 u = get_user_by_host(from);
130 nick = splitnick(&from);
131 chan = findchan(chname);
132 + get_user_flagrec(u, &fr, chname);
134 putlog(LOG_JOIN, chan->dname, "Topic changed on %s by %s!%s: %s",
135 chan->dname, nick, from, msg);
136 @@ -1527,6 +1529,8 @@
138 set_topic(chan, msg);
139 check_tcl_topc(nick, from, u, chan->dname, msg);
140 + if (egg_strcasecmp(botname, nick) && !glob_master(fr) && !chan_master(fr))
145 @@ -1545,6 +1549,7 @@
147 set_topic(chan, NULL);
148 check_tcl_topc("*", "*", NULL, chan->dname, "");
153 @@ -1564,6 +1569,7 @@
155 set_topic(chan, msg);
156 check_tcl_topc("*", "*", NULL, chan->dname, msg);
161 diff -urN eggdrop1.6.19/src/mod/irc.mod/cmdsirc.c eggdrop1.6.19-topicprot/src/mod/irc.mod/cmdsirc.c
162 --- eggdrop1.6.19/src/mod/irc.mod/cmdsirc.c 2008-02-16 22:41:09.000000000 +0100
163 +++ eggdrop1.6.19-topicprot/src/mod/irc.mod/cmdsirc.c 2008-07-26 11:28:11.000000000 +0200
165 static void cmd_topic(struct userrec *u, int idx, char *par)
167 struct chanset_t *chan;
168 + struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
170 if (par[0] && (strchr(CHANMETA, par[0]) != NULL)) {
171 char *chname = newsplit(&par);
173 dprintf(idx, "I'm not a channel op or halfop on %s and the channel is "
174 "+t.\n", chan->dname);
176 + if (chan->topic_prot[0]) {
177 + get_user_flagrec(u, &fr, chan->dname);
178 + if (!glob_master(fr) && !chan_master(fr)) {
179 + dprintf(idx, "The topic of %s is protected.\n", chan->dname);
183 dprintf(DP_SERVER, "TOPIC %s :%s\n", chan->name, par);
184 dprintf(idx, "Changing topic...\n");
185 putlog(LOG_CMDS, "*", "#%s# (%s) topic %s", dcc[idx].nick,
186 diff -urN eggdrop1.6.19/src/mod/irc.mod/mode.c eggdrop1.6.19-topicprot/src/mod/irc.mod/mode.c
187 --- eggdrop1.6.19/src/mod/irc.mod/mode.c 2008-02-16 22:41:09.000000000 +0100
188 +++ eggdrop1.6.19-topicprot/src/mod/irc.mod/mode.c 2008-07-26 11:28:12.000000000 +0200
195 recheck_channel(chan, 1);
201 static void got_halfop(struct chanset_t *chan, char *nick, char *from,
202 char *who, struct userrec *opu,
206 m->flags |= WASHALFOP;
209 recheck_channel(chan, 1);
215 static void got_deop(struct chanset_t *chan, char *nick, char *from,
216 char *who, struct userrec *opu)
217 @@ -1246,6 +1250,8 @@
218 (chan->mode_mns_prot & todo)))
219 add_mode(chan, ms2[0] == '+' ? '-' : '+', *chg, "");
221 + if ((ms2[0] == '-') && ((*chg == 't') || (*chg == 'h')))
226 diff -urN eggdrop1.6.19/src/mod/module.h eggdrop1.6.19-topicprot/src/mod/module.h
227 --- eggdrop1.6.19/src/mod/module.h 2008-02-16 22:41:06.000000000 +0100
228 +++ eggdrop1.6.19-topicprot/src/mod/module.h 2008-07-26 11:28:12.000000000 +0200
230 #define rem_tcl_coups ((void (*) (tcl_coups *))global[210])
231 #define botname ((char *)(global[211]))
233 -/* 212: remove_gunk() -- UNUSED (drummer) */
234 +#define check_topic ((void (*)(struct chanset_t *))global[212])
235 #define check_tcl_chjn ((void (*) (const char *,const char *,int,char,int,const char *))global[213])
236 #define sanitycheck_dcc ((int (*)(char *, char *, char *, char *))global[214])
237 #define isowner ((int (*)(char *))global[215])
238 diff -urN eggdrop1.6.19/src/modules.c eggdrop1.6.19-topicprot/src/modules.c
239 --- eggdrop1.6.19/src/modules.c 2008-02-16 22:41:04.000000000 +0100
240 +++ eggdrop1.6.19-topicprot/src/modules.c 2008-07-26 11:28:13.000000000 +0200
242 (Function) rem_tcl_coups,
245 - (Function) 0, /* remove_gunk() -- UNUSED! (drummer) */
246 + (Function) check_topic,
247 (Function) check_tcl_chjn,
248 (Function) sanitycheck_dcc,
250 diff -urN eggdrop1.6.19/src/patch.h eggdrop1.6.19-topicprot/src/patch.h
251 --- eggdrop1.6.19/src/patch.h 2008-04-19 06:21:20.000000000 +0200
252 +++ eggdrop1.6.19-topicprot/src/patch.h 2008-07-26 11:28:13.000000000 +0200
257 -/* PATCH GOES HERE */
262 diff -urN eggdrop1.6.19/src/proto.h eggdrop1.6.19-topicprot/src/proto.h
263 --- eggdrop1.6.19/src/proto.h 2008-02-16 22:41:04.000000000 +0100
264 +++ eggdrop1.6.19-topicprot/src/proto.h 2008-07-26 21:52:01.000000000 +0200
266 void set_chanlist(const char *host, struct userrec *rec);
267 void clear_chanlist(void);
268 void clear_chanlist_member(const char *nick);
269 +void check_topic(struct chanset_t *);
272 int check_dcc_attrs(struct userrec *, int);