Commit 9ee3143b authored by Romain Bignon's avatar Romain Bignon

add /topic command

parent 96beda8e
......@@ -363,6 +363,32 @@ class Client(object):
quitmsg = args[0]
self.disconnect(quitmsg)
@check_registered
def on_topic(self, args):
if len(args) < 1:
self.reply_461("TOPIC")
return
channelname = args[0]
channel = self.channels.get(irc_lower(channelname))
if channel:
if len(args) > 1:
newtopic = args[1]
channel.topic = newtopic
self.message_channel(
channel, "TOPIC", "%s :%s" % (channelname, newtopic),
True)
else:
if channel.topic:
self.reply("332 %s %s :%s"
% (self.nickname, channel.name,
channel.topic))
else:
self.reply("331 %s %s :No topic is set"
% (self.nickname, channel.name))
else:
self.reply("442 %s :You're not on that channel" % channelname)
@check_registered
def on_who(self, args):
if len(args) < 1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment