mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Two carbon logging changes
Add resourcepart to the outgoing carbon that is logged, so we use the correct filenames for MUC PMs. Dont log incoming carbons of MUC PMs as a workaround to faulty server behaviour. See https://wiki.xmpp.org/web/Multi-Session_Nicks#Private_Messages under 'Client-side workaround behavior'. Regards https://github.com/profanity-im/profanity/issues/1214
This commit is contained in:
parent
9788410aaf
commit
5a0a6c97e2
@ -438,8 +438,13 @@ sv_ev_outgoing_carbon(ProfMessage *message)
|
|||||||
chat_state_active(chatwin->state);
|
chat_state_active(chatwin->state);
|
||||||
|
|
||||||
if (message->plain) {
|
if (message->plain) {
|
||||||
|
if (message->mucuser) {
|
||||||
|
// MUC PM, should have resource (nick) in filename
|
||||||
|
chat_log_msg_out(message->jid->barejid, message->plain, message->jid->resourcepart);
|
||||||
|
} else {
|
||||||
chat_log_msg_out(message->jid->barejid, message->plain, NULL);
|
chat_log_msg_out(message->jid->barejid, message->plain, NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBGPGME
|
#ifdef HAVE_LIBGPGME
|
||||||
#ifndef HAVE_OMEMO
|
#ifndef HAVE_OMEMO
|
||||||
@ -519,13 +524,15 @@ sv_ev_outgoing_carbon(ProfMessage *message)
|
|||||||
|
|
||||||
#ifdef HAVE_LIBGPGME
|
#ifdef HAVE_LIBGPGME
|
||||||
static void
|
static void
|
||||||
_sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message)
|
_sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message, gboolean logit)
|
||||||
{
|
{
|
||||||
message->plain = p_gpg_decrypt(message->encrypted);
|
message->plain = p_gpg_decrypt(message->encrypted);
|
||||||
if (message->plain) {
|
if (message->plain) {
|
||||||
message->enc = PROF_MSG_ENC_PGP;
|
message->enc = PROF_MSG_ENC_PGP;
|
||||||
chatwin_incoming_msg(chatwin, message, new_win);
|
chatwin_incoming_msg(chatwin, message, new_win);
|
||||||
|
if (logit) {
|
||||||
chat_log_pgp_msg_in(message);
|
chat_log_pgp_msg_in(message);
|
||||||
|
}
|
||||||
chatwin->pgp_recv = TRUE;
|
chatwin->pgp_recv = TRUE;
|
||||||
p_gpg_free_decrypted(message->plain);
|
p_gpg_free_decrypted(message->plain);
|
||||||
message->plain = NULL;
|
message->plain = NULL;
|
||||||
@ -569,22 +576,26 @@ _sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message
|
|||||||
|
|
||||||
#ifdef HAVE_OMEMO
|
#ifdef HAVE_OMEMO
|
||||||
static void
|
static void
|
||||||
_sv_ev_incoming_omemo(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message)
|
_sv_ev_incoming_omemo(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message, gboolean logit)
|
||||||
{
|
{
|
||||||
chatwin_incoming_msg(chatwin, message, new_win);
|
chatwin_incoming_msg(chatwin, message, new_win);
|
||||||
|
if (logit) {
|
||||||
chat_log_omemo_msg_in(message);
|
chat_log_omemo_msg_in(message);
|
||||||
|
}
|
||||||
chatwin->pgp_recv = FALSE;
|
chatwin->pgp_recv = FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_sv_ev_incoming_plain(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message)
|
_sv_ev_incoming_plain(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message, gboolean logit)
|
||||||
{
|
{
|
||||||
if (message->body) {
|
if (message->body) {
|
||||||
message->enc = PROF_MSG_ENC_PLAIN;
|
message->enc = PROF_MSG_ENC_PLAIN;
|
||||||
message->plain = strdup(message->body);
|
message->plain = strdup(message->body);
|
||||||
chatwin_incoming_msg(chatwin, message, new_win);
|
chatwin_incoming_msg(chatwin, message, new_win);
|
||||||
|
if (logit) {
|
||||||
chat_log_msg_in(message);
|
chat_log_msg_in(message);
|
||||||
|
}
|
||||||
chatwin->pgp_recv = FALSE;
|
chatwin->pgp_recv = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -615,7 +626,7 @@ sv_ev_incoming_message(ProfMessage *message)
|
|||||||
if (chatwin->is_otr) {
|
if (chatwin->is_otr) {
|
||||||
win_println((ProfWin*)chatwin, THEME_DEFAULT, '-', "PGP encrypted message received whilst in OTR session.");
|
win_println((ProfWin*)chatwin, THEME_DEFAULT, '-', "PGP encrypted message received whilst in OTR session.");
|
||||||
} else {
|
} else {
|
||||||
_sv_ev_incoming_pgp(chatwin, new_win, message);
|
_sv_ev_incoming_pgp(chatwin, new_win, message, TRUE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_sv_ev_incoming_otr(chatwin, new_win, message);
|
_sv_ev_incoming_otr(chatwin, new_win, message);
|
||||||
@ -642,9 +653,9 @@ sv_ev_incoming_message(ProfMessage *message)
|
|||||||
#ifdef HAVE_LIBGPGME
|
#ifdef HAVE_LIBGPGME
|
||||||
#ifndef HAVE_OMEMO
|
#ifndef HAVE_OMEMO
|
||||||
if (message->encrypted) {
|
if (message->encrypted) {
|
||||||
_sv_ev_incoming_pgp(chatwin, new_win, message);
|
_sv_ev_incoming_pgp(chatwin, new_win, message, TRUE);
|
||||||
} else {
|
} else {
|
||||||
_sv_ev_incoming_plain(chatwin, new_win, message);
|
_sv_ev_incoming_plain(chatwin, new_win, message, TRUE);
|
||||||
}
|
}
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
return;
|
return;
|
||||||
@ -660,10 +671,10 @@ sv_ev_incoming_message(ProfMessage *message)
|
|||||||
if (chatwin->is_otr) {
|
if (chatwin->is_otr) {
|
||||||
win_println((ProfWin*)chatwin, THEME_DEFAULT, '-', "PGP encrypted message received whilst in OTR session.");
|
win_println((ProfWin*)chatwin, THEME_DEFAULT, '-', "PGP encrypted message received whilst in OTR session.");
|
||||||
} else {
|
} else {
|
||||||
_sv_ev_incoming_pgp(chatwin, new_win, message);
|
_sv_ev_incoming_pgp(chatwin, new_win, message, TRUE);
|
||||||
}
|
}
|
||||||
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
|
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
|
||||||
_sv_ev_incoming_omemo(chatwin, new_win, message);
|
_sv_ev_incoming_omemo(chatwin, new_win, message, TRUE);
|
||||||
} else {
|
} else {
|
||||||
_sv_ev_incoming_otr(chatwin, new_win, message);
|
_sv_ev_incoming_otr(chatwin, new_win, message);
|
||||||
}
|
}
|
||||||
@ -678,7 +689,7 @@ sv_ev_incoming_message(ProfMessage *message)
|
|||||||
#ifndef HAVE_LIBGPGME
|
#ifndef HAVE_LIBGPGME
|
||||||
#ifdef HAVE_OMEMO
|
#ifdef HAVE_OMEMO
|
||||||
if (message->enc == PROF_MSG_ENC_OMEMO) {
|
if (message->enc == PROF_MSG_ENC_OMEMO) {
|
||||||
_sv_ev_incoming_omemo(chatwin, new_win, message);
|
_sv_ev_incoming_omemo(chatwin, new_win, message, TRUE);
|
||||||
} else {
|
} else {
|
||||||
_sv_ev_incoming_otr(chatwin, new_win, message);
|
_sv_ev_incoming_otr(chatwin, new_win, message);
|
||||||
}
|
}
|
||||||
@ -693,11 +704,11 @@ sv_ev_incoming_message(ProfMessage *message)
|
|||||||
#ifdef HAVE_LIBGPGME
|
#ifdef HAVE_LIBGPGME
|
||||||
#ifdef HAVE_OMEMO
|
#ifdef HAVE_OMEMO
|
||||||
if (message->encrypted) {
|
if (message->encrypted) {
|
||||||
_sv_ev_incoming_pgp(chatwin, new_win, message);
|
_sv_ev_incoming_pgp(chatwin, new_win, message, TRUE);
|
||||||
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
|
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
|
||||||
_sv_ev_incoming_omemo(chatwin, new_win, message);
|
_sv_ev_incoming_omemo(chatwin, new_win, message, TRUE);
|
||||||
} else {
|
} else {
|
||||||
_sv_ev_incoming_plain(chatwin, new_win, message);
|
_sv_ev_incoming_plain(chatwin, new_win, message, TRUE);
|
||||||
}
|
}
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
return;
|
return;
|
||||||
@ -710,9 +721,9 @@ sv_ev_incoming_message(ProfMessage *message)
|
|||||||
#ifndef HAVE_LIBGPGME
|
#ifndef HAVE_LIBGPGME
|
||||||
#ifdef HAVE_OMEMO
|
#ifdef HAVE_OMEMO
|
||||||
if (message->enc == PROF_MSG_ENC_OMEMO) {
|
if (message->enc == PROF_MSG_ENC_OMEMO) {
|
||||||
_sv_ev_incoming_omemo(chatwin, new_win, message);
|
_sv_ev_incoming_omemo(chatwin, new_win, message, TRUE);
|
||||||
} else {
|
} else {
|
||||||
_sv_ev_incoming_plain(chatwin, new_win, message);
|
_sv_ev_incoming_plain(chatwin, new_win, message, TRUE);
|
||||||
}
|
}
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
return;
|
return;
|
||||||
@ -724,7 +735,7 @@ sv_ev_incoming_message(ProfMessage *message)
|
|||||||
#ifndef HAVE_LIBOTR
|
#ifndef HAVE_LIBOTR
|
||||||
#ifndef HAVE_LIBGPGME
|
#ifndef HAVE_LIBGPGME
|
||||||
#ifndef HAVE_OMEMO
|
#ifndef HAVE_OMEMO
|
||||||
_sv_ev_incoming_plain(chatwin, new_win, message);
|
_sv_ev_incoming_plain(chatwin, new_win, message, TRUE);
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
@ -753,9 +764,9 @@ sv_ev_incoming_carbon(ProfMessage *message)
|
|||||||
#ifdef HAVE_LIBGPGME
|
#ifdef HAVE_LIBGPGME
|
||||||
#ifndef HAVE_OMEMO
|
#ifndef HAVE_OMEMO
|
||||||
if (message->encrypted) {
|
if (message->encrypted) {
|
||||||
_sv_ev_incoming_pgp(chatwin, new_win, message);
|
_sv_ev_incoming_pgp(chatwin, new_win, message, FALSE);
|
||||||
} else {
|
} else {
|
||||||
_sv_ev_incoming_plain(chatwin, new_win, message);
|
_sv_ev_incoming_plain(chatwin, new_win, message, FALSE);
|
||||||
}
|
}
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
return;
|
return;
|
||||||
@ -765,11 +776,11 @@ sv_ev_incoming_carbon(ProfMessage *message)
|
|||||||
#ifdef HAVE_LIBGPGME
|
#ifdef HAVE_LIBGPGME
|
||||||
#ifdef HAVE_OMEMO
|
#ifdef HAVE_OMEMO
|
||||||
if (message->encrypted) {
|
if (message->encrypted) {
|
||||||
_sv_ev_incoming_pgp(chatwin, new_win, message);
|
_sv_ev_incoming_pgp(chatwin, new_win, message, FALSE);
|
||||||
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
|
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
|
||||||
_sv_ev_incoming_omemo(chatwin, new_win, message);
|
_sv_ev_incoming_omemo(chatwin, new_win, message, FALSE);
|
||||||
} else {
|
} else {
|
||||||
_sv_ev_incoming_plain(chatwin, new_win, message);
|
_sv_ev_incoming_plain(chatwin, new_win, message, FALSE);
|
||||||
}
|
}
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
return;
|
return;
|
||||||
@ -779,9 +790,9 @@ sv_ev_incoming_carbon(ProfMessage *message)
|
|||||||
#ifndef HAVE_LIBGPGME
|
#ifndef HAVE_LIBGPGME
|
||||||
#ifdef HAVE_OMEMO
|
#ifdef HAVE_OMEMO
|
||||||
if (message->enc == PROF_MSG_ENC_OMEMO) {
|
if (message->enc == PROF_MSG_ENC_OMEMO) {
|
||||||
_sv_ev_incoming_omemo(chatwin, new_win, message);
|
_sv_ev_incoming_omemo(chatwin, new_win, message, FALSE);
|
||||||
} else {
|
} else {
|
||||||
_sv_ev_incoming_plain(chatwin, new_win, message);
|
_sv_ev_incoming_plain(chatwin, new_win, message, FALSE);
|
||||||
}
|
}
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
return;
|
return;
|
||||||
@ -790,7 +801,7 @@ sv_ev_incoming_carbon(ProfMessage *message)
|
|||||||
|
|
||||||
#ifndef HAVE_LIBGPGME
|
#ifndef HAVE_LIBGPGME
|
||||||
#ifndef HAVE_OMEMO
|
#ifndef HAVE_OMEMO
|
||||||
_sv_ev_incoming_plain(chatwin, new_win, message);
|
_sv_ev_incoming_plain(chatwin, new_win, message, FALSE);
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user