예제 #1
0
파일: handlers.py 프로젝트: Perdu/poezio
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)
예제 #2
0
파일: handlers.py 프로젝트: Perdu/poezio
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)