Parse commands TOPIC

This commit is contained in:
Némunaire 2012-07-20 19:15:01 +02:00
parent f4d3c6a500
commit ffb3d368d8
2 changed files with 9 additions and 1 deletions

View File

@ -12,6 +12,9 @@ class Channel:
#print ("%s arrive sur %s" % (nick, self.name)) #print ("%s arrive sur %s" % (nick, self.name))
self.people[nick] = level self.people[nick] = level
def chtopic(self, newtopic):
self.topic = newtopic
def nick(self, oldnick, newnick): def nick(self, oldnick, newnick):
print ("%s change de nom pour %s" % (oldnick, newnick)) print ("%s change de nom pour %s" % (oldnick, newnick))
if oldnick in self.people: if oldnick in self.people:

View File

@ -68,11 +68,14 @@ class Message:
self.content = words[3:] self.content = words[3:]
elif self.cmd == 'JOIN' and self.channel[0] == ":": elif self.cmd == 'JOIN' and self.channel[0] == ":":
self.channel = self.channel[1:] self.channel = self.channel[1:]
elif self.cmd == 'TOPIC' and self.channel[0] == ":":
self.content = ' '.join(words[3:])[1:]
elif self.cmd == '332': elif self.cmd == '332':
self.channel = words[3] self.channel = words[3]
self.content = ' '.join(words[4:])[1:] self.content = ' '.join(words[4:])[1:]
# else: else:
# print (line) # print (line)
self.content = ' '.join(words[3:])
else: else:
print (line) print (line)
if self.cmd == 'PRIVMSG': if self.cmd == 'PRIVMSG':
@ -136,6 +139,8 @@ class Message:
self.srv.channels[self.channel].join(self.sender) self.srv.channels[self.channel].join(self.sender)
elif self.cmd == "PART": elif self.cmd == "PART":
self.srv.channels[self.channel].part(self.sender) self.srv.channels[self.channel].part(self.sender)
elif self.cmd == "TOPIC":
self.srv.channels[self.channel].chtopic(self.content)
elif self.cmd == "NICK": elif self.cmd == "NICK":
for chn in self.srv.channels.keys(): for chn in self.srv.channels.keys():
self.srv.channels[chn].nick(self.sender, self.content) self.srv.channels[chn].nick(self.sender, self.content)