Refactored chat session handling on sending message

This commit is contained in:
James Booth
2015-01-04 23:40:10 +00:00
parent 42a5c431c7
commit 8326c8b3a2
13 changed files with 125 additions and 233 deletions

View File

@@ -318,15 +318,7 @@ handle_incoming_message(char *barejid, char *message)
memmove(whitespace_base, whitespace_base+tag_length, tag_length);
char *otr_query_message = otr_start_query();
cons_show("OTR Whitespace pattern detected. Attempting to start OTR session...");
char *resource = NULL;
gboolean send_state = FALSE;
if (chat_session_exists(barejid)) {
resource = chat_session_get_resource(barejid);
send_state = chat_session_on_message_send(barejid);
} else {
send_state = TRUE;
}
message_send_chat(barejid, resource, otr_query_message, send_state);
message_send_chat(barejid, otr_query_message);
}
}
}
@@ -340,15 +332,7 @@ handle_incoming_message(char *barejid, char *message)
if (policy == PROF_OTRPOLICY_ALWAYS && !was_decrypted && !whitespace_base) {
char *otr_query_message = otr_start_query();
cons_show("Attempting to start OTR session...");
char *resource = NULL;
gboolean send_state = FALSE;
if (chat_session_exists(barejid)) {
resource = chat_session_get_resource(barejid);
send_state = chat_session_on_message_send(barejid);
} else {
send_state = TRUE;
}
message_send_chat(barejid, resource, otr_query_message, send_state);
message_send_chat(barejid, otr_query_message);
}
ui_incoming_msg(barejid, newmessage, NULL);