pvl/irker/irc.py
changeset 127 f143171884f9
parent 110 af87b706e4a3
child 168 4e120851ff52
equal deleted inserted replaced
126:bf2555ae7d06 127:f143171884f9
    49         self.client = client
    49         self.client = client
    50         self.channel = channel
    50         self.channel = channel
    51 
    51 
    52         self.encoding = encoding
    52         self.encoding = encoding
    53 
    53 
       
    54     def encode (self, unicode) :
       
    55         if unicode :
       
    56             return unicode.encode(self.encoding)
       
    57         else :
       
    58             return None
       
    59 
    54     def privmsg (self, *msgs) :
    60     def privmsg (self, *msgs) :
    55         for msg in msgs :
    61         for msg in msgs :
    56             # XXX: encode
    62             # XXX: encode
    57             self.client.msg(self.channel, msg.encode(self.encoding))
    63             self.client.msg(self.channel, self.encode(msg))
    58 
    64 
    59     def notice (self, *msgs) :
    65     def notice (self, *msgs) :
    60         for msg in msgs :
    66         for msg in msgs :
    61             self.client.notice(self.channel, msg.encode(self.encoding))
    67             self.client.notice(self.channel, self.encode(msg))
       
    68 
       
    69     def part (self, msg=None) :
       
    70         """
       
    71             Remove channel from our list of channels.
       
    72         """
       
    73 
       
    74         self.client.leave(self.channel, self.encode(msg))
    62 
    75 
    63     def errback (self, failure) :
    76     def errback (self, failure) :
    64         """
    77         """
    65             Fail any pending requests.
    78             Fail any pending requests.
    66         """
    79         """