mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Merge pull request #1548 from DebXWoody/bugfix/bugfix1538
OMEMO - Notify user when unable to publish own device list
This commit is contained in:
commit
45c930eaa5
@ -1335,14 +1335,15 @@ _handle_own_device_list(const char* const jid, GList* device_list)
|
|||||||
{
|
{
|
||||||
// We didn't find the own device id -> publish
|
// We didn't find the own device id -> publish
|
||||||
if (!g_list_find(device_list, GINT_TO_POINTER(omemo_ctx.device_id))) {
|
if (!g_list_find(device_list, GINT_TO_POINTER(omemo_ctx.device_id))) {
|
||||||
log_debug("[OMEMO] No device id for our device? publish device list...");
|
cons_show("Could not find own OMEMO device ID. Going to publish own device ID: %d", GINT_TO_POINTER(omemo_ctx.device_id));
|
||||||
|
log_debug("[OMEMO] No device ID for our device. Publishing device list");
|
||||||
device_list = g_list_copy(device_list);
|
device_list = g_list_copy(device_list);
|
||||||
device_list = g_list_append(device_list, GINT_TO_POINTER(omemo_ctx.device_id));
|
device_list = g_list_append(device_list, GINT_TO_POINTER(omemo_ctx.device_id));
|
||||||
g_hash_table_insert(omemo_ctx.device_list, strdup(jid), device_list);
|
g_hash_table_insert(omemo_ctx.device_list, strdup(jid), device_list);
|
||||||
omemo_devicelist_publish(device_list);
|
omemo_devicelist_publish(device_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug("[OMEMO] Request OMEMO Bundles for my devices...");
|
log_debug("[OMEMO] Request OMEMO Bundles for our devices");
|
||||||
GList* device_id;
|
GList* device_id;
|
||||||
for (device_id = device_list; device_id != NULL; device_id = device_id->next) {
|
for (device_id = device_list; device_id != NULL; device_id = device_id->next) {
|
||||||
omemo_bundle_request(jid, GPOINTER_TO_INT(device_id->data), omemo_start_device_session_handle_bundle, free, strdup(jid));
|
omemo_bundle_request(jid, GPOINTER_TO_INT(device_id->data), omemo_start_device_session_handle_bundle, free, strdup(jid));
|
||||||
|
@ -51,6 +51,8 @@ static int _omemo_bundle_publish_result(xmpp_stanza_t* const stanza, void* const
|
|||||||
static int _omemo_bundle_publish_configure(xmpp_stanza_t* const stanza, void* const userdata);
|
static int _omemo_bundle_publish_configure(xmpp_stanza_t* const stanza, void* const userdata);
|
||||||
static int _omemo_bundle_publish_configure_result(xmpp_stanza_t* const stanza, void* const userdata);
|
static int _omemo_bundle_publish_configure_result(xmpp_stanza_t* const stanza, void* const userdata);
|
||||||
|
|
||||||
|
static int _omemo_device_list_publish_result(xmpp_stanza_t* const stanza, void* const userdata);
|
||||||
|
|
||||||
void
|
void
|
||||||
omemo_devicelist_subscribe(void)
|
omemo_devicelist_subscribe(void)
|
||||||
{
|
{
|
||||||
@ -71,6 +73,8 @@ omemo_devicelist_publish(GList* device_list)
|
|||||||
stanza_attach_publish_options(ctx, iq, "pubsub#access_model", "open");
|
stanza_attach_publish_options(ctx, iq, "pubsub#access_model", "open");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iq_id_handler_add(xmpp_stanza_get_id(iq), _omemo_device_list_publish_result, NULL, NULL);
|
||||||
|
|
||||||
iq_send_stanza(iq);
|
iq_send_stanza(iq);
|
||||||
xmpp_stanza_release(iq);
|
xmpp_stanza_release(iq);
|
||||||
}
|
}
|
||||||
@ -608,3 +612,15 @@ _omemo_bundle_publish_configure_result(xmpp_stanza_t* const stanza, void* const
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_omemo_device_list_publish_result(xmpp_stanza_t* const stanza, void* const userdata)
|
||||||
|
{
|
||||||
|
const char* type = xmpp_stanza_get_type(stanza);
|
||||||
|
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
|
||||||
|
cons_show_error("Unable to publish own OMEMO device list");
|
||||||
|
log_error("[OMEMO] Publishing device list failed");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user