mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge branch 'master' into osx-functional
This commit is contained in:
commit
a24a8e6019
@ -4530,7 +4530,8 @@ cmd_otr(ProfWin *window, const char * const command, gchar **args)
|
|||||||
|
|
||||||
if (!otr_is_secure(barejid)) {
|
if (!otr_is_secure(barejid)) {
|
||||||
char *otr_query_message = otr_start_query();
|
char *otr_query_message = otr_start_query();
|
||||||
message_send_chat_otr(barejid, otr_query_message);
|
char *id = message_send_chat_otr(barejid, otr_query_message);
|
||||||
|
free(id);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4562,7 +4563,8 @@ cmd_otr(ProfWin *window, const char * const command, gchar **args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *otr_query_message = otr_start_query();
|
char *otr_query_message = otr_start_query();
|
||||||
message_send_chat_otr(chatwin->barejid, otr_query_message);
|
char *id = message_send_chat_otr(chatwin->barejid, otr_query_message);
|
||||||
|
free(id);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,8 @@ static void
|
|||||||
cb_inject_message(void *opdata, const char *accountname,
|
cb_inject_message(void *opdata, const char *accountname,
|
||||||
const char *protocol, const char *recipient, const char *message)
|
const char *protocol, const char *recipient, const char *message)
|
||||||
{
|
{
|
||||||
message_send_chat_otr(recipient, message);
|
char *id = message_send_chat_otr(recipient, message);
|
||||||
|
free(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -291,7 +292,8 @@ otr_on_message_recv(const char * const barejid, const char * const resource, con
|
|||||||
memmove(whitespace_base, whitespace_base+tag_length, tag_length);
|
memmove(whitespace_base, whitespace_base+tag_length, tag_length);
|
||||||
char *otr_query_message = otr_start_query();
|
char *otr_query_message = otr_start_query();
|
||||||
cons_show("OTR Whitespace pattern detected. Attempting to start OTR session...");
|
cons_show("OTR Whitespace pattern detected. Attempting to start OTR session...");
|
||||||
message_send_chat_otr(barejid, otr_query_message);
|
char *id = message_send_chat_otr(barejid, otr_query_message);
|
||||||
|
free(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -304,7 +306,8 @@ otr_on_message_recv(const char * const barejid, const char * const resource, con
|
|||||||
if (policy == PROF_OTRPOLICY_ALWAYS && *was_decrypted == FALSE && !whitespace_base) {
|
if (policy == PROF_OTRPOLICY_ALWAYS && *was_decrypted == FALSE && !whitespace_base) {
|
||||||
char *otr_query_message = otr_start_query();
|
char *otr_query_message = otr_start_query();
|
||||||
cons_show("Attempting to start OTR session...");
|
cons_show("Attempting to start OTR session...");
|
||||||
message_send_chat_otr(barejid, otr_query_message);
|
char *id = message_send_chat_otr(barejid, otr_query_message);
|
||||||
|
free(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return decrypted;
|
return decrypted;
|
||||||
@ -705,6 +708,14 @@ otr_encrypt_message(const char * const to, const char * const message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_otr_tlv_free(OtrlTLV *tlvs)
|
||||||
|
{
|
||||||
|
if (tlvs) {
|
||||||
|
otrl_tlv_free(tlvs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
otr_decrypt_message(const char * const from, const char * const message, gboolean *was_decrypted)
|
otr_decrypt_message(const char * const from, const char * const message, gboolean *was_decrypted)
|
||||||
{
|
{
|
||||||
@ -720,7 +731,6 @@ otr_decrypt_message(const char * const from, const char * const message, gboolea
|
|||||||
// common tlv handling
|
// common tlv handling
|
||||||
OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
|
OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
|
||||||
if (tlv) {
|
if (tlv) {
|
||||||
|
|
||||||
if (context) {
|
if (context) {
|
||||||
otrl_context_force_plaintext(context);
|
otrl_context_force_plaintext(context);
|
||||||
ui_gone_insecure(from);
|
ui_gone_insecure(from);
|
||||||
@ -729,16 +739,19 @@ otr_decrypt_message(const char * const from, const char * const message, gboolea
|
|||||||
|
|
||||||
// library version specific tlv handling
|
// library version specific tlv handling
|
||||||
otrlib_handle_tlvs(user_state, &ops, context, tlvs, smp_initiators);
|
otrlib_handle_tlvs(user_state, &ops, context, tlvs, smp_initiators);
|
||||||
|
_otr_tlv_free(tlvs);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// message was decrypted, return to user
|
// message was decrypted, return to user
|
||||||
} else if (decrypted) {
|
} else if (decrypted) {
|
||||||
|
_otr_tlv_free(tlvs);
|
||||||
*was_decrypted = TRUE;
|
*was_decrypted = TRUE;
|
||||||
return decrypted;
|
return decrypted;
|
||||||
|
|
||||||
// normal non OTR message
|
// normal non OTR message
|
||||||
} else {
|
} else {
|
||||||
|
_otr_tlv_free(tlvs);
|
||||||
*was_decrypted = FALSE;
|
*was_decrypted = FALSE;
|
||||||
return strdup(message);
|
return strdup(message);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user