def onDocumentStart(self, rootElement): XmlStream.onDocumentStart(self, rootElement) #logging.debug('onDocumentStart') #m = message.Message('msg') #m.set('from', 'me') #self.send_message(m) self.handler.client_connected(self)
def __init__(self): XmlStream.__init__(self) # possibly unnecessary self._initializeStream() m = Movie('potter', 'Harry Potter', 123) m1 = Movie('anillos', 'Lord of the Rings', 512) m2 = Movie('wars', 'Star Wars', 463) movie_list = [m, m1, m2] for movie in movie_list: movies.append(movie)
def __init__(self): XmlStream.__init__(self) # possibly unnecessary self._initializeStream() m = Movie('potter', 'Harry Potter', 123) m1 = Movie('anillos', 'Lord of the Rings', 512) m2 = Movie('wars', 'Star Wars', 463) movie_list = [m,m1,m2] for movie in movie_list: movies.append(movie)
def onElement(self, element): XmlStream.onElement(self, element) #logging.debug('Received message %s', element.toXml()) m = message.Message(message = element) #Pass to client handler try: self.handler.process_message(m, self) except Exception, err: logging.exception('Error processing incoming message: %s', err)
def connectionLost(self, reason): #logging.debug('connectionLost') XmlStream.connectionLost(self, reason) self.handler.client_disconnected(self)
def connectionMade(self): #logging.debug('connectionMade') XmlStream.connectionMade(self) #Send start stream XmlStream.send(self, '<?xml version="1.0" encoding="utf-8"?><root>')
def __init__(self, handler): self.handler = handler self.id = 0 XmlStream.__init__(self)
def __init__(self): XmlStream.__init__(self) # possibly unnecessary self._initializeStream()
def __init__(self): XmlStream.__init__(self) # possibly unnecessary self._initializeStream() self.download_server = None
def onDocumentStart(self, rootElement): XmlStream.onDocumentStart(self, rootElement) self.streamStarted(rootElement) self.addObserver('/message[@xmlns="%s"]' % self.NAMESPACE, self.handle_message)
def onDocumentStart(self, rootElement): XmlStream.onDocumentStart(self, rootElement) XmlStream.send(self, '<?xml version="1.0" encoding="utf-8"?><root>') # logging.debug('Document start received') manager.client_connected(self)
def onElement(self, element): # logging.debug('Element received') XmlStream.onElement(self, element) m = message.Message(message=element) manager.process_message(m, self)
def __init__(self): XmlStream.__init__(self) self._initializeStream() self.download_server = None
def __init__(self): XmlStream.__init__(self) self.commands = (('^hello', self.on_hello), ('^help', self.on_help), ('^turn on', self.on_turn_on), ('^turn off', self.on_turn_off))
def send_message(self, m): try: logging.debug('Sending %s', m.to_xml()) XmlStream.send(self, m.to_xml()) except Exception, err: logging.exception('Sending failed: %s', err)
def __init__(self): XmlStream.__init__(self) self._initializeStream() self.movie_list = []
def connectionLost(self, reason): XmlStream.connectionLost(self, reason) manager.client_disconnected(self)
def __init__(self, stream_xmlns='jabber:client', *args, **kwargs): XmlStream.__init__(self, *args, **kwargs) self.connectionMade() self.dataReceived('<stream xmlns="%s">' % (stream_xmlns,)) self.resulted_element = None
def send_message(self, m): # logging.debug('Sending %s', m.to_xml()) XmlStream.send(self, m.to_xml())
def __init__(self): XmlStream.__init__(self) self._initializeStream()
def connectionMade(self): # Send start stream XmlStream.connectionMade(self)