diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2011-08-21 13:48:56 +0200 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2011-08-21 16:02:29 +0200 |
commit | 29e494a9f59d651c731816f09664463beae473f4 (patch) | |
tree | 1a1a27bc682e9b62f6178e5705c2dfb4344d0472 /miniircd | |
parent | 894ecd929c1af469906e4acd0c40767e6db232ec (diff) | |
download | miniircd-29e494a9f59d651c731816f09664463beae473f4.tar.gz miniircd-29e494a9f59d651c731816f09664463beae473f4.zip |
Let message_channel always include the prefix
Diffstat (limited to 'miniircd')
-rwxr-xr-x | miniircd | 42 |
1 files changed, 11 insertions, 31 deletions
@@ -177,10 +177,7 @@ class Client(object): return if arguments[0] == "0": for (channelname, channel) in self.channels.items(): - self.message_channel( - channel, - ":%s PART %s" % (self.prefix, channelname), - True) + self.message_channel(channel, "PART", channelname, True) self.channel_log(channel, "left", meta=True) server.remove_member_from_channel(self, channelname) self.channels = {} @@ -196,9 +193,7 @@ class Client(object): channel = server.get_channel(channelname) self.channels[irc_lower(channelname)] = channel self.message_channel( - channel, - ":%s JOIN %s" % (self.prefix, channelname), - True) + channel, "JOIN", channelname, True) self.channel_log(channel, "joined", meta=True) if channel.topic: self.reply( @@ -279,11 +274,8 @@ class Client(object): self.nickname = newnick server.client_changed_nickname(self, oldnickname) self.message_related( - ":%s!%s@%s NICK %s" % ( - oldnickname, - self.user, - self.host, - self.nickname), + ":%s!%s@%s NICK %s" + % (oldnickname, self.user, self.host, self.nickname), True) def notice_and_privmsg_handler(): @@ -297,18 +289,13 @@ class Client(object): message = arguments[1] client = server.get_client(targetname) if client: - client.message(":%s %s %s :%s" % ( - self.prefix, - command, - targetname, - message)) + client.message(":%s %s %s :%s" + % (self.prefix, command, targetname, message)) else: channel = server.get_channel(targetname) if channel: self.message_channel( - channel, - ":%s %s %s :%s" - % (self.prefix, command, channel.name, message)) + channel, command, "%s :%s" % (channel.name, message)) self.channel_log(channel, message) else: self.reply("401 %s %s :No such nick/channel" @@ -332,11 +319,7 @@ class Client(object): else: channel = self.channels[irc_lower(channelname)] self.message_channel( - channel, - ":%s PART %s :%s" % ( - self.prefix, - channelname, - partmsg), + channel, "PART", "%s :%s" % (channelname, partmsg), True) self.channel_log(channel, "left (%s)" % partmsg, meta=True) del self.channels[irc_lower(channelname)] @@ -369,11 +352,7 @@ class Client(object): newtopic = arguments[1] channel.topic = newtopic self.message_channel( - channel, - ":%s TOPIC %s :%s" % ( - self.prefix, - channelname, - newtopic), + channel, "TOPIC", "%s :%s" % (channelname, newtopic), True) self.channel_log( channel, "set topic to %r" % newtopic, meta=True) @@ -492,7 +471,8 @@ class Client(object): nickname = self.nickname or "*" self.reply("461 %s %s :Not enough parameters" % (nickname, command)) - def message_channel(self, channel, line, include_self=False): + def message_channel(self, channel, command, message, include_self=False): + line = ":%s %s %s" % (self.prefix, command, message) for client in channel.members: if client != self or include_self: client.message(line) |