def message_received(self, stanza): if stanza.stanza_type != 'chat': return True if not stanza.body: logger.info("%s message: %s", stanza.from_jid, stanza.serialize()) return True ReceivedMessage.received_message_from_stanza(stanza) return True
def loadUnreadedMessages(self): qs = ReceivedMessage.select().where( ReceivedMessage.readed == False, ReceivedMessage.friend == Friend.get(jid=self._toJid)) objs = list(map(lambda item: MessageWrapper(item), qs)) self.setAll(objs) with disable_auto_commit(): for ins in qs: if ins.readed != True: ins.readed = True ins.save(update_fields=['readed'])
def loadUnreadedMessages(self): qs = ReceivedMessage.select().where( ReceivedMessage.readed == False, ReceivedMessage.friend == Friend.get(jid=self._toJid) ) objs = list(map(lambda item: MessageWrapper(item), qs)) self.setAll(objs) with disable_auto_commit(): for ins in qs: if ins.readed != True: ins.readed = True ins.save(update_fields=["readed"])
def on_message_received(self, msg): if msg['type'] == "chat": ReceivedMessage.received_message_from_sleek(msg)
def on_message_received(self, msg): if msg["type"] == "chat": ReceivedMessage.received_message_from_sleek(msg)