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
6 u (unshared) user record is not sent to other bots.
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)
13 h (highlight) use bold text in help/text files.
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 @@
24 +***### SHARE MODULE COMMANDS ###***
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>
34 *** MISCELLANEOUS COMMANDS ***
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"
44 +# When sharing user lists, which channel flags changes from other bots
46 +#set private-chanflags "mn"
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.
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
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
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
77 mns.chan &= ~(BOT_SHARE);
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);
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
94 - * abcdefgh?jklmnopqr?tuvwxyz + user defined A-Z
95 - * unused letters: is
96 + * abcdefgh?jklmnopqrstuvwxyz + user defined A-Z
100 * 0123456789ab????ghi??l???p?rs???????
102 * a??defg???klmno?qr??uv??yz + user defined A-Z
103 * unused letters: bchijpstwx
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 */
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 */
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)
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
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)
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
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? */
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) */
156 struct delay_mode *next;
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();
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 @@
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);
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)) {
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);
215 putlog(LOG_CMDS, "*",
216 "Rejected flags for unshared channel %s from %s",
218 - } else if (!private_global) {
219 + } else if (!private_global || PERMIT_HUB(idx)) {
220 int pgbm = private_globals_bitmask();
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;
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);
236 putlog(LOG_CMDS, "*", "Rejected global flags for %s from %s",
237 hand, dcc[idx].nick);
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);
245 struct chanset_t *chan;
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);
254 struct chanset_t *chan;
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];
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);
272 if (!(u = get_user_by_handle(userlist, nick)) ||
273 - !(u->flags & USER_UNSHARED)) {
274 + !((u->flags & USER_UNSHARED) || IS_USER_PROTECTED(u, idx))) {
277 fr.match = FR_GLOBAL;
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))) {
290 @@ -528,10 +541,10 @@
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 @@
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 @@
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);
328 delhost_by_handle(hand, par);
329 @@ -590,11 +603,11 @@
330 struct user_entry_type *uet;
331 struct user_entry *e;
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;
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},
364 static tcl_strings my_strings[] = {
365 {"private-globals", private_globals, 50, 0},
366 + {"private-chanflags", private_chanflags, 50, 0},
370 @@ -2056,6 +2071,39 @@
371 {NULL, NULL, NULL, NULL}
374 +static int tcl_noshare STDVAR
380 + Tcl_AppendResult(irp, "wrong # args: should be \"",
381 + argv[0], " arg ?arg ...?\"", NULL);
389 + x = Tcl_Merge(argc - 1, argv + 1);
390 + res = Tcl_Eval(irp, x);
391 + Tcl_Free((char *) x);
400 +static tcl_cmds my_tclcmds[] =
402 + {"noshare", tcl_noshare},
407 static char *share_close()
410 @@ -2088,6 +2136,7 @@
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");
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);
425 uff_addtable(internal_uff_table);
426 @@ -2220,3 +2270,11 @@
427 break_down_flags(private_globals, &fr, 0);
431 +int private_chanflags_bitmask()
433 + struct flag_record fr = {FR_CHAN, 0, 0, 0, 0, 0};
435 + break_down_flags(private_chanflags, &fr, 0);
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
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))
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
460 -/* PATCH GOES HERE */
461 +patch("multilevel_sharing");