]> git.pld-linux.org Git - packages/eggdrop.git/blob - eggdrop-multilevel_sharing.patch
- refresh config.sub
[packages/eggdrop.git] / eggdrop-multilevel_sharing.patch
1 diff -burN eggdrop1.6.15/doc/USERS eggdrop1.6.15-multilevel_sharing/doc/USERS
2 --- eggdrop1.6.15/doc/USERS     Mon May  5 00:05:32 2003
3 +++ eggdrop1.6.15-multilevel_sharing/doc/USERS  Fri May  9 18:44:33 2003
4 @@ -75,6 +75,11 @@
5  
6      u  (unshared)       user record is not sent to other bots.
7  
8 +    s  (protected)      is working similar like u flag, but changes can be made
9 +                        only from bot that is aggressively sharing with us (Hub).
10 +                        User cannot be changed by bot that is connected below
11 +                        this bot. (This flag can be useful in multilevel sharing)
12 +
13      h  (highlight)      use bold text in help/text files.
14  
15      All global flags other then u, h, b, c, x, j, and p are also
16 diff -burN eggdrop1.6.15/doc/tcl-commands.doc eggdrop1.6.15-multilevel_sharing/doc/tcl-commands.doc
17 --- eggdrop1.6.15/doc/tcl-commands.doc  Mon May  5 00:05:32 2003
18 +++ eggdrop1.6.15-multilevel_sharing/doc/tcl-commands.doc       Fri May  9 18:44:33 2003
19 @@ -1245,6 +1245,17 @@
20      Module: filesys
21  
22  
23 +
24 +***### SHARE MODULE COMMANDS ###***
25 +
26 +  noshare <command> [<arg1> <arg2> ...]
27 +    Description: executes command with setting noshare = 1 in code,
28 +      that means, if you i.e. do chattr using this command,
29 +      bot will make changes on his userlist, but won't send changes
30 +      to other bots. This is useful in some situations.
31 +    Returns: whatever is returned by <command>
32 +    Module: share
33 +
34  *** MISCELLANEOUS COMMANDS ***
35  
36    bind <type> <flags> <keyword/mask> [proc-name]
37 diff -burN eggdrop1.6.15/eggdrop.conf eggdrop1.6.15-multilevel_sharing/eggdrop.conf
38 --- eggdrop1.6.15/eggdrop.conf  Mon May  5 00:05:32 2003
39 +++ eggdrop1.6.15-multilevel_sharing/eggdrop.conf       Fri May  9 18:44:33 2003
40 @@ -1139,11 +1139,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.15/help/cmds2.help eggdrop1.6.15-multilevel_sharing/help/cmds2.help
63 --- eggdrop1.6.15/help/cmds2.help       Mon May  5 00:05:32 2003
64 +++ eggdrop1.6.15-multilevel_sharing/help/cmds2.help    Fri May  9 18:44:33 2003
65 @@ -336,6 +336,7 @@
66        p   party-line (user has access to the partyline)
67        q   global quiet (user does not get voice on +autovoice channels.)
68        r   global dehalfop (user cannot gain halfops on any of the bot's channels)
69 +      s   protected (when sharing changes can be made only by hub)
70        t   botnet master (user has access to all features dealing with the botnet.)
71        u   unshared (user record is not sent to other bots.)
72        v   global voice (user get +v automatically on +autovoice channels)
73 diff -burN eggdrop1.6.15/src/cmds.c eggdrop1.6.15-multilevel_sharing/src/cmds.c
74 --- eggdrop1.6.15/src/cmds.c    Mon May  5 00:05:32 2003
75 +++ eggdrop1.6.15-multilevel_sharing/src/cmds.c Fri May  9 18:46:00 2003
76 @@ -1556,8 +1556,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.15/src/flags.h eggdrop1.6.15-multilevel_sharing/src/flags.h
88 --- eggdrop1.6.15/src/flags.h   Mon May  5 00:05:32 2003
89 +++ eggdrop1.6.15-multilevel_sharing/src/flags.h        Fri May  9 18:48:57 2003
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.15/src/mod/share.mod/Makefile eggdrop1.6.15-multilevel_sharing/src/mod/share.mod/Makefile
128 --- eggdrop1.6.15/src/mod/share.mod/Makefile    Mon May  5 00:05:33 2003
129 +++ eggdrop1.6.15-multilevel_sharing/src/mod/share.mod/Makefile Fri May  9 18:49:41 2003
130 @@ -20,7 +20,7 @@
131         mv share.o ../
132  
133  ../../../share.$(MOD_EXT): ../share.o
134 -       $(LD) -o ../../../share.$(MOD_EXT) ../share.o
135 +       $(LD) -o ../../../share.$(MOD_EXT) ../share.o ${XLIBS}
136         $(STRIP) ../../../share.$(MOD_EXT)
137  
138  depend:
139 diff -burN eggdrop1.6.15/src/mod/share.mod/share.c eggdrop1.6.15-multilevel_sharing/src/mod/share.mod/share.c
140 --- eggdrop1.6.15/src/mod/share.mod/share.c     Mon May  5 00:05:33 2003
141 +++ eggdrop1.6.15-multilevel_sharing/src/mod/share.mod/share.c  Fri May  9 19:10:34 2003
142 @@ -50,11 +50,14 @@
143  static int private_global = 0;
144  static int private_user = 0;
145  static char private_globals[50];
146 +static char private_chanflags[50];
147  static int allow_resync = 0;
148  static struct flag_record fr = { 0, 0, 0, 0, 0, 0 };
149  static int resync_time = 900;
150  static int overr_local_bots = 0;        /* Override local bots?             */
151  
152 +static int permit_hub = 0; /* Permit hub to do changes even, when we use private_*, */
153 +                           /* but not private_globals (this have a reason) */
154  
155  struct delay_mode {
156    struct delay_mode *next;
157 @@ -93,6 +96,7 @@
158  static void q_resync(char *, struct chanset_t *);
159  static void cancel_user_xfer(int, void *);
160  static int private_globals_bitmask();
161 +static int private_chanflags_bitmask();
162  
163  #include "share.h"
164  
165 @@ -307,7 +311,7 @@
166    char *hand;
167    struct userrec *u;
168  
169 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
170 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
171      hand = newsplit(&par);
172      u = get_user_by_handle(userlist, hand);
173      if (u && !(u->flags & USER_UNSHARED)) {
174 @@ -329,26 +333,33 @@
175    int bfl, ofl;
176    module_entry *me;
177  
178 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
179 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
180      hand = newsplit(&par);
181      u = get_user_by_handle(userlist, hand);
182 -    if (u && !(u->flags & USER_UNSHARED)) {
183 +    if (u && !(u->flags & USER_UNSHARED) && !IS_USER_PROTECTED(u, idx)) {
184        atr = newsplit(&par);
185        cst = findchan_by_dname(par);
186        if (!par[0] || (cst && channel_shared(cst))) {
187 -        if (!(dcc[idx].status & STAT_GETTING) && (cst || !private_global))
188 -          shareout_but(cst, idx, "a %s %s %s\n", hand, atr, par);
189          noshare = 1;
190          if (par[0] && cst) {
191 +         int pchbm = 0;
192 +         if (!PERMIT_HUB(idx))
193 +               pchbm = private_chanflags_bitmask();
194            fr.match = (FR_CHAN | FR_BOT);
195 +         /* bot's sharing flags */
196            get_user_flagrec(dcc[idx].user, &fr, par);
197            if (bot_chan(fr) || bot_global(fr)) {
198              fr.match = FR_CHAN;
199              fr2.match = FR_CHAN;
200              break_down_flags(atr, &fr, 0);
201              get_user_flagrec(u, &fr2, par);
202 -            fr.chan = (fr2.chan & BOT_AGGRESSIVE) |
203 -                      (fr.chan & ~BOT_AGGRESSIVE);
204 +            fr.chan = (fr2.chan & BOT_AGGRESSIVE) | (fr.chan & ~BOT_AGGRESSIVE);
205 +           /* Checking for forced flags */
206 +           if ( (pchbm & USER_OWNER) && chan_owner(fr) && !chan_owner(fr2))
207 +                   fr.chan &= ~(USER_MASTER | USER_OP);
208 +           else if ( (pchbm & USER_MASTER) && chan_master(fr) && !chan_master(fr2))
209 +                   fr.chan &= ~USER_OP;
210 +           fr.chan = (fr2.chan & pchbm) | (fr.chan & ~pchbm);
211              set_user_flagrec(u, &fr, par);
212              check_dcc_chanattrs(u, par, fr.chan, fr2.chan);
213              noshare = 0;
214 @@ -365,7 +376,7 @@
215              putlog(LOG_CMDS, "*",
216                     "Rejected flags for unshared channel %s from %s",
217                     par, dcc[idx].nick);
218 -        } else if (!private_global) {
219 +       } else if (!private_global || PERMIT_HUB(idx)) {
220            int pgbm = private_globals_bitmask();
221  
222            /* Don't let bot flags be altered */
223 @@ -384,15 +395,17 @@
224            if (!(dcc[idx].status & STAT_GETTING))
225              putlog(LOG_CMDS, "*", "%s: chattr %s %s", dcc[idx].nick, hand, s);
226            if ((me = module_find("irc", 0, 0))) {
227 +           struct chanset_t *tmpcst;
228              Function *func = me->funcs;
229 -
230 -            for (cst = chanset; cst; cst = cst->next)
231 -              (func[IRC_RECHECK_CHANNEL]) (cst, 0);
232 +            for (tmpcst = chanset; tmpcst; tmpcst = tmpcst->next)
233 +               (func[IRC_RECHECK_CHANNEL]) (tmpcst, 0);
234            }
235          } else
236            putlog(LOG_CMDS, "*", "Rejected global flags for %s from %s",
237                   hand, dcc[idx].nick);
238          noshare = 0;
239 +       if (!(dcc[idx].status & STAT_GETTING) && (cst || !private_global || PERMIT_HUB(idx)))
240 +               shareout_but(cst, idx, "a %s %s %s\n", hand, s, par);
241        }
242      }
243    }
244 @@ -404,7 +417,7 @@
245    struct chanset_t *chan;
246    struct userrec *u;
247  
248 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
249 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
250      user = newsplit(&par);
251      if ((u = get_user_by_handle(userlist, user))) {
252        chan = findchan_by_dname(par);
253 @@ -433,7 +446,7 @@
254    struct chanset_t *chan;
255    struct userrec *u;
256  
257 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
258 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
259      user = newsplit(&par);
260      if ((u = get_user_by_handle(userlist, user))) {
261        chan = findchan_by_dname(par);
262 @@ -459,13 +472,13 @@
263    char *nick, *host, *pass, s[100];
264    struct userrec *u;
265  
266 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
267 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
268      nick = newsplit(&par);
269      host = newsplit(&par);
270      pass = newsplit(&par);
271  
272      if (!(u = get_user_by_handle(userlist, nick)) ||
273 -        !(u->flags & USER_UNSHARED)) {
274 +        !((u->flags & USER_UNSHARED) || IS_USER_PROTECTED(u, idx))) {
275        fr.global = 0;
276  
277        fr.match = FR_GLOBAL;
278 @@ -510,9 +523,9 @@
279    struct userrec *u;
280  
281    /* If user is a share bot, ignore command */
282 -  if ((dcc[idx].status & STAT_SHARE) && !private_user &&
283 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx)) &&
284        (u = get_user_by_handle(userlist, par)) &&
285 -      !(u->flags & USER_UNSHARED) &&
286 +      !(u->flags & USER_UNSHARED) && !IS_USER_PROTECTED(u, idx) &&
287        !((u->flags & USER_BOT) && (bot_flags(u) & BOT_SHARE))) {
288      noshare = 1;
289      if (deluser(par)) {
290 @@ -528,10 +541,10 @@
291    char *hand;
292    struct userrec *u;
293  
294 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
295 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
296      hand = newsplit(&par);
297      if ((u = get_user_by_handle(userlist, hand)) &&
298 -        !(u->flags & USER_UNSHARED)) {
299 +        !(u->flags & USER_UNSHARED) && !IS_USER_PROTECTED(u, idx)) {
300        shareout_but(NULL, idx, "+h %s %s\n", hand, par);
301        set_user(&USERENTRY_HOSTS, u, par);
302        putlog(LOG_CMDS, "*", "%s: +host %s %s", dcc[idx].nick, hand, par);
303 @@ -544,10 +557,10 @@
304    char *hand, p[32];
305    struct userrec *u;
306  
307 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
308 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
309      hand = newsplit(&par);
310      if (!(u = get_user_by_handle(userlist, hand)) ||
311 -        !(u->flags & USER_UNSHARED)) {
312 +        !((u->flags & USER_UNSHARED) || IS_USER_PROTECTED(u, idx))) {
313        if (!(dcc[idx].status & STAT_GETTING))
314          shareout_but(NULL, idx, "+bh %s %s\n", hand, par);
315        /* Add bot to userlist if not there */
316 @@ -570,10 +583,10 @@
317    char *hand;
318    struct userrec *u;
319  
320 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
321 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
322      hand = newsplit(&par);
323      if ((u = get_user_by_handle(userlist, hand)) &&
324 -        !(u->flags & USER_UNSHARED)) {
325 +        !(u->flags & USER_UNSHARED) && !IS_USER_PROTECTED(u, idx)) {
326        shareout_but(NULL, idx, "-h %s %s\n", hand, par);
327        noshare = 1;
328        delhost_by_handle(hand, par);
329 @@ -590,11 +603,11 @@
330    struct user_entry_type *uet;
331    struct user_entry *e;
332  
333 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
334 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
335      key = newsplit(&par);
336      hand = newsplit(&par);
337      if (!(u = get_user_by_handle(userlist, hand)) ||
338 -        !(u->flags & USER_UNSHARED)) {
339 +        !((u->flags & USER_UNSHARED) || IS_USER_PROTECTED(u,idx))) {
340        if (!(uet = find_entry_type(key)))
341          /* If it's not a supported type, forget it */
342          debug2("Ignore ch %s from %s (unknown type)", key, dcc[idx].nick);
343 @@ -638,10 +651,10 @@
344    struct chanset_t *cst;
345    struct userrec *u;
346  
347 -  if ((dcc[idx].status & STAT_SHARE) && !private_user) {
348 +  if ((dcc[idx].status & STAT_SHARE) && (!private_user || PERMIT_HUB(idx))) {
349      hand = newsplit(&par);
350      if ((u = get_user_by_handle(userlist, hand)) &&
351 -        !(u->flags & USER_UNSHARED) && share_greet) {
352 +        !(u->flags & USER_UNSHARED) && !IS_USER_PROTECTED(u, idx) && share_greet) {
353        chan = newsplit(&par);
354        cst = findchan_by_dname(chan);
355        fr.match = (FR_CHAN | FR_BOT);
356 @@ -2033,11 +2046,13 @@
357    {"private-global",  &private_global},
358    {"private-user",      &private_user},
359    {"override-bots", &overr_local_bots},
360 +  {"permit-hub",          &permit_hub},
361    {NULL,                         NULL}
362  };
363  
364  static tcl_strings my_strings[] = {
365    {"private-globals", private_globals, 50, 0},
366 +  {"private-chanflags", private_chanflags, 50, 0},
367    {NULL,              NULL,            0,  0}
368  };
369  
370 @@ -2056,6 +2071,39 @@
371    {NULL,    NULL, NULL,                 NULL}
372  };
373  
374 +static int tcl_noshare STDVAR
375 +{
376 +  int res;
377 +  char *x;
378 +
379 +  if (argc < 2) {
380 +    Tcl_AppendResult(irp, "wrong # args: should be \"",
381 +    argv[0], " arg ?arg ...?\"", NULL);
382 +    return TCL_ERROR;
383 +  }
384 +
385 +  Context;
386 +
387 +  noshare = 1;
388 +
389 +  x = Tcl_Merge(argc - 1, argv + 1);
390 +  res = Tcl_Eval(irp, x);
391 +  Tcl_Free((char *) x);
392 +
393 +  noshare = 0;
394 +
395 +  Context;
396 +  return res;
397 +}
398 +
399 +
400 +static tcl_cmds my_tclcmds[] =
401 +{
402 +  {"noshare", tcl_noshare},
403 +  {NULL,      NULL}
404 +};
405 +
406 +
407  static char *share_close()
408  {
409    int i;
410 @@ -2088,6 +2136,7 @@
411    delay_free_mem();
412    rem_tcl_ints(my_ints);
413    rem_tcl_strings(my_strings);
414 +  rem_tcl_commands(my_tclcmds);
415    rem_builtins(H_dcc, my_cmds);
416    rem_help_reference("share.help");
417    return NULL;
418 @@ -2207,6 +2256,7 @@
419    DCC_BOT.kill = cancel_user_xfer;
420    add_tcl_ints(my_ints);
421    add_tcl_strings(my_strings);
422 +  add_tcl_commands(my_tclcmds);
423    add_builtins(H_dcc, my_cmds);
424    uff_init();
425    uff_addtable(internal_uff_table);
426 @@ -2220,3 +2270,11 @@
427    break_down_flags(private_globals, &fr, 0);
428    return fr.global;
429  }
430 +
431 +int private_chanflags_bitmask()
432 +{
433 +       struct flag_record fr = {FR_CHAN, 0, 0, 0, 0, 0};
434 +
435 +       break_down_flags(private_chanflags, &fr, 0);
436 +       return fr.chan;
437 +}
438 diff -burN eggdrop1.6.15/src/mod/share.mod/share.h eggdrop1.6.15-multilevel_sharing/src/mod/share.mod/share.h
439 --- eggdrop1.6.15/src/mod/share.mod/share.h     Mon May  5 00:05:33 2003
440 +++ eggdrop1.6.15-multilevel_sharing/src/mod/share.mod/share.h  Fri May  9 19:11:25 2003
441 @@ -52,6 +52,11 @@
442                               * `priority'.                                   */
443  } uff_table_t;
444  
445 +/* Do we allow hub to change user value <TaKeDa> */
446 +#define PERMIT_HUB(x) (permit_hub && (dcc[x].status & STAT_AGGRESSIVE))
447 +/* Is user protected and if he is do we allow changes? <TaKeDa> */
448 +#define IS_USER_PROTECTED(user,idx) (!(dcc[idx].status & STAT_AGGRESSIVE) && (user->flags & USER_PROTECTED))
449 +
450  #ifndef MAKING_SHARE
451  /* 4 - 7 */
452  #define finish_share ((void (*) (int))share_funcs[4])
453 diff -burN eggdrop1.6.15/src/patch.h eggdrop1.6.15-multilevel_sharing/src/patch.h
454 --- eggdrop1.6.15/src/patch.h   Mon May  5 00:08:01 2003
455 +++ eggdrop1.6.15-multilevel_sharing/src/patch.h        Fri May  9 19:11:50 2003
456 @@ -36,7 +36,7 @@
457   *
458   *
459   */
460 -/* PATCH GOES HERE */
461 +patch("multilevel_sharing");
462  /*
463   *
464   *
This page took 0.08472 seconds and 3 git commands to generate.