]> git.pld-linux.org Git - packages/eggdrop.git/blob - eggdrop-topicprot.patch
- rediff pathes, rebuild with openssl 3.0.0, rel 2
[packages/eggdrop.git] / eggdrop-topicprot.patch
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
4 @@ -191,6 +191,7 @@
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
15 @@ -690,3 +690,23 @@
16
17    return 0;
18  }
19 +
20 +/* If we have a protected topic and the bot is opped, halfoped,
21 +* or the channel is -t, change the topic. (Sup 11May2001)
22 +*/
23 +void check_topic(struct chanset_t *chan)
24 +{
25 +  memberlist *m = NULL;
26 +
27 +  if (chan->topic_prot[0]) {
28 +    m = ismember(chan, botname);
29 +    if (!m)
30 +      return;
31 +    if (chan->channel.topic) {
32 +      if (!egg_strcasecmp(chan->topic_prot, chan->channel.topic))
33 +       return;
34 +    }
35 +    if (chan_hasop(m) || !channel_optopic(chan) || chan_hashalfop(m))
36 +      dprintf(DP_SERVER, "TOPIC %s :%s\n", chan->name, chan->topic_prot);
37 +  }
38 +}
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
42 @@ -385,6 +385,7 @@
43    FILE *f;
44    char s[121], w[1024], w2[1024], name[163];
45    char need1[242], need2[242], need3[242], need4[242], need5[242];
46 +  char topic[1002];
47    struct chanset_t *chan;
48    struct udef_struct *ul;
49
50 @@ -405,6 +406,7 @@
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 @@ -417,7 +417,7 @@
59      convert_element(chan->need_unban, need4);
60      convert_element(chan->need_limit, need5);
61      fprintf(f,
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 "
67 @@ -428,7 +428,7 @@
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
79 @@ -1268,7 +1268,7 @@
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");
85      if (chan->idle_kick)
86        dprintf(idx, "Idle Kick after (idle-kick): %d\n", chan->idle_kick);
87      else
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
91 @@ -4,6 +4,7 @@
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).
98  %{+n}
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 @@
103          return TCL_ERROR;
104        }
105        chan->invite_time = atoi(item[i]);
106 +     } else if (!strcmp(item[i], "topic")) {
107 +       i++;
108 +       if (i >= items) {
109 +        if (irp)
110 +          Tcl_AppendResult(irp, "channel topic needs argument", NULL);
111 +        return TCL_ERROR;
112 +       }
113 +       strncpyz(chan->topic_prot, item[i], sizeof(chan->topic_prot));
114 +       check_topic(chan);
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 @@
122    memberlist *m;
123    struct chanset_t *chan;
124    struct userrec *u;
125 +  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
126
127    chname = newsplit(&msg);
128    fixcolon(msg);
129    u = get_user_by_host(from);
130    nick = splitnick(&from);
131    chan = findchan(chname);
132 +  get_user_flagrec(u, &fr, chname);
133    if (chan) {
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 @@
137        m->last = now;
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))
141 +      check_topic(chan);
142    }
143    return 0;
144  }
145 @@ -1545,6 +1549,7 @@
146    if (chan) {
147      set_topic(chan, NULL);
148      check_tcl_topc("*", "*", NULL, chan->dname, "");
149 +    check_topic(chan);
150    }
151    return 0;
152  }
153 @@ -1564,6 +1569,7 @@
154      fixcolon(msg);
155      set_topic(chan, msg);
156      check_tcl_topc("*", "*", NULL, chan->dname, msg);
157 +    check_topic(chan);
158    }
159    return 0;
160  }
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
164 @@ -898,6 +898,7 @@
165  static void cmd_topic(struct userrec *u, int idx, char *par)
166  {
167    struct chanset_t *chan;
168 +  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
169
170    if (par[0] && (strchr(CHANMETA, par[0]) != NULL)) {
171      char *chname = newsplit(&par);
172 @@ -923,6 +924,13 @@
173      dprintf(idx, "I'm not a channel op or halfop on %s and the channel is "
174              "+t.\n", chan->dname);
175    else {
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);
180 +         return;
181 +       }
182 +      }
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
189 @@ -460,9 +460,11 @@
190      }
191    }
192    m->flags |= WASOP;
193 -  if (check_chan)
194 +  if (check_chan) {
195      recheck_channel(chan, 1);
196 -}
197 +    check_topic(chan);
198 +  }
199 + }
200
201  static void got_halfop(struct chanset_t *chan, char *nick, char *from,
202                         char *who, struct userrec *opu,
203 @@ -549,9 +551,11 @@
204      }
205    }
206    m->flags |= WASHALFOP;
207 -  if (check_chan)
208 +  if (check_chan) {
209      recheck_channel(chan, 1);
210 -}
211 +    check_topic(chan);
212 +  }
213 + }
214
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, "");
220            }
221 +          if ((ms2[0] == '-') && ((*chg == 't') || (*chg == 'h')))
222 +            check_topic(chan);
223          }
224          chg++;
225        }
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
229 @@ -361,7 +361,7 @@
230  #define rem_tcl_coups ((void (*) (tcl_coups *))global[210])
231  #define botname ((char *)(global[211]))
232  /* 212 - 215 */
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
241 @@ -461,7 +461,7 @@
242    (Function) rem_tcl_coups,
243    (Function) botname,
244    /* 212 - 215 */
245 -  (Function) 0,                   /* remove_gunk() -- UNUSED! (drummer)  */
246 +  (Function) check_topic,
247    (Function) check_tcl_chjn,
248    (Function) sanitycheck_dcc,
249    (Function) isowner,
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
253 @@ -36,7 +36,7 @@
254   *
255   *
256   */
257 -/* PATCH GOES HERE */
258 +patch("topicprot");
259  /*
260   *
261   *
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
265 @@ -114,6 +114,7 @@
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 *);
270
271  /* cmds.c */
272  int check_dcc_attrs(struct userrec *, int);
273
This page took 0.075281 seconds and 3 git commands to generate.