]> git.pld-linux.org Git - packages/eggdrop.git/blob - eggdrop-multilevel_sharing.patch
- rediff pathes, rebuild with openssl 3.0.0, rel 2
[packages/eggdrop.git] / eggdrop-multilevel_sharing.patch
1 diff -burN eggdrop1.6.17.orig/doc/tcl-commands.doc eggdrop1.6.17/doc/tcl-commands.doc
2 --- eggdrop1.6.17.orig/doc/tcl-commands.doc     2004-11-01 12:48:53.000000000 +0100
3 +++ eggdrop1.6.17/doc/tcl-commands.doc  2004-11-01 14:21:10.565861080 +0100
4 @@ -1258,6 +1258,17 @@
5      Module: filesys
6  
7  
8 +
9 +***### SHARE MODULE COMMANDS ###***
10 +
11 +  noshare <command> [<arg1> <arg2> ...]
12 +    Description: executes command with setting noshare = 1 in code,
13 +      that means, if you i.e. do chattr using this command,
14 +      bot will make changes on his userlist, but won't send changes
15 +      to other bots. This is useful in some situations.
16 +    Returns: whatever is returned by <command>
17 +    Module: share
18 +
19  *** MISCELLANEOUS COMMANDS ***
20  
21    bind <type> <flags> <keyword/mask> [proc-name]
22 diff -burN eggdrop1.6.17.orig/doc/USERS eggdrop1.6.17/doc/USERS
23 --- eggdrop1.6.17.orig/doc/USERS        2004-11-01 12:48:53.000000000 +0100
24 +++ eggdrop1.6.17/doc/USERS     2004-11-01 14:21:10.567860776 +0100
25 @@ -77,6 +77,11 @@
26  
27      u  (unshared)       user record is not sent to other bots.
28  
29 +    s  (protected)      is working similar like u flag, but changes can be made
30 +                        only from bot that is aggressively sharing with us (Hub).
31 +                        User cannot be changed by bot that is connected below
32 +                        this bot. (This flag can be useful in multilevel sharing)
33 +
34      h  (highlight)      use bold text in help/text files.
35  
36      All global flags other then u, h, b, c, x, j, and p are also
37 diff -burN eggdrop1.6.17.orig/eggdrop.conf eggdrop1.6.17/eggdrop.conf
38 --- eggdrop1.6.17.orig/eggdrop.conf     2004-11-01 12:48:53.000000000 +0100
39 +++ eggdrop1.6.17/eggdrop.conf  2004-11-01 14:21:10.570860320 +0100
40 @@ -1145,11 +1145,21 @@
41  # changes from other bots should be ignored?
42  #set private-globals "mnot"
43  
44 +# When sharing user lists, which channel flags changes from other bots
45 +# should be ignored?
46 +#set private-chanflags "mn"
47 +
48  # When sharing user lists, don't accept ANY userfile changes from other
49  # bots? Paranoid people should use this feature on their hub bot. This
50  # will force all userlist changes to be made via the hub.
51  #set private-user 0
52  
53 +# When you have multilevel botnet, this option permits hub, to make changes,
54 +# even when private-global, private-chanflags and/or private-user are set.
55 +# NOTE: this option doesn't permit hub to force flags filtered by
56 +# private-globals
57 +#set permit-hub 1
58 +
59  # This setting makes the bot discard its own bot records in favor of
60  # the ones sent by the hub.
61  # NOTE: No passwords or botflags are shared, only ports and
62 diff -burN eggdrop1.6.17.orig/help/cmds2.help eggdrop1.6.17/help/cmds2.help
63 --- eggdrop1.6.17.orig/help/cmds2.help  2004-11-01 12:48:53.000000000 +0100
64 +++ eggdrop1.6.17/help/cmds2.help       2004-11-01 14:21:10.572860016 +0100
65 @@ -372,6 +372,7 @@
66        %bp%b - party-line (user has access to the partyline)
67        %bq%b - quiet (user cannot gain voice on any channel)
68        %br%b - dehalfop (user cannot gain halfops on any channel)
69 +      %bs%b - protected (when sharing changes can be made only by hub)
70        %bt%b - botnet master (user has access to features related to the botnet)
71        %bu%b - unshared (user's user record is not sent to other bots)
72        %bv%b - voice (user gets +v automatically on +autovoice channels)
73 diff -burN eggdrop1.6.17.orig/src/cmds.c eggdrop1.6.17/src/cmds.c
74 --- eggdrop1.6.17.orig/src/cmds.c       2004-11-01 12:48:53.000000000 +0100
75 +++ eggdrop1.6.17/src/cmds.c    2004-11-01 14:21:10.576859408 +0100
76 @@ -1551,8 +1551,8 @@
77        mns.chan &= ~(BOT_SHARE);
78      }
79      if (!glob_owner(user)) {
80 -      pls.global &=~(USER_OWNER | USER_MASTER | USER_BOTMAST | USER_UNSHARED);
81 -      mns.global &=~(USER_OWNER | USER_MASTER | USER_BOTMAST | USER_UNSHARED);
82 +      pls.global &=~(USER_OWNER | USER_MASTER | USER_BOTMAST | USER_UNSHARED | USER_PROTECTED);
83 +      mns.global &=~(USER_OWNER | USER_MASTER | USER_BOTMAST | USER_UNSHARED | USER_PROTECTED);
84  
85        if (chan) {
86          pls.chan &= ~USER_OWNER;
87 diff -burN eggdrop1.6.17.orig/src/flags.h eggdrop1.6.17/src/flags.h
88 --- eggdrop1.6.17.orig/src/flags.h      2004-11-01 12:48:53.000000000 +0100
89 +++ eggdrop1.6.17/src/flags.h   2004-11-01 14:21:10.577859256 +0100
90 @@ -44,8 +44,8 @@
91  
92  /*
93   * userflags:
94 - *   abcdefgh?jklmnopqr?tuvwxyz + user defined A-Z
95 - *   unused letters: is
96 + *   abcdefgh?jklmnopqrstuvwxyz + user defined A-Z
97 + *   unused letters: i
98   *
99   * botflags:
100   *   0123456789ab????ghi??l???p?rs???????
101 @@ -55,7 +55,7 @@
102   *   a??defg???klmno?qr??uv??yz + user defined A-Z
103   *   unused letters: bchijpstwx
104   */
105 -#define USER_VALID 0x03fbfeff   /* Sum of all USER_ flags */
106 +#define USER_VALID 0x03fffeff   /* Sum of all USER_ flags */
107  #define CHAN_VALID 0x03777c79   /* Sum of all CHAN_ flags */
108  #define BOT_VALID  0x7fe689C1   /* Sum of all BOT_  flags */
109  
110 @@ -78,7 +78,7 @@
111  #define USER_PARTY         0x00008000 /* p  user has party line access            */
112  #define USER_QUIET         0x00010000 /* q  user is global de-voice               */
113  #define USER_DEHALFOP      0x00020000 /* r  user is global de-halfop              */
114 -#define USER_S             0x00040000 /* s  unused                                */
115 +#define USER_PROTECTED     0x00040000 /* s  user is protected (cannot be removed/changed by downlinks  */
116  #define USER_BOTMAST       0x00080000 /* t  user is botnet master                 */
117  #define USER_UNSHARED      0x00100000 /* u  not shared with sharebots             */
118  #define USER_VOICE         0x00200000 /* v  user is +v on all channels            */
119 @@ -166,6 +166,7 @@
120  #define glob_hilite(x)          ((x).global & USER_HIGHLITE)
121  #define chan_exempt(x)          ((x).chan & USER_EXEMPT)
122  #define glob_exempt(x)          ((x).global & USER_EXEMPT)
123 +#define glob_protected(x)      ((x).global & USER_PROTECTED)
124  
125  #define bot_global(x)           ((x).bot & BOT_GLOBAL)
126  #define bot_chan(x)             ((x).chan & BOT_AGGRESSIVE)
127 diff -burN eggdrop1.6.17.orig/src/mod/share.mod/share.c eggdrop1.6.17/src/mod/share.mod/share.c
128 --- eggdrop1.6.17.orig/src/mod/share.mod/share.c        2004-11-01 12:48:53.000000000 +0100
129 +++ eggdrop1.6.17/src/mod/share.mod/share.c     2004-11-01 14:27:44.822924896 +0100
130 @@ -50,11 +50,14 @@
131  static int private_global = 0;
132  static int private_user = 0;
133  static char private_globals[50];
134 +static char private_chanflags[50];
135  static int allow_resync = 0;
136  static struct flag_record fr = { 0, 0, 0, 0, 0, 0 };
137  static int resync_time = 900;
138  static int overr_local_bots = 0;        /* Override local bots?             */
139  
140 +static int permit_hub = 0; /* Permit hub to do changes even, when we use private_*, */
141 +                           /* but not private_globals (this have a reason) */
142  
143  /* Store info for sharebots */
144  struct share_msgq {
145 @@ -81,6 +84,7 @@
146  static void q_resync(char *, struct chanset_t *);
147  static void cancel_user_xfer(int, void *);
148  static int private_globals_bitmask();
149 +static int private_chanflags_bitmask();
150  
151  #include "share.h"
152  
153 @@ -314,7 +318,7 @@
154    char *hand;
155    struct userrec *u;
156  
157 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
158 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
159      hand = newsplit(&par);
160      u = get_user_by_handle(userlist, hand);
161      if (u && !(u->flags & USER_UNSHARED)) {
162 @@ -336,26 +340,33 @@
163    int bfl, ofl;
164    module_entry *me;
165  
166 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
167 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
168      hand = newsplit(&par);
169      u = get_user_by_handle(userlist, hand);
170 -    if (u && !(u->flags & USER_UNSHARED)) {
171 +    if (u && !(u->flags & USER_UNSHARED) && !IS_USER_PROTECTED(u, idx)) {
172        atr = newsplit(&par);
173        cst = findchan_by_dname(par);
174        if (!par[0] || (cst && channel_shared(cst))) {
175 -        if (!(dcc[idx].status & STAT_GETTING) && (cst || !private_global))
176 -          shareout_but(cst, idx, "a %s %s %s\n", hand, atr, par);
177          noshare = 1;
178          if (par[0] && cst) {
179 +         int pchbm = 0;
180 +         if (!PERMIT_HUB(idx))
181 +               pchbm = private_chanflags_bitmask();
182            fr.match = (FR_CHAN | FR_BOT);
183 +         /* bot's sharing flags */
184            get_user_flagrec(dcc[idx].user, &fr, par);
185            if (bot_chan(fr) || bot_global(fr)) {
186              fr.match = FR_CHAN;
187              fr2.match = FR_CHAN;
188              break_down_flags(atr, &fr, 0);
189              get_user_flagrec(u, &fr2, par);
190 -            fr.chan = (fr2.chan & BOT_AGGRESSIVE) |
191 -                      (fr.chan & ~BOT_AGGRESSIVE);
192 +            fr.chan = (fr2.chan & BOT_AGGRESSIVE) | (fr.chan & ~BOT_AGGRESSIVE);
193 +           /* Checking for forced flags */
194 +           if ( (pchbm & USER_OWNER) && chan_owner(fr) && !chan_owner(fr2))
195 +                   fr.chan &= ~(USER_MASTER | USER_OP);
196 +           else if ( (pchbm & USER_MASTER) && chan_master(fr) && !chan_master(fr2))
197 +                   fr.chan &= ~USER_OP;
198 +           fr.chan = (fr2.chan & pchbm) | (fr.chan & ~pchbm);
199              set_user_flagrec(u, &fr, par);
200              check_dcc_chanattrs(u, par, fr.chan, fr2.chan);
201              noshare = 0;
202 @@ -372,7 +383,7 @@
203              putlog(LOG_CMDS, "*",
204                     "Rejected flags for unshared channel %s from %s",
205                     par, dcc[idx].nick);
206 -        } else if (!private_global) {
207 +        } else if (!private_global || PERMIT_HUB(idx)) {
208            int pgbm = private_globals_bitmask();
209  
210            /* Don't let bot flags be altered */
211 @@ -391,15 +402,18 @@
212            if (!(dcc[idx].status & STAT_GETTING))
213              putlog(LOG_CMDS, "*", "%s: chattr %s %s", dcc[idx].nick, hand, s);
214            if ((me = module_find("irc", 0, 0))) {
215 +           struct chanset_t *tmpcst;
216              Function *func = me->funcs;
217  
218 -            for (cst = chanset; cst; cst = cst->next)
219 -              (func[IRC_RECHECK_CHANNEL]) (cst, 0);
220 +            for (tmpcst = chanset; tmpcst; tmpcst = tmpcst->next)
221 +              (func[IRC_RECHECK_CHANNEL]) (tmpcst, 0);
222            }
223          } else
224            putlog(LOG_CMDS, "*", "Rejected global flags for %s from %s",
225                   hand, dcc[idx].nick);
226          noshare = 0;
227 +       if (!(dcc[idx].status & STAT_GETTING) && (cst || !private_global || PERMIT_HUB(idx)))
228 +               shareout_but(cst, idx, "a %s %s %s\n", hand, s, par);
229        }
230      }
231    }
232 @@ -411,7 +425,7 @@
233    struct chanset_t *chan;
234    struct userrec *u;
235  
236 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
237 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
238      user = newsplit(&par);
239      if ((u = get_user_by_handle(userlist, user))) {
240        chan = findchan_by_dname(par);
241 @@ -440,7 +454,7 @@
242    struct chanset_t *chan;
243    struct userrec *u;
244  
245 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
246 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
247      user = newsplit(&par);
248      if ((u = get_user_by_handle(userlist, user))) {
249        chan = findchan_by_dname(par);
250 @@ -466,13 +480,13 @@
251    char *nick, *host, *pass, s[100];
252    struct userrec *u;
253  
254 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
255 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
256      nick = newsplit(&par);
257      host = newsplit(&par);
258      pass = newsplit(&par);
259  
260      if (!(u = get_user_by_handle(userlist, nick)) ||
261 -        !(u->flags & USER_UNSHARED)) {
262 +        !((u->flags & USER_UNSHARED) || IS_USER_PROTECTED(u, idx))) {
263        fr.global = 0;
264  
265        fr.match = FR_GLOBAL;
266 @@ -517,9 +531,9 @@
267    struct userrec *u;
268  
269    /* If user is a share bot, ignore command */
270 -  if ((dcc[idx].status & STAT_SHARE) && !private_user &&
271 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx)) &&
272        (u = get_user_by_handle(userlist, par)) &&
273 -      !(u->flags & USER_UNSHARED) &&
274 +      !(u->flags & USER_UNSHARED) && !IS_USER_PROTECTED(u, idx) &&
275        !((u->flags & USER_BOT) && (bot_flags(u) & BOT_SHARE))) {
276      noshare = 1;
277      if (deluser(par)) {
278 @@ -535,10 +549,10 @@
279    char *hand;
280    struct userrec *u;
281  
282 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
283 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
284      hand = newsplit(&par);
285      if ((u = get_user_by_handle(userlist, hand)) &&
286 -        !(u->flags & USER_UNSHARED)) {
287 +        !(u->flags & USER_UNSHARED) && !IS_USER_PROTECTED(u, idx)) {
288        shareout_but(NULL, idx, "+h %s %s\n", hand, par);
289        set_user(&USERENTRY_HOSTS, u, par);
290        putlog(LOG_CMDS, "*", "%s: +host %s %s", dcc[idx].nick, hand, par);
291 @@ -551,10 +565,10 @@
292    char *hand, p[32];
293    struct userrec *u;
294  
295 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
296 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
297      hand = newsplit(&par);
298      if (!(u = get_user_by_handle(userlist, hand)) ||
299 -        !(u->flags & USER_UNSHARED)) {
300 +        !((u->flags & USER_UNSHARED) || IS_USER_PROTECTED(u, idx))) {
301        if (!(dcc[idx].status & STAT_GETTING))
302          shareout_but(NULL, idx, "+bh %s %s\n", hand, par);
303        /* Add bot to userlist if not there */
304 @@ -577,10 +591,10 @@
305    char *hand;
306    struct userrec *u;
307  
308 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
309 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
310      hand = newsplit(&par);
311      if ((u = get_user_by_handle(userlist, hand)) &&
312 -        !(u->flags & USER_UNSHARED)) {
313 +        !(u->flags & USER_UNSHARED) && !IS_USER_PROTECTED(u, idx)) {
314        shareout_but(NULL, idx, "-h %s %s\n", hand, par);
315        noshare = 1;
316        delhost_by_handle(hand, par);
317 @@ -597,11 +611,11 @@
318    struct user_entry_type *uet;
319    struct user_entry *e;
320  
321 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
322 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
323      key = newsplit(&par);
324      hand = newsplit(&par);
325      if (!(u = get_user_by_handle(userlist, hand)) ||
326 -        !(u->flags & USER_UNSHARED)) {
327 +        !((u->flags & USER_UNSHARED) || IS_USER_PROTECTED(u,idx))) {
328        if (!(uet = find_entry_type(key)))
329          /* If it's not a supported type, forget it */
330          debug2("Ignore ch %s from %s (unknown type)", key, dcc[idx].nick);
331 @@ -645,10 +659,10 @@
332    struct chanset_t *cst;
333    struct userrec *u;
334  
335 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
336 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
337      hand = newsplit(&par);
338      if ((u = get_user_by_handle(userlist, hand)) &&
339 -        !(u->flags & USER_UNSHARED) && share_greet) {
340 +        !(u->flags & USER_UNSHARED) && !IS_USER_PROTECTED(u, idx) && share_greet) {
341        chan = newsplit(&par);
342        cst = findchan_by_dname(chan);
343        fr.match = (FR_CHAN | FR_BOT);
344 @@ -2039,11 +2053,13 @@
345    {"private-global",  &private_global},
346    {"private-user",      &private_user},
347    {"override-bots", &overr_local_bots},
348 +  {"permit-hub",          &permit_hub},
349    {NULL,                         NULL}
350  };
351  
352  static tcl_strings my_strings[] = {
353    {"private-globals", private_globals, 50, 0},
354 +  {"private-chanflags", private_chanflags, 50, 0},
355    {NULL,              NULL,            0,  0}
356  };
357  
358 @@ -2062,6 +2078,38 @@
359    {NULL,    NULL, NULL,                 NULL}
360  };
361  
362 +static int tcl_noshare STDVAR
363 +{
364 +  int res;
365 +  char *x;
366 +
367 +  if (argc < 2) {
368 +    Tcl_AppendResult(irp, "wrong # args: should be \"",
369 +    argv[0], " arg ?arg ...?\"", NULL);
370 +    return TCL_ERROR;
371 +  }
372 +
373 +  Context;
374 +
375 +  noshare = 1;
376 +
377 +  x = Tcl_Merge(argc - 1, argv + 1);
378 +  res = Tcl_Eval(irp, x);
379 +  Tcl_Free((char *) x);
380 +
381 +  noshare = 0;
382 +
383 +  Context;
384 +  return res;
385 +}
386 +
387 +
388 +static tcl_cmds my_tclcmds[] =
389 +{
390 +  {"noshare", tcl_noshare},
391 +  {NULL,      NULL}
392 +};
393 +
394  static char *share_close()
395  {
396    int i;
397 @@ -2094,6 +2142,7 @@
398    delay_free_mem();
399    rem_tcl_ints(my_ints);
400    rem_tcl_strings(my_strings);
401 +  rem_tcl_commands(my_tclcmds);
402    rem_builtins(H_dcc, my_cmds);
403    rem_help_reference("share.help");
404    return NULL;
405 @@ -2213,6 +2262,7 @@
406    DCC_BOT.kill = cancel_user_xfer;
407    add_tcl_ints(my_ints);
408    add_tcl_strings(my_strings);
409 +  add_tcl_commands(my_tclcmds);
410    add_builtins(H_dcc, my_cmds);
411    uff_init();
412    uff_addtable(internal_uff_table);
413 @@ -2226,3 +2276,11 @@
414    break_down_flags(private_globals, &fr, 0);
415    return fr.global;
416  }
417 +
418 +int private_chanflags_bitmask()
419 +{
420 +       struct flag_record fr = {FR_CHAN, 0, 0, 0, 0, 0};
421 +
422 +       break_down_flags(private_chanflags, &fr, 0);
423 +       return fr.chan;
424 +}
425 diff -burN eggdrop1.6.17.orig/src/mod/share.mod/share.h eggdrop1.6.17/src/mod/share.mod/share.h
426 --- eggdrop1.6.17.orig/src/mod/share.mod/share.h        2004-11-01 12:48:53.000000000 +0100
427 +++ eggdrop1.6.17/src/mod/share.mod/share.h     2004-11-01 14:21:10.583858344 +0100
428 @@ -52,6 +52,11 @@
429                               * `priority'.                                   */
430  } uff_table_t;
431  
432 +/* Do we allow hub to change user value <TaKeDa> */
433 +#define PERMIT_HUB(x) (permit_hub && (dcc[x].status & STAT_AGGRESSIVE))
434 +/* Is user protected and if he is do we allow changes? <TaKeDa> */
435 +#define IS_USER_PROTECTED(user,idx) (!(dcc[idx].status & STAT_AGGRESSIVE) && (user->flags & USER_PROTECTED))
436 +
437  #ifndef MAKING_SHARE
438  /* 4 - 7 */
439  #define finish_share ((void (*) (int))share_funcs[4])
440 diff -burN eggdrop1.6.17.orig/src/patch.h eggdrop1.6.17/src/patch.h
441 --- eggdrop1.6.17.orig/src/patch.h      2004-11-01 12:48:53.000000000 +0100
442 +++ eggdrop1.6.17/src/patch.h   2004-11-01 14:21:10.584858192 +0100
443 @@ -36,7 +36,7 @@
444   *
445   *
446   */
447 -/* PATCH GOES HERE */
448 +patch("multilevel_sharing");
449  /*
450   *
451   *
This page took 0.104961 seconds and 3 git commands to generate.