]>
jfr.im git - solanum.git/blob - extensions/extb_canjoin.c
2 * Canjoin extban type: matches users who are or are not banned from a
14 static const char extb_desc
[] = "Can join ($j) extban type - matches users who are or are not banned from a specified channel";
16 static int _modinit(void);
17 static void _moddeinit(void);
18 static int eb_canjoin(const char *data
, struct Client
*client_p
, struct Channel
*chptr
, long mode_type
);
20 DECLARE_MODULE_AV2(extb_canjoin
, _modinit
, _moddeinit
, NULL
, NULL
, NULL
, NULL
, NULL
, extb_desc
);
25 extban_table
['j'] = eb_canjoin
;
33 extban_table
['j'] = NULL
;
36 static int eb_canjoin(const char *data
, struct Client
*client_p
,
37 struct Channel
*chptr
, long mode_type
)
39 struct Channel
*chptr2
;
41 static int recurse
= 0;
44 /* don't process a $j in a $j'ed list */
46 return EXTBAN_INVALID
;
48 return EXTBAN_INVALID
;
49 if (mode_type
== CHFL_EXCEPTION
)
50 return EXTBAN_INVALID
;
51 chptr2
= find_channel(data
);
52 /* must exist, and no point doing this with the same channel */
53 if (chptr2
== NULL
|| chptr2
== chptr
)
54 return EXTBAN_INVALID
;
55 /* require consistent target */
56 if (chptr
->chname
[0] == '#' && data
[0] == '&')
57 return EXTBAN_INVALID
;
58 /* this allows getting some information about ban exceptions
59 * but +s/+p doesn't seem the right criterion */
61 /* privacy! don't allow +s/+p channels to influence another channel */
62 if (!PubChannel(chptr2
))
63 return EXTBAN_INVALID
;
66 ret
= is_banned(chptr2
, client_p
, NULL
, NULL
, NULL
) != 0 ? EXTBAN_MATCH
: EXTBAN_NOMATCH
;