Exemple #1
0
 def sendMessage(self, uMessage):
     if self.connection:
         self.connection.sendStanza(
             XMPPStanzas.mucMessage(self.connection.jid, self.room_jid,
                                    XMPPStanzas.xmlText(uMessage)))
         return True
     return False
Exemple #2
0
 def __onStateAuthenticating(self, stanza):
     stanzaName = stanza['name']
     stanzaID = getAttr(stanza, 'id')
     stanzaType = getAttr(stanza, 'type')
     if stanzaName == 'challenge':
         self.__onStanzaAuthChallenge(stanza)
     elif stanzaName == 'success':
         self.connection.parser.newParser()
         self.connection.sendStanza(XMPPStanzas.STREAM_START % self.connection.host[0])
     elif stanzaName == 'stream:features':
         self.connection.sendStanza(XMPPStanzas.BIND_RESOURCE % XMPPConnection.Connection.RESOURCE)
     elif stanzaName == 'iq':
         if stanzaType == 'result':
             if stanzaID == 'bind_2':
                 self.connection.sendStanza(XMPPStanzas.SESSION)
             elif stanzaID == 'sess_1':
                 self.__updateState(Client.STATE_ONLINE)
                 self.eventConnected()
                 self.connection.sendStanza(XMPPStanzas.presence())
     else:
         LOG_ERROR('Unhandled stanza name:', stanzaName, stanza)
Exemple #3
0
 def __onStateAuthenticating(self, stanza):
     stanzaName = stanza['name']
     stanzaID = getAttr(stanza, 'id')
     stanzaType = getAttr(stanza, 'type')
     if stanzaName == 'challenge':
         self.__onStanzaAuthChallenge(stanza)
     elif stanzaName == 'success':
         self.connection.parser.newParser()
         self.connection.sendStanza(XMPPStanzas.STREAM_START %
                                    self.connection.host[0])
     elif stanzaName == 'stream:features':
         self.connection.sendStanza(XMPPStanzas.BIND_RESOURCE %
                                    XMPPConnection.Connection.RESOURCE)
     elif stanzaName == 'iq':
         if stanzaType == 'result':
             if stanzaID == 'bind_2':
                 self.connection.sendStanza(XMPPStanzas.SESSION)
             elif stanzaID == 'sess_1':
                 self.__updateState(Client.STATE_ONLINE)
                 self.eventConnected()
                 self.connection.sendStanza(XMPPStanzas.presence())
     else:
         LOG_ERROR('Unhandled stanza name:', stanzaName, stanza)
Exemple #4
0
 def onConnected(self):
     to = self.room_jid + u'/' + self.connection.credentials[0]
     self.connection.sendStanza(XMPPStanzas.mucPresence(self.connection.jid, to))
Exemple #5
0
 def sendMessage(self, uMessage):
     if self.connection:
         self.connection.sendStanza(XMPPStanzas.mucMessage(self.connection.jid, self.room_jid, XMPPStanzas.xmlText(uMessage)))
         return True
     return False
Exemple #6
0
 def onConnected(self):
     to = self.room_jid + u'/' + self.connection.credentials[0]
     self.connection.sendStanza(
         XMPPStanzas.mucPresence(self.connection.jid, to))