Exemplo n.º 1
0
 def get_channel(self,jid):
     channel_name=jid.node
     try:
         channel_name=node_to_channel(channel_name,self.default_encoding)
     except ValueError:
         self.__logger.debug("Bad channel name: %r" % (channel_name,))
         return None
     if not channel_re.match(channel_name):
         self.__logger.debug("Bad channel name: %r" % (channel_name,))
         return None
     return self.channels.get(normalize(channel_name))
Exemplo n.º 2
0
 def join(self,stanza):
     to=stanza.get_to()
     if to.node=='#':
         return self.join_raw_channel(stanza)
     self.cond.acquire()
     try:
         if not self.ready:
             self.join_requests.append(stanza.copy())
             return
     finally:
         self.cond.release()
     try:
         channel=node_to_channel(to.node,self.default_encoding)
     except ValueError:
         e=stanza.make_error_response("not-acceptable")
         self.component.send(e)
         return
     if self.channels.has_key(normalize(channel)):
         return
     if to not in self.used_for:
         self.used_for.append(to)
     channel=Channel(self,channel)
     channel.join(stanza)
     self.channels[normalize(channel.name)]=channel