Split PGP incoming and outgoing message handling
This commit is contained in:
@@ -91,20 +91,19 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg)
|
||||
// OTR suported, PGP supported
|
||||
#ifdef HAVE_LIBOTR
|
||||
#ifdef HAVE_LIBGPGME
|
||||
prof_enc_t enc_mode = chatwin->enc_mode;
|
||||
if (enc_mode == PROF_ENC_NONE || enc_mode == PROF_ENC_OTR) {
|
||||
if (chatwin->pgp_send) {
|
||||
char *id = message_send_chat_pgp(chatwin->barejid, msg);
|
||||
chat_log_pgp_msg_out(chatwin->barejid, msg);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_MSG_PGP);
|
||||
free(id);
|
||||
} else {
|
||||
gboolean handled = otr_on_message_send(chatwin, msg);
|
||||
if (!handled) {
|
||||
char *id = message_send_chat(chatwin->barejid, msg);
|
||||
chat_log_msg_out(chatwin->barejid, msg);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_ENC_NONE);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_MSG_PLAIN);
|
||||
free(id);
|
||||
}
|
||||
} else { // enc_mode = PROF_ENC_PGP
|
||||
char *id = message_send_chat_pgp(chatwin->barejid, msg);
|
||||
chat_log_pgp_msg_out(chatwin->barejid, msg);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_ENC_PGP);
|
||||
free(id);
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
@@ -117,7 +116,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg)
|
||||
if (!handled) {
|
||||
char *id = message_send_chat(chatwin->barejid, msg);
|
||||
chat_log_msg_out(chatwin->barejid, msg);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_ENC_NONE);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_MSG_PLAIN);
|
||||
free(id);
|
||||
}
|
||||
return;
|
||||
@@ -127,16 +126,15 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg)
|
||||
// OTR unsupported, PGP supported
|
||||
#ifndef HAVE_LIBOTR
|
||||
#ifdef HAVE_LIBGPGME
|
||||
prof_enc_t enc_mode = chatwin->enc_mode;
|
||||
if (enc_mode == PROF_ENC_NONE) {
|
||||
char *id = message_send_chat(chatwin->barejid, msg);
|
||||
chat_log_msg_out(chatwin->barejid, msg);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_ENC_NONE);
|
||||
free(id);
|
||||
} else if (enc_mode == PROF_ENC_PGP) {
|
||||
if (chatwin->pgp_send) {
|
||||
char *id = message_send_chat_pgp(chatwin->barejid, msg);
|
||||
chat_log_pgp_msg_out(chatwin->barejid, msg);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_ENC_PGP);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_MSG_PGP);
|
||||
free(id);
|
||||
} else {
|
||||
char *id = message_send_chat(chatwin->barejid, msg);
|
||||
chat_log_msg_out(chatwin->barejid, msg);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_MSG_PLAIN);
|
||||
free(id);
|
||||
}
|
||||
return;
|
||||
@@ -148,7 +146,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg)
|
||||
#ifndef HAVE_LIBGPGME
|
||||
char *id = message_send_chat(chatwin->barejid, msg);
|
||||
chat_log_msg_out(chatwin->barejid, msg);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_ENC_NONE);
|
||||
ui_outgoing_chat_msg(chatwin, msg, id, PROF_MSG_PLAIN);
|
||||
free(id);
|
||||
return;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user