i broke quieting when i was refactoring it
This commit is contained in:
parent
c7e3e42728
commit
ad04357955
1 changed files with 11 additions and 8 deletions
|
@ -211,7 +211,8 @@ class Module(ModuleManager.BaseModule):
|
||||||
@utils.kwarg("help", "Quiet a given user")
|
@utils.kwarg("help", "Quiet a given user")
|
||||||
@utils.spec("!<#channel>r~channel ?duration !<nickname>user|<mask>word")
|
@utils.spec("!<#channel>r~channel ?duration !<nickname>user|<mask>word")
|
||||||
def quiet(self, event):
|
def quiet(self, event):
|
||||||
self._quiet(event["server"], True, event["spec"])
|
self._quiet(event["server"], event["spec"][0], event["spec"][2], True,
|
||||||
|
event["spec"][1])
|
||||||
|
|
||||||
@utils.hook("received.command.unquiet")
|
@utils.hook("received.command.unquiet")
|
||||||
@utils.hook("received.command.unmute")
|
@utils.hook("received.command.unmute")
|
||||||
|
@ -220,26 +221,28 @@ class Module(ModuleManager.BaseModule):
|
||||||
@utils.kwarg("help", "Unquiet a given user")
|
@utils.kwarg("help", "Unquiet a given user")
|
||||||
@utils.spec("!<#channel>r~channel !<nickname>user|<mask>word")
|
@utils.spec("!<#channel>r~channel !<nickname>user|<mask>word")
|
||||||
def unquiet(self, event):
|
def unquiet(self, event):
|
||||||
self._quiet(event["server"], False, event["spec"])
|
self._quiet(event["server"], event["spec"][0], event["spec"][1], False,
|
||||||
|
None)
|
||||||
|
|
||||||
def _quiet(self, server, add, spec):
|
def _quiet(self, server, channel, target, add, time):
|
||||||
quiet_method = self._quiet_method(server)
|
quiet_method = self._quiet_method(server)
|
||||||
|
|
||||||
if quiet_method == None:
|
if quiet_method == None:
|
||||||
raise utils.EventError(NO_QUIETS)
|
raise utils.EventError(NO_QUIETS)
|
||||||
|
|
||||||
mode, prefix, _, _ = quiet_method
|
mode, prefix, _, _ = quiet_method
|
||||||
mask = spec[1][1]
|
if target[0] == "word":
|
||||||
if spec[1][0] == "user":
|
mask = target[1]
|
||||||
mask = self._get_hostmask(spec[0], spec[1][1])
|
else:
|
||||||
|
mask = self._get_hostmask(channel, target[1])
|
||||||
mask = "%s%s" % (prefix, mask)
|
mask = "%s%s" % (prefix, mask)
|
||||||
|
|
||||||
if add and time:
|
if add and time:
|
||||||
self.timers.add_persistent("unmode", time, channel=spec[0].id,
|
self.timers.add_persistent("unmode", time, channel=channel.id,
|
||||||
mode=mode, arg=mask)
|
mode=mode, arg=mask)
|
||||||
|
|
||||||
mode_modifier = "+" if add else "-"
|
mode_modifier = "+" if add else "-"
|
||||||
spec[0].send_mode("%s%s" % (mode_modifier, mode), [mask])
|
channel.send_mode("%s%s" % (mode_modifier, mode), [mask])
|
||||||
|
|
||||||
@utils.hook("received.command.invite")
|
@utils.hook("received.command.invite")
|
||||||
@utils.kwarg("require_mode", "o")
|
@utils.kwarg("require_mode", "o")
|
||||||
|
|
Loading…
Reference in a new issue