mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Actually log MUC PM messages
If I'm not mistaken MUC PMs have not been logged at all if there was no other client sending carbons. This should add MUC PM logging functionality. We still need to make sure carbons log to the same file. Regards https://github.com/profanity-im/profanity/issues/1214
This commit is contained in:
parent
f186eb94da
commit
8c8c18c6fd
@ -151,7 +151,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt);
|
||||
if (!handled) {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
@ -171,7 +171,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt);
|
||||
if (!handled) {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
@ -194,7 +194,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
free(id);
|
||||
} else {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
@ -217,7 +217,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
free(id);
|
||||
} else {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
@ -242,7 +242,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt);
|
||||
if (!handled) {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
@ -271,7 +271,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
free(id);
|
||||
} else {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
@ -289,19 +289,19 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
#ifdef HAVE_OMEMO
|
||||
if (chatwin->is_omemo) {
|
||||
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg);
|
||||
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg, NULL);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_OMEMO, request_receipt);
|
||||
free(id);
|
||||
} else if (chatwin->pgp_send) {
|
||||
char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt);
|
||||
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg);
|
||||
chat_log_pgp_msg_out(chatwin->barejid, plugin_msg, NULL);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PGP, request_receipt);
|
||||
free(id);
|
||||
} else {
|
||||
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt);
|
||||
if (!handled) {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
}
|
||||
@ -319,7 +319,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
#ifndef HAVE_LIBGPGME
|
||||
#ifndef HAVE_OMEMO
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg, NULL);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
free(id);
|
||||
|
||||
@ -378,11 +378,15 @@ cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char *const msg, const char *
|
||||
privwin_message_left_room(privwin);
|
||||
} else {
|
||||
char *plugin_msg = plugins_pre_priv_message_send(privwin->fulljid, msg);
|
||||
Jid *jidp = jid_create(privwin->fulljid);
|
||||
|
||||
message_send_private(privwin->fulljid, plugin_msg, oob_url);
|
||||
chat_log_msg_out(jidp->barejid, plugin_msg, jidp->resourcepart);
|
||||
privwin_outgoing_msg(privwin, plugin_msg);
|
||||
|
||||
plugins_post_priv_message_send(privwin->fulljid, plugin_msg);
|
||||
|
||||
free(plugin_msg);
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
}
|
||||
|
@ -398,6 +398,7 @@ sv_ev_incoming_private_message(ProfMessage *message)
|
||||
privatewin = (ProfPrivateWin*)window;
|
||||
}
|
||||
privwin_incoming_msg(privatewin, message);
|
||||
chat_log_msg_in(message);
|
||||
|
||||
plugins_post_priv_message_display(message->jid->fulljid, message->plain);
|
||||
|
||||
@ -436,7 +437,7 @@ sv_ev_outgoing_carbon(ProfMessage *message)
|
||||
chat_state_active(chatwin->state);
|
||||
|
||||
if (message->plain) {
|
||||
chat_log_msg_out(message->jid->barejid, message->plain);
|
||||
chat_log_msg_out(message->jid->barejid, message->plain, NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBGPGME
|
||||
|
22
src/log.c
22
src/log.c
@ -267,27 +267,27 @@ groupchat_log_init(void)
|
||||
}
|
||||
|
||||
void
|
||||
chat_log_msg_out(const char *const barejid, const char *const msg)
|
||||
chat_log_msg_out(const char *const barejid, const char *const msg, const char *const resource)
|
||||
{
|
||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = connection_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
_chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL, NULL);
|
||||
_chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL, resource);
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
chat_log_otr_msg_out(const char *const barejid, const char *const msg)
|
||||
chat_log_otr_msg_out(const char *const barejid, const char *const msg, const char *const resource)
|
||||
{
|
||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = connection_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
|
||||
if (strcmp(pref_otr_log, "on") == 0) {
|
||||
_chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL, NULL);
|
||||
_chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL, resource);
|
||||
} else if (strcmp(pref_otr_log, "redact") == 0) {
|
||||
_chat_log_chat(jidp->barejid, barejid, "[redacted]", PROF_OUT_LOG, NULL, NULL);
|
||||
_chat_log_chat(jidp->barejid, barejid, "[redacted]", PROF_OUT_LOG, NULL, resource);
|
||||
}
|
||||
prefs_free_string(pref_otr_log);
|
||||
jid_destroy(jidp);
|
||||
@ -295,16 +295,16 @@ chat_log_otr_msg_out(const char *const barejid, const char *const msg)
|
||||
}
|
||||
|
||||
void
|
||||
chat_log_pgp_msg_out(const char *const barejid, const char *const msg)
|
||||
chat_log_pgp_msg_out(const char *const barejid, const char *const msg, const char *const resource)
|
||||
{
|
||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = connection_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
char *pref_pgp_log = prefs_get_string(PREF_PGP_LOG);
|
||||
if (strcmp(pref_pgp_log, "on") == 0) {
|
||||
_chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL, NULL);
|
||||
_chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL, resource);
|
||||
} else if (strcmp(pref_pgp_log, "redact") == 0) {
|
||||
_chat_log_chat(jidp->barejid, barejid, "[redacted]", PROF_OUT_LOG, NULL, NULL);
|
||||
_chat_log_chat(jidp->barejid, barejid, "[redacted]", PROF_OUT_LOG, NULL, resource);
|
||||
}
|
||||
prefs_free_string(pref_pgp_log);
|
||||
jid_destroy(jidp);
|
||||
@ -312,16 +312,16 @@ chat_log_pgp_msg_out(const char *const barejid, const char *const msg)
|
||||
}
|
||||
|
||||
void
|
||||
chat_log_omemo_msg_out(const char *const barejid, const char *const msg)
|
||||
chat_log_omemo_msg_out(const char *const barejid, const char *const msg, const char *const resource)
|
||||
{
|
||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = connection_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
char *pref_omemo_log = prefs_get_string(PREF_OMEMO_LOG);
|
||||
if (strcmp(pref_omemo_log, "on") == 0) {
|
||||
_chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL, NULL);
|
||||
_chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL, resource);
|
||||
} else if (strcmp(pref_omemo_log, "redact") == 0) {
|
||||
_chat_log_chat(jidp->barejid, barejid, "[redacted]", PROF_OUT_LOG, NULL, NULL);
|
||||
_chat_log_chat(jidp->barejid, barejid, "[redacted]", PROF_OUT_LOG, NULL, resource);
|
||||
}
|
||||
prefs_free_string(pref_omemo_log);
|
||||
jid_destroy(jidp);
|
||||
|
@ -70,10 +70,10 @@ void log_stderr_handler(void);
|
||||
|
||||
void chat_log_init(void);
|
||||
|
||||
void chat_log_msg_out(const char *const barejid, const char *const msg);
|
||||
void chat_log_otr_msg_out(const char *const barejid, const char *const msg);
|
||||
void chat_log_pgp_msg_out(const char *const barejid, const char *const msg);
|
||||
void chat_log_omemo_msg_out(const char *const barejid, const char *const msg);
|
||||
void chat_log_msg_out(const char *const barejid, const char *const msg, const char *resource);
|
||||
void chat_log_otr_msg_out(const char *const barejid, const char *const msg, const char *resource);
|
||||
void chat_log_pgp_msg_out(const char *const barejid, const char *const msg, const char *resource);
|
||||
void chat_log_omemo_msg_out(const char *const barejid, const char *const msg, const char *resource);
|
||||
|
||||
void chat_log_msg_in(ProfMessage *message);
|
||||
void chat_log_otr_msg_in(ProfMessage *message);
|
||||
|
@ -346,7 +346,7 @@ otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean re
|
||||
char *encrypted = otr_encrypt_message(chatwin->barejid, message);
|
||||
if (encrypted) {
|
||||
id = message_send_chat_otr(chatwin->barejid, encrypted, request_receipt);
|
||||
chat_log_otr_msg_out(chatwin->barejid, message);
|
||||
chat_log_otr_msg_out(chatwin->barejid, message, NULL);
|
||||
chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_ENC_OTR, request_receipt);
|
||||
otr_free_message(encrypted);
|
||||
free(id);
|
||||
@ -368,7 +368,7 @@ otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean re
|
||||
char *otr_tagged_msg = otr_tag_message(message);
|
||||
id = message_send_chat_otr(chatwin->barejid, otr_tagged_msg, request_receipt);
|
||||
chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_ENC_PLAIN, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, message);
|
||||
chat_log_msg_out(chatwin->barejid, message, NULL);
|
||||
free(otr_tagged_msg);
|
||||
free(id);
|
||||
return TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user