1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Bugfix: Because whitespace was removed, last check OTR always, didn't work, now it works.

This commit is contained in:
lightb 2014-04-22 18:53:48 -04:00
parent 5a5ad31edf
commit e08ee67f5f

View File

@ -209,11 +209,13 @@ handle_incoming_message(char *from, char *message, gboolean priv)
gboolean was_decrypted = FALSE; gboolean was_decrypted = FALSE;
char *newmessage; char *newmessage;
char *policy = prefs_get_string(PREF_OTR_POLICY);
char *whitespace_base = strstr(message,OTRL_MESSAGE_TAG_BASE);
if (!priv) { if (!priv) {
//check for OTR whitespace (opportunistic or always) //check for OTR whitespace (opportunistic or always)
char *policy = prefs_get_string(PREF_OTR_POLICY);
if (strcmp(policy, "opportunistic") == 0 || strcmp(policy, "always") == 0) { if (strcmp(policy, "opportunistic") == 0 || strcmp(policy, "always") == 0) {
char *whitespace_base = strstr(message,OTRL_MESSAGE_TAG_BASE);
if (whitespace_base) { if (whitespace_base) {
if (strstr(message, OTRL_MESSAGE_TAG_V2) || strstr(message, OTRL_MESSAGE_TAG_V1)) { if (strstr(message, OTRL_MESSAGE_TAG_V2) || strstr(message, OTRL_MESSAGE_TAG_V1)) {
// Remove whitespace pattern for proper display in UI // Remove whitespace pattern for proper display in UI
@ -236,11 +238,10 @@ handle_incoming_message(char *from, char *message, gboolean priv)
} else { } else {
newmessage = message; newmessage = message;
} }
char *policy = prefs_get_string(PREF_OTR_POLICY); if (strcmp(policy, "always") == 0 && !was_decrypted && !whitespace_base)
if (strcmp(policy, "always") == 0 && !was_decrypted)
{ {
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(otr_query_message, from); message_send(otr_query_message, from);
} }