def on_carbon_sent(self, message): """ Carbon <sent/> received """ def ignore_message(sent): log.debug('%s has category conference, ignoring carbon', sent['to'].server) def send_message(sent): sent['from'] = self.xmpp.boundjid.full self.on_normal_message(sent) sent = message['carbon_sent'] if (sent['to'].bare not in roster or roster[sent['to'].bare].subscription == 'none'): fixes.has_identity(self.xmpp, sent['to'].server, identity='conference', on_true=functools.partial(ignore_message, sent), on_false=functools.partial(send_message, sent)) else: send_message(sent)
def on_carbon_received(self, message): """ Carbon <received/> received """ def ignore_message(recv): log.debug('%s has category conference, ignoring carbon', recv['from'].server) def receive_message(recv): recv['to'] = self.xmpp.boundjid.full if recv['receipt']: return self.on_receipt(recv) self.on_normal_message(recv) recv = message['carbon_received'] if (recv['from'].bare not in roster or roster[recv['from'].bare].subscription == 'none'): fixes.has_identity(self.xmpp, recv['from'].server, identity='conference', on_true=functools.partial(ignore_message, recv), on_false=functools.partial(receive_message, recv)) return else: receive_message(recv)