1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-30 17:55:24 -04:00

Changed functions for libotr4 compatibility

This commit is contained in:
James Booth 2014-02-09 02:53:07 +00:00
parent 26e1fd545c
commit d5ba4dfd38

View File

@ -84,7 +84,7 @@ cb_otr_error_message(void *opdata, ConnContext *context,
static void static void
cb_otr_error_message_free(void *opdata, const char *err_msg) cb_otr_error_message_free(void *opdata, const char *err_msg)
{ {
free(err_msg); free((char *)err_msg);
} }
static void static void
@ -137,7 +137,6 @@ otr_init(void)
ops.otr_error_message = cb_otr_error_message; ops.otr_error_message = cb_otr_error_message;
ops.otr_error_message_free = cb_otr_error_message_free; ops.otr_error_message_free = cb_otr_error_message_free;
ops.handle_msg_event = cb_handle_msg_event; ops.handle_msg_event = cb_handle_msg_event;
ops.display_otr_message = cb_display_otr_message;
ops.write_fingerprints = cb_write_fingerprints; ops.write_fingerprints = cb_write_fingerprints;
ops.gone_secure = cb_gone_secure; ops.gone_secure = cb_gone_secure;
@ -318,7 +317,7 @@ gboolean
otr_is_secure(const char * const recipient) otr_is_secure(const char * const recipient)
{ {
ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp", ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
0, NULL, NULL, NULL); 0, 0, NULL, NULL, NULL);
if (context == NULL) { if (context == NULL) {
return FALSE; return FALSE;
@ -335,7 +334,7 @@ gboolean
otr_is_trusted(const char * const recipient) otr_is_trusted(const char * const recipient)
{ {
ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp", ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
0, NULL, NULL, NULL); 0, 0, NULL, NULL, NULL);
if (context == NULL) { if (context == NULL) {
return FALSE; return FALSE;
@ -357,7 +356,7 @@ void
otr_trust(const char * const recipient) otr_trust(const char * const recipient)
{ {
ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp", ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
0, NULL, NULL, NULL); 0, 0, NULL, NULL, NULL);
if (context == NULL) { if (context == NULL) {
return; return;
@ -379,7 +378,7 @@ void
otr_untrust(const char * const recipient) otr_untrust(const char * const recipient)
{ {
ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp", ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
0, NULL, NULL, NULL); 0, 0, NULL, NULL, NULL);
if (context == NULL) { if (context == NULL) {
return; return;
@ -401,10 +400,10 @@ void
otr_end_session(const char * const recipient) otr_end_session(const char * const recipient)
{ {
ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp", ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
0, NULL, NULL, NULL); 0, 0, NULL, NULL, NULL);
if (context != NULL) { if (context != NULL) {
otrl_message_disconnect(user_state, &ops, NULL, jid, "xmpp", recipient); otrl_message_disconnect(user_state, &ops, NULL, jid, "xmpp", recipient, 0);
} }
} }
@ -422,7 +421,7 @@ char *
otr_get_their_fingerprint(const char * const recipient) otr_get_their_fingerprint(const char * const recipient)
{ {
ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp", ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
0, NULL, NULL, NULL); 0, 0, NULL, NULL, NULL);
if (context != NULL) { if (context != NULL) {
Fingerprint *fingerprint = context->active_fingerprint; Fingerprint *fingerprint = context->active_fingerprint;
@ -447,11 +446,15 @@ otr_encrypt_message(const char * const to, const char * const message)
jid, jid,
"xmpp", "xmpp",
to, to,
0,
message, message,
0, 0,
&newmessage, &newmessage,
OTRL_FRAGMENT_SEND_ALL,
NULL,
NULL, NULL,
NULL); NULL);
if (!err == GPG_ERR_NO_ERROR) { if (!err == GPG_ERR_NO_ERROR) {
return NULL; return NULL;
} else { } else {
@ -465,14 +468,26 @@ otr_decrypt_message(const char * const from, const char * const message, gboolea
char *decrypted = NULL; char *decrypted = NULL;
OtrlTLV *tlvs = NULL; OtrlTLV *tlvs = NULL;
OtrlTLV *tlv = NULL; OtrlTLV *tlv = NULL;
int result = otrl_message_receiving(user_state, &ops, NULL, jid, "xmpp", from, message, &decrypted, &tlvs, NULL, NULL); int result = otrl_message_receiving(
user_state,
&ops,
NULL,
jid,
"xmpp",
from,
message,
&decrypted,
&tlvs,
NULL,
NULL,
NULL);
// internal libotr message // internal libotr message
if (result == 1) { if (result == 1) {
tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED); tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
if (tlv) { if (tlv) {
ConnContext *context = otrl_context_find(user_state, from, jid, "xmpp", ConnContext *context = otrl_context_find(user_state, from, jid, "xmpp",
0, NULL, NULL, NULL); 0, 0, NULL, NULL, NULL);
if (context != NULL) { if (context != NULL) {
otrl_context_force_plaintext(context); otrl_context_force_plaintext(context);