Commit 8e8bbe35 authored by Romain Bignon's avatar Romain Bignon

add /mode command

parent 9ee3143b
...@@ -303,6 +303,32 @@ class Client(object): ...@@ -303,6 +303,32 @@ class Client(object):
else: else:
self.reply("401 %s %s :No such channel" self.reply("401 %s %s :No such channel"
% (self.nickname, targetname)) % (self.nickname, targetname))
@check_registered
def on_mode(self, args):
if len(args) < 1:
self.reply_461("MODE")
return
targetname = args[0]
if self.server.has_channel(targetname):
if len(args) < 2:
modes = "+"
self.reply("324 %s %s %s"
% (self.nickname, targetname, modes))
return
flag = args[1]
if 'b' in flag:
self.reply("368 %s %s :End of Channel Ban List" % (self.nickname, targetname))
else:
self.reply("472 %s %s :Unknown MODE flag"
% (self.nickname, flag))
elif targetname == self.nickname:
if len(args) == 1:
self.reply("221 %s +" % self.nickname)
else:
self.reply("501 %s :Unknown MODE flag" % self.nickname)
else:
self.reply_403(targetname)
@check_registered @check_registered
def on_join(self, args): def on_join(self, args):
......
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