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

Try to start sessions with every jid in roster

This commit is contained in:
Paul Fariello 2019-04-10 18:31:15 +03:20
parent f9b2fdc7db
commit df648ba959
3 changed files with 22 additions and 0 deletions

View File

@ -174,6 +174,10 @@ sv_ev_roster_received(void)
const char *fulljid = connection_get_fulljid();
plugins_on_connect(account_name, fulljid);
#ifdef HAVE_OMEMO
omemo_start_sessions();
#endif
}
void

View File

@ -23,6 +23,7 @@
#include "xmpp/connection.h"
#include "xmpp/muc.h"
#include "xmpp/omemo.h"
#include "xmpp/roster_list.h"
#include "xmpp/xmpp.h"
static gboolean loaded;
@ -304,6 +305,7 @@ omemo_generate_crypto_materials(ProfAccount *account)
loaded = TRUE;
omemo_publish_crypto_materials();
omemo_start_sessions();
}
void
@ -326,6 +328,20 @@ omemo_publish_crypto_materials(void)
jid_destroy(jid);
}
void
omemo_start_sessions(void)
{
GSList *contacts = roster_get_contacts(ROSTER_ORD_NAME);
if (contacts) {
GSList *curr = contacts;
for (curr = contacts; curr != NULL; curr = g_slist_next(curr)){
PContact contact = curr->data;
const char *jid = p_contact_barejid(contact);
omemo_start_session(jid);
}
}
}
void
omemo_start_session(const char *const barejid)
{
@ -1267,6 +1283,7 @@ _load_identity(void)
loaded = TRUE;
omemo_identity_keyfile_save();
omemo_start_sessions();
}
static void

View File

@ -45,6 +45,7 @@ gboolean omemo_is_trusted_identity(const char *const jid, const char *const fing
char *omemo_fingerprint_autocomplete(const char *const search_str, gboolean previous);
void omemo_fingerprint_autocomplete_reset(void);
void omemo_start_sessions(void);
void omemo_start_session(const char *const barejid);
void omemo_start_muc_sessions(const char *const roomjid);
void omemo_start_device_session(const char *const jid, uint32_t device_id, GList *prekeys, uint32_t signed_prekey_id, const unsigned char *const signed_prekey, size_t signed_prekey_len, const unsigned char *const signature, size_t signature_len, const unsigned char *const identity_key, size_t identity_key_len);