def _redispatch_kick(message): kicker = get_user(message.source) channel, kickee, reason = get_channel(message.params[0]), get_user( message.params[1]), message.params[2] signal("kick").send(message, kicker=kicker, kickee=kickee, channel=channel, reason=reason)
def _parse_mode(message): # :ChanServ!ChanServ@services. MODE ##fwilson +o fwilson argument_modes = "".join( message.client.server_supports["CHANMODES"].split(",")[:-1]) argument_modes += message.client.server_supports["PREFIX"].split( ")")[0][1:] user = get_user(message.source) channel = message.params[0] modes = message.params[1] args = message.params[2:] flag = "+" for mode in modes: if mode in "+-": flag = mode continue if mode in argument_modes: arg = args.pop(0) else: arg = None signal("{}mode".format(flag)).send(message, mode=mode, arg=arg, user=user, channel=channel) signal("mode {}{}".format(flag, mode)).send(message, arg=arg, user=user, channel=channel)
def _redispatch_message_common(message, mtype): target, text = message.params[0], message.params[1] user = get_user(message.source) signal(mtype).send(message, user=user, target=target, text=text) if target == message.client.nickname: signal("private-{}".format(mtype)).send(message, user=user, target=target, text=text) else: signal("public-{}".format(mtype)).send(message, user=user, target=target, text=text)
def _redispatch_message_common(message, type): target, text = get_target(message.params[0]), message.params[1] user = get_user(message.source) signal(type).send(message, user=user, target=target, text=text) if target == message.client.nickname: signal("private-{}".format(type)).send(message, user=user, target=target, text=text) else: signal("public-{}".format(type)).send(message, user=user, target=target, text=text)
def _parse_mode(message): # :ChanServ!ChanServ@services. MODE ##fwilson +o fwilson argument_modes = "".join(message.client.server_supports["CHANMODES"].split(",")[:-1]) argument_modes += message.client.server_supports["PREFIX"].split(")")[0][1:] user = get_user(message.source) channel = message.params[0] modes = message.params[1] args = message.params[2:] flag = "+" for mode in modes: if mode in "+-": flag = mode continue if mode in argument_modes: arg = args.pop(0) else: arg = None signal("{}mode".format(flag)).send(message, mode=mode, arg=arg, user=user, channel=channel) signal("mode {}{}".format(flag, mode)).send(message, arg=arg, user=user, channel=channel)
def _redispatch_nick(message): old_user = get_user(message.source) new_nick = message.params[0] if old_user.nick == message.client.nickname: message.client.nickname = new_nick signal("nick").send(message, user=old_user, new_nick=new_nick)
def _redispatch_quit(message): user = get_user(message.source) reason = message.params[0] signal("quit").send(message, user=user, reason=reason)
def _redispatch_part(message): user = get_user(message.source) channel, reason = get_channel(message.params[0]), None if len(message.params) > 1: reason = message.params[1] signal("part").send(message, user=user, channel=channel, reason=reason)
def _redispatch_join(message): user = get_user(message.source) channel = get_channel(message.params[0]) signal("join").send(message, user=user, channel=channel)
def _redispatch_join(message): signal("join").send(message, user=get_user(message.source), channel=message.params[0])
def _redispatch_kick(message): kicker = get_user(message.source) channel, kickee, reason = get_channel(message.params[0]), get_user(message.params[1]), message.params[2] signal("kick").send(message, kicker=kicker, kickee=kickee, channel=channel, reason=reason)