1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Create devicelist if it doesn't exists

This commit is contained in:
Paul Fariello 2021-08-18 18:12:15 +02:00
parent 0b6cf20183
commit d8cee98cc7

View File

@ -459,8 +459,25 @@ out:
static int static int
_omemo_receive_devicelist(xmpp_stanza_t* const stanza, void* const userdata) _omemo_receive_devicelist(xmpp_stanza_t* const stanza, void* const userdata)
{ {
GList* device_list = NULL;
const char* from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); const char* from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char* type = xmpp_stanza_get_type(stanza);
GList* device_list = NULL;
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
log_error("[OMEMO] can't get OMEMO device list");
xmpp_stanza_t* error = xmpp_stanza_get_child_by_name(stanza, "error");
if (!error) {
log_error("[OMEMO] missing error element in device list response");
return 1;
}
const char* code = xmpp_stanza_get_attribute(error, "code");
if (g_strcmp0(code, "404") == 0) {
omemo_set_device_list(from, device_list);
return 1;
}
}
xmpp_stanza_t* root = NULL; xmpp_stanza_t* root = NULL;
xmpp_stanza_t* event = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_PUBSUB_EVENT); xmpp_stanza_t* event = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_PUBSUB_EVENT);