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
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)
def onConnected(self): to = self.room_jid + u'/' + self.connection.credentials[0] self.connection.sendStanza(XMPPStanzas.mucPresence(self.connection.jid, to))
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
def onConnected(self): to = self.room_jid + u'/' + self.connection.credentials[0] self.connection.sendStanza( XMPPStanzas.mucPresence(self.connection.jid, to))