diff options
author | James Booth <boothj5@gmail.com> | 2014-04-28 22:23:39 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-04-28 22:23:39 +0100 |
commit | 1155ceabbc4424db8de19b8f540e514a90696bab (patch) | |
tree | def9646f6204ebcab8eb965696816da42c92f999 /src/otr/otr.c | |
parent | da4dfe251df441d745078b7c477b15a54cdac3fc (diff) | |
download | profani-tty-1155ceabbc4424db8de19b8f540e514a90696bab.tar.gz |
Attempt at shared secret authentication for libotr 4.0.0
Bug exists where second attempt always gets stuck
Diffstat (limited to 'src/otr/otr.c')
-rw-r--r-- | src/otr/otr.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/otr/otr.c b/src/otr/otr.c index de1d6959..72dded2a 100644 --- a/src/otr/otr.c +++ b/src/otr/otr.c @@ -155,11 +155,19 @@ _otr_init(void) otrlib_init_ops(&ops); + otrlib_init_timer(); + smp_initiators = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); data_loaded = FALSE; } +void +_otr_poll(void) +{ + otrlib_poll(); +} + static void _otr_on_connect(ProfAccount *account) { @@ -359,9 +367,14 @@ _otr_is_trusted(const char * const recipient) return TRUE; } - if (context->active_fingerprint && - g_strcmp0(context->active_fingerprint->trust, "trusted") == 0) { - return TRUE; + if (context->active_fingerprint) { + if (context->active_fingerprint->trust == NULL) { + return FALSE; + } else if (context->active_fingerprint->trust[0] == '\0') { + return FALSE; + } else { + return TRUE; + } } return FALSE; @@ -381,6 +394,9 @@ _otr_trust(const char * const recipient) } if (context->active_fingerprint) { + if (context->active_fingerprint->trust != NULL) { + free(context->active_fingerprint->trust); + } context->active_fingerprint->trust = strdup("trusted"); cb_write_fingerprints(NULL); } @@ -402,6 +418,9 @@ _otr_untrust(const char * const recipient) } if (context->active_fingerprint) { + if (context->active_fingerprint->trust != NULL) { + free(context->active_fingerprint->trust); + } context->active_fingerprint->trust = NULL; cb_write_fingerprints(NULL); } @@ -530,6 +549,7 @@ otr_init_module(void) otr_init = _otr_init; otr_libotr_version = _otr_libotr_version; otr_start_query = _otr_start_query; + otr_poll = _otr_poll; otr_on_connect = _otr_on_connect; otr_keygen = _otr_keygen; otr_key_loaded = _otr_key_loaded; |