mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Ensure encrypted carbon of own message are marked as encrypted
This commit is contained in:
parent
daf84ced0c
commit
2015ba201d
@ -387,7 +387,7 @@ sv_ev_delayed_private_message(const char *const fulljid, char *message, GDateTim
|
||||
}
|
||||
|
||||
void
|
||||
sv_ev_outgoing_carbon(char *barejid, char *message, char *pgp_message)
|
||||
sv_ev_outgoing_carbon(char *barejid, char *message, char *pgp_message, gboolean omemo)
|
||||
{
|
||||
ProfChatWin *chatwin = wins_get_chat(barejid);
|
||||
if (!chatwin) {
|
||||
@ -397,6 +397,7 @@ sv_ev_outgoing_carbon(char *barejid, char *message, char *pgp_message)
|
||||
chat_state_active(chatwin->state);
|
||||
|
||||
#ifdef HAVE_LIBGPGME
|
||||
#ifndef HAVE_OMEMO
|
||||
if (pgp_message) {
|
||||
char *decrypted = p_gpg_decrypt(pgp_message);
|
||||
if (decrypted) {
|
||||
@ -407,9 +408,44 @@ sv_ev_outgoing_carbon(char *barejid, char *message, char *pgp_message)
|
||||
} else {
|
||||
chatwin_outgoing_carbon(chatwin, message, PROF_MSG_PLAIN);
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIBGPGME
|
||||
#ifdef HAVE_OMEMO
|
||||
if (omemo) {
|
||||
chatwin_outgoing_carbon(chatwin, message, PROF_MSG_OMEMO);
|
||||
} else {
|
||||
chatwin_outgoing_carbon(chatwin, message, PROF_MSG_PLAIN);
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBGPGME
|
||||
#ifdef HAVE_OMEMO
|
||||
if (omemo) {
|
||||
chatwin_outgoing_carbon(chatwin, message, PROF_MSG_OMEMO);
|
||||
} else if (pgp_message) {
|
||||
char *decrypted = p_gpg_decrypt(pgp_message);
|
||||
if (decrypted) {
|
||||
chatwin_outgoing_carbon(chatwin, decrypted, PROF_MSG_PGP);
|
||||
} else {
|
||||
chatwin_outgoing_carbon(chatwin, message, PROF_MSG_PLAIN);
|
||||
}
|
||||
} else {
|
||||
chatwin_outgoing_carbon(chatwin, message, PROF_MSG_PLAIN);
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIBGPGME
|
||||
#ifndef HAVE_OMEMO
|
||||
chatwin_outgoing_carbon(chatwin, message, PROF_MSG_PLAIN);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBGPGME
|
||||
|
@ -73,7 +73,7 @@ void sv_ev_room_occupent_kicked(const char *const room, const char *const nick,
|
||||
void sv_ev_room_banned(const char *const room, const char *const actor, const char *const reason);
|
||||
void sv_ev_room_occupent_banned(const char *const room, const char *const nick, const char *const actor,
|
||||
const char *const reason);
|
||||
void sv_ev_outgoing_carbon(char *barejid, char *message, char *pgp_message);
|
||||
void sv_ev_outgoing_carbon(char *barejid, char *message, char *pgp_message, gboolean omemo);
|
||||
void sv_ev_incoming_carbon(char *barejid, char *resource, char *message, char *pgp_message, gboolean omemo);
|
||||
void sv_ev_xmpp_stanza(const char *const msg);
|
||||
void sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean config_required,
|
||||
|
@ -324,6 +324,8 @@ chatwin_outgoing_carbon(ProfChatWin *chatwin, const char *const message, prof_en
|
||||
char enc_char = '-';
|
||||
if (enc_mode == PROF_MSG_PGP) {
|
||||
enc_char = prefs_get_pgp_char();
|
||||
} else if (enc_mode == PROF_MSG_OMEMO) {
|
||||
enc_char = prefs_get_omemo_char();
|
||||
}
|
||||
|
||||
ProfWin *window = (ProfWin*)chatwin;
|
||||
|
@ -932,7 +932,7 @@ _handle_carbons(xmpp_stanza_t *const stanza)
|
||||
|
||||
// else treat as a sent message
|
||||
} else {
|
||||
sv_ev_outgoing_carbon(jid_to->barejid, message_txt, enc_message);
|
||||
sv_ev_outgoing_carbon(jid_to->barejid, message_txt, enc_message, omemo);
|
||||
}
|
||||
|
||||
xmpp_ctx_t *ctx = connection_get_ctx();
|
||||
|
Loading…
Reference in New Issue
Block a user