Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
 def connectionLost(self, reason):
     #logging.debug('connectionLost')
     XmlStream.connectionLost(self, reason)
     self.handler.client_disconnected(self)
Пример #6
0
 def connectionMade(self):
     #logging.debug('connectionMade')
     XmlStream.connectionMade(self)
     #Send start stream
     XmlStream.send(self, '<?xml version="1.0" encoding="utf-8"?><root>')
Пример #7
0
 def __init__(self, handler):
     self.handler = handler
     self.id = 0
     XmlStream.__init__(self)
Пример #8
0
 def __init__(self):
     XmlStream.__init__(self)  # possibly unnecessary
     self._initializeStream()
Пример #9
0
 def __init__(self):
     XmlStream.__init__(self)  # possibly unnecessary
     self._initializeStream()
     self.download_server = None
Пример #10
0
 def onDocumentStart(self, rootElement):
     XmlStream.onDocumentStart(self, rootElement)
     self.streamStarted(rootElement)
     self.addObserver('/message[@xmlns="%s"]' % self.NAMESPACE, self.handle_message)
Пример #11
0
 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)
Пример #12
0
 def onElement(self, element):
     # logging.debug('Element received')
     XmlStream.onElement(self, element)
     m = message.Message(message=element)
     manager.process_message(m, self)
Пример #13
0
 def __init__(self):
     XmlStream.__init__(self)
     self._initializeStream()
     self.download_server = None
Пример #14
0
 def __init__(self):
     XmlStream.__init__(self)    # possibly unnecessary
     self._initializeStream()
Пример #15
0
 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))
Пример #16
0
 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)
Пример #17
0
 def __init__(self):
     XmlStream.__init__(self)
     self._initializeStream()
     self.movie_list = []
Пример #18
0
 def connectionLost(self, reason):
     XmlStream.connectionLost(self, reason)
     manager.client_disconnected(self)
Пример #19
0
 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
Пример #20
0
 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
Пример #21
0
 def send_message(self, m):
     # logging.debug('Sending %s', m.to_xml())
     XmlStream.send(self, m.to_xml())
Пример #22
0
 def __init__(self):
     XmlStream.__init__(self)
     self._initializeStream()
Пример #23
0
 def connectionMade(self):
     # Send start stream
     XmlStream.connectionMade(self)