@@ -33,6 +33,26 @@ def mode_cmd_no_target(mode, text, text_inp, chan, conn, notice, nick, admin_log
3333 conn .send ("MODE {} {}" .format (channel , mode ))
3434
3535
36+ def do_extban (char , text , text_inp , chan , conn , notice , nick , admin_log , adding = True ):
37+ serv_info = conn .memory ["server_info" ]
38+ if char not in serv_info .get ("extbans" , "" ):
39+ return False
40+
41+ extban_pfx = serv_info ["extban_prefix" ]
42+
43+ split = text_inp .split (" " )
44+ if split [0 ].startswith ("#" ):
45+ channel = split [0 ]
46+ target = split [1 ]
47+ text_inp = "{} {}{}:{}" .format (channel , extban_pfx , char , target )
48+ else :
49+ target = split [0 ]
50+ text_inp = "{}{}:{}" .format (extban_pfx , char , target )
51+
52+ mode_cmd ("+b" if adding else "-b" , text , text_inp , chan , conn , notice , nick , admin_log )
53+ return True
54+
55+
3656@hook .command (permissions = ["op_ban" , "op" ])
3757def ban (text , conn , chan , notice , nick , admin_log ):
3858 """[channel] <user> - bans <user> in [channel], or in the caller's channel if no channel is specified"""
@@ -48,21 +68,23 @@ def unban(text, conn, chan, notice, nick, admin_log):
4868@hook .command (permissions = ["op_quiet" , "op" ])
4969def quiet (text , conn , chan , notice , nick , admin_log ):
5070 """[channel] <user> - quiets <user> in [channel], or in the caller's channel if no channel is specified"""
51- if conn .name == "snoonet" :
52- out = "mode {} +b m:{}" .format (chan , text )
53- conn .send (out )
54- return
55- mode_cmd ("+q" , "quiet" , text , chan , conn , notice , nick , admin_log )
71+ serv_info = conn .memory ["server_info" ]
72+ if 'q' in serv_info .get ("channel_modes" , "" ):
73+ return mode_cmd ("+q" , "quiet" , text , chan , conn , notice , nick , admin_log )
74+
75+ if not do_extban ('m' , "quiet" , text , chan , conn , notice , nick , admin_log , True ):
76+ notice ("Unable to set +q or a mute extban on this network." )
5677
5778
5879@hook .command (permissions = ["op_quiet" , "op" ])
5980def unquiet (text , conn , chan , notice , nick , admin_log ):
6081 """[channel] <user> - unquiets <user> in [channel], or in the caller's channel if no channel is specified"""
61- if conn .name == "snoonet" :
62- out = "mode {} -b m:{}" .format (chan , text )
63- conn .send (out )
64- return
65- mode_cmd ("-q" , "unquiet" , text , chan , conn , notice , nick , admin_log )
82+ serv_info = conn .memory ["server_info" ]
83+ if 'q' in serv_info .get ("channel_modes" , "" ):
84+ return mode_cmd ("-q" , "unquiet" , text , chan , conn , notice , nick , admin_log )
85+
86+ if not do_extban ('m' , "unquiet" , text , chan , conn , notice , nick , admin_log , False ):
87+ notice ("Unable to unset +q or a mute extban on this network." )
6688
6789
6890@hook .command (permissions = ["op_voice" , "op" ])
0 commit comments