Mercurial > xib
comparison irclib.py @ 131:46af7f2744a9
added irclib.ServerConnection.left_channels
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Fri, 15 Jan 2010 16:30:50 +0100 |
parents | e1e66c563d08 |
children | 7dc6a1764c4f |
comparison
equal
deleted
inserted
replaced
130:52d94261a406 | 131:46af7f2744a9 |
---|---|
413 self.ssl = None | 413 self.ssl = None |
414 self.server = server | 414 self.server = server |
415 self.port = port | 415 self.port = port |
416 self.nickname = nickname | 416 self.nickname = nickname |
417 self.lock = threading.RLock() | 417 self.lock = threading.RLock() |
418 self.left_channels = [] | |
418 | 419 |
419 | 420 |
420 def __str__(self): | 421 def __str__(self): |
421 return self.real_nickname+' at '+self.server+':'+str(self.port) | 422 return self.real_nickname+' at '+self.server+':'+str(self.port) |
422 | 423 |
780 """ | 781 """ |
781 self.send_raw("ISON " + " ".join(nicks)) | 782 self.send_raw("ISON " + " ".join(nicks)) |
782 | 783 |
783 def join(self, channel, key=""): | 784 def join(self, channel, key=""): |
784 """Send a JOIN command.""" | 785 """Send a JOIN command.""" |
786 if channel in self.left_channels: | |
787 self.left_channels.remove(channel) | |
785 self.send_raw("JOIN %s%s" % (channel, (key and (" " + key)))) | 788 self.send_raw("JOIN %s%s" % (channel, (key and (" " + key)))) |
786 | 789 |
787 def kick(self, channel, nick, comment=""): | 790 def kick(self, channel, nick, comment=""): |
788 """Send a KICK command.""" | 791 """Send a KICK command.""" |
789 self.send_raw("KICK %s %s%s" % (channel, nick, (comment and (" :" + comment)))) | 792 self.send_raw("KICK %s %s%s" % (channel, nick, (comment and (" :" + comment)))) |
847 self.send_raw("OPER %s %s" % (nick, password)) | 850 self.send_raw("OPER %s %s" % (nick, password)) |
848 | 851 |
849 def part(self, channels, message=""): | 852 def part(self, channels, message=""): |
850 """Send a PART command.""" | 853 """Send a PART command.""" |
851 if isinstance(channels, basestring): | 854 if isinstance(channels, basestring): |
855 self.left_channels.append(channels) | |
852 self.send_raw("PART " + channels + (message and (" " + message))) | 856 self.send_raw("PART " + channels + (message and (" " + message))) |
853 else: | 857 else: |
858 for channel in channels: | |
859 self.left_channels.append(channel) | |
854 self.send_raw("PART " + ",".join(channels) + (message and (" " + message))) | 860 self.send_raw("PART " + ",".join(channels) + (message and (" " + message))) |
855 | 861 |
856 def pass_(self, password): | 862 def pass_(self, password): |
857 """Send a PASS command.""" | 863 """Send a PASS command.""" |
858 self.send_raw("PASS " + password) | 864 self.send_raw("PASS " + password) |