From a8341f3cf51c578af60a95a956304c67ac2c31ed Mon Sep 17 00:00:00 2001 From: DebXWoody Date: Sun, 19 Apr 2020 21:06:43 +0200 Subject: [PATCH] List OMEMO device keys in URI Format Issue: #4 --- src/mode/omemo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mode/omemo.c b/src/mode/omemo.c index c974467..646540f 100644 --- a/src/mode/omemo.c +++ b/src/mode/omemo.c @@ -88,7 +88,6 @@ static int _omemo_device_list_reply(xmpp_conn_t *const conn, xmpp_stanza_t *cons xmppc_t *xmppc = (xmppc_t *)userdata; xmpp_stanza_t *query, *item; const char *name; - printf("Device List\n"); query = xmpp_stanza_get_child_by_name(stanza, "pubsub"); query = xmpp_stanza_get_child_by_name(query, "items"); query = xmpp_stanza_get_child_by_name(query, "item"); @@ -97,7 +96,7 @@ static int _omemo_device_list_reply(xmpp_conn_t *const conn, xmpp_stanza_t *cons item = xmpp_stanza_get_next(item)) if ((name = xmpp_stanza_get_attribute(item, "id"))) { response++; - printf("\t %s\n", name); + logInfo(xmppc,"\t %s\n", name); _omemo_bundles_query(xmppc, name); } @@ -107,8 +106,8 @@ static int _omemo_device_list_reply(xmpp_conn_t *const conn, xmpp_stanza_t *cons void _omemo_bundles_query(xmppc_t *xmppc, const char* deviceid){ xmpp_conn_t *conn = xmppc->conn; xmpp_stanza_t *iq, *query, *item; - char* id = xmpp_uuid_gen(xmppc->ctx); - iq = xmpp_iq_new(xmpp_conn_get_context(conn), "get", id); +// char* id = xmpp_uuid_gen(xmppc->ctx); + iq = xmpp_iq_new(xmpp_conn_get_context(conn), "get", deviceid); const char *jid = xmpp_conn_get_jid(conn); xmpp_stanza_set_from(iq, jid); xmpp_stanza_set_to(iq, jid); @@ -125,7 +124,7 @@ void _omemo_bundles_query(xmppc_t *xmppc, const char* deviceid){ xmpp_stanza_add_child(query, item); xmpp_stanza_release(query); xmpp_stanza_release(item); - xmpp_id_handler_add(conn, _omemo_bundles_reply , id, xmppc); + xmpp_id_handler_add(conn, _omemo_bundles_reply , deviceid, xmppc); xmpp_send(conn, iq); } @@ -174,7 +173,8 @@ int _omemo_bundles_reply(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, fingerprint[(i * 2) + 1] += 0x27; } } - printf("Fingerprint: %s\n", fingerprint); + + printf("xmpp:%s?omemo-sid-%s=%s\n", xmpp_conn_get_jid(conn), xmpp_stanza_get_id(stanza), fingerprint); response--; if(response == 0) { xmpp_disconnect(xmppc->conn);