Merge branch 'master' into xep/xep0107-user-mood
This commit is contained in:
@@ -84,6 +84,7 @@ static unsigned char* _omemo_fingerprint_decode(const char* const fingerprint, s
|
||||
static char* _omemo_unformat_fingerprint(const char* const fingerprint_formatted);
|
||||
static void _cache_device_identity(const char* const jid, uint32_t device_id, ec_public_key* identity);
|
||||
static void _g_hash_table_free(GHashTable* hash_table);
|
||||
static void _acquire_sender_devices_list(void);
|
||||
|
||||
typedef gboolean (*OmemoDeviceListHandler)(const char* const jid, GList* device_list);
|
||||
|
||||
@@ -384,21 +385,26 @@ omemo_publish_crypto_materials(void)
|
||||
return;
|
||||
}
|
||||
|
||||
omemo_bundle_publish(true);
|
||||
}
|
||||
|
||||
static void _acquire_sender_devices_list(void) {
|
||||
char* barejid = connection_get_barejid();
|
||||
|
||||
/* Ensure we get our current device list, and it gets updated with our
|
||||
* device_id */
|
||||
g_hash_table_insert(omemo_ctx.device_list_handler, strdup(barejid), _handle_own_device_list);
|
||||
omemo_devicelist_request(barejid);
|
||||
|
||||
omemo_bundle_publish(true);
|
||||
|
||||
free(barejid);
|
||||
}
|
||||
|
||||
void
|
||||
omemo_start_sessions(void)
|
||||
{
|
||||
// before any session may be started, a list on
|
||||
// available sender devices must be acquired
|
||||
log_debug("[OMEMO] Acquiring sender devices list");
|
||||
_acquire_sender_devices_list();
|
||||
|
||||
GSList* contacts = roster_get_contacts(ROSTER_ORD_NAME);
|
||||
if (contacts) {
|
||||
GSList* curr;
|
||||
|
||||
@@ -82,7 +82,7 @@ _free_command_help(CommandHelp* help)
|
||||
free(help->desc);
|
||||
|
||||
i = 0;
|
||||
while (help->args[i] != NULL && help->args[i][0] != NULL) {
|
||||
while (help->args[i][0] != NULL) {
|
||||
free(help->args[i][0]);
|
||||
free(help->args[i][1]);
|
||||
i++;
|
||||
|
||||
@@ -158,7 +158,7 @@ python_api_register_command(PyObject* self, PyObject* args)
|
||||
c_synopsis[len] = NULL;
|
||||
|
||||
Py_ssize_t args_len = PyList_Size(arguments);
|
||||
char* c_arguments[args_len == 0 ? 0 : args_len + 1][2];
|
||||
char* c_arguments[args_len + 1][2];
|
||||
for (i = 0; i < args_len; i++) {
|
||||
PyObject* item = PyList_GetItem(arguments, i);
|
||||
Py_ssize_t len2 = PyList_Size(item);
|
||||
@@ -196,7 +196,7 @@ python_api_register_command(PyObject* self, PyObject* args)
|
||||
free(c_synopsis[i++]);
|
||||
}
|
||||
i = 0;
|
||||
while (c_arguments[i] != NULL && c_arguments[i][0] != NULL) {
|
||||
while (c_arguments[i][0] != NULL) {
|
||||
free(c_arguments[i][0]);
|
||||
free(c_arguments[i][1]);
|
||||
i++;
|
||||
|
||||
@@ -231,7 +231,13 @@ _message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* con
|
||||
gboolean is_carbon = FALSE;
|
||||
|
||||
// XEP-0280: Message Carbons
|
||||
xmpp_stanza_t* carbons = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CARBONS);
|
||||
// Only allow `<sent xmlns='urn:xmpp:carbons:2'>` and `<received xmlns='urn:xmpp:carbons:2'>` carbons
|
||||
// Thus ignoring `<private xmlns="urn:xmpp:carbons:2"/>`
|
||||
xmpp_stanza_t* carbons = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_SENT, STANZA_NS_CARBONS);
|
||||
if (!carbons) {
|
||||
carbons = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_RECEIVED, STANZA_NS_CARBONS);
|
||||
}
|
||||
|
||||
if (carbons) {
|
||||
|
||||
// carbon must come from ourselves
|
||||
@@ -1291,7 +1297,7 @@ _handle_carbons(xmpp_stanza_t* const stanza)
|
||||
}
|
||||
*/
|
||||
|
||||
if ((g_strcmp0(name, "received") != 0) && (g_strcmp0(name, "sent") != 0)) {
|
||||
if ((g_strcmp0(name, STANZA_NAME_RECEIVED) != 0) && (g_strcmp0(name, STANZA_NAME_SENT) != 0)) {
|
||||
log_warning("Carbon received with unrecognised stanza name: %s", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -119,6 +119,8 @@
|
||||
#define STANZA_NAME_REPORT "report"
|
||||
#define STANZA_NAME_EVENT "event"
|
||||
#define STANZA_NAME_MOOD "mood"
|
||||
#define STANZA_NAME_RECEIVED "received"
|
||||
#define STANZA_NAME_SENT "sent"
|
||||
|
||||
// error conditions
|
||||
#define STANZA_NAME_BAD_REQUEST "bad-request"
|
||||
|
||||
Reference in New Issue
Block a user