def _handle_bundle_update(stanza): log.info('Bundle Information received.') omemo_state = ProfOmemoState() bundle_info = xmpp.unpack_bundle_info(stanza) if not bundle_info: log.error('Could not unpack bundle info.') return sender = bundle_info.get('sender') device_id = bundle_info.get('device') try: omemo_state.build_session(sender, device_id, bundle_info) log.info('Session built with user: {0}:{1}'.format(sender, device_id)) prof.completer_add('/omemo end', [sender]) except Exception as e: msg_tmpl = 'Could not build session with {0}:{1}. {2}:{3}' msg = msg_tmpl.format(sender, device_id, type(e).__name__, str(e)) log.error(msg) return
def test_unpack_bundle_info_chatsecure(self): stanza = get_stanza_fixture('iq_bundle_info_chatsecure.xml') bundle_info = xmpp.unpack_bundle_info(stanza) assert bundle_info.get('sender') == '*****@*****.**' assert bundle_info.get('device') == '4711'