mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 15:16:21 +00:00
Log and print outgoing encrypted message
This commit is contained in:
@@ -218,7 +218,10 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
#ifndef HAVE_LIBGPGME
|
||||
#ifdef HAVE_OMEMO
|
||||
if (chatwin->is_omemo) {
|
||||
omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_OMEMO, request_receipt);
|
||||
free(id);
|
||||
} else {
|
||||
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt);
|
||||
chat_log_msg_out(chatwin->barejid, plugin_msg);
|
||||
@@ -238,7 +241,10 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
#ifndef HAVE_LIBGPGME
|
||||
#ifdef HAVE_OMEMO
|
||||
if (chatwin->is_omemo) {
|
||||
omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_OMEMO, request_receipt);
|
||||
free(id);
|
||||
} else {
|
||||
gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt);
|
||||
if (!handled) {
|
||||
@@ -261,7 +267,10 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
#ifdef HAVE_LIBGPGME
|
||||
#ifdef HAVE_OMEMO
|
||||
if (chatwin->is_omemo) {
|
||||
omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_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);
|
||||
@@ -286,7 +295,10 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo
|
||||
#ifdef HAVE_LIBGPGME
|
||||
#ifdef HAVE_OMEMO
|
||||
if (chatwin->is_omemo) {
|
||||
omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE);
|
||||
chat_log_omemo_msg_out(chatwin->barejid, plugin_msg);
|
||||
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_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);
|
||||
@@ -336,9 +348,14 @@ cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const
|
||||
|
||||
#ifdef HAVE_OMEMO
|
||||
if (mucwin->is_omemo) {
|
||||
omemo_on_message_send((ProfWin *)mucwin, plugin_msg, FALSE, TRUE);
|
||||
char *id = omemo_on_message_send((ProfWin *)mucwin, plugin_msg, FALSE, TRUE);
|
||||
groupchat_log_omemo_msg_out(mucwin->roomjid, plugin_msg);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, PROF_MSG_OMEMO);
|
||||
free(id);
|
||||
} else {
|
||||
message_send_groupchat(mucwin->roomjid, plugin_msg, oob_url);
|
||||
groupchat_log_msg_out(mucwin->roomjid, plugin_msg);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, PROF_MSG_PLAIN);
|
||||
}
|
||||
|
||||
plugins_post_room_message_send(mucwin->roomjid, plugin_msg);
|
||||
@@ -348,6 +365,8 @@ cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const
|
||||
|
||||
#ifndef HAVE_OMEMO
|
||||
message_send_groupchat(mucwin->roomjid, plugin_msg, oob_url);
|
||||
groupchat_log_msg_out(mucwin->roomjid, plugin_msg);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt);
|
||||
|
||||
plugins_post_room_message_send(mucwin->roomjid, plugin_msg);
|
||||
free(plugin_msg);
|
||||
|
||||
@@ -260,21 +260,26 @@ sv_ev_room_history(const char *const room_jid, const char *const nick,
|
||||
}
|
||||
|
||||
void
|
||||
sv_ev_room_message(const char *const room_jid, const char *const nick, const char *const message)
|
||||
sv_ev_room_message(const char *const room_jid, const char *const nick, const char *const message, gboolean omemo)
|
||||
{
|
||||
if (prefs_get_boolean(PREF_GRLOG)) {
|
||||
Jid *jid = jid_create(connection_get_fulljid());
|
||||
groupchat_log_chat(jid->barejid, room_jid, nick, message);
|
||||
jid_destroy(jid);
|
||||
}
|
||||
|
||||
ProfMucWin *mucwin = wins_get_muc(room_jid);
|
||||
if (!mucwin) {
|
||||
return;
|
||||
}
|
||||
|
||||
char *new_message = plugins_pre_room_message_display(room_jid, nick, message);
|
||||
char *mynick = muc_nick(mucwin->roomjid);
|
||||
if (g_strcmp0(mynick, nick) == 0) {
|
||||
/* Ignore message reflection */
|
||||
return;
|
||||
}
|
||||
|
||||
if (omemo) {
|
||||
groupchat_log_omemo_msg_in(room_jid, nick, message);
|
||||
} else {
|
||||
groupchat_log_msg_in(room_jid, nick, message);
|
||||
}
|
||||
|
||||
char *new_message = plugins_pre_room_message_display(room_jid, nick, message);
|
||||
|
||||
gboolean whole_word = prefs_get_boolean(PREF_NOTIFY_MENTION_WHOLE_WORD);
|
||||
gboolean case_sensitive = prefs_get_boolean(PREF_NOTIFY_MENTION_CASE_SENSITIVE);
|
||||
@@ -289,7 +294,11 @@ sv_ev_room_message(const char *const room_jid, const char *const nick, const cha
|
||||
|
||||
GList *triggers = prefs_message_get_triggers(new_message);
|
||||
|
||||
mucwin_message(mucwin, nick, new_message, mentions, triggers);
|
||||
if (omemo) {
|
||||
mucwin_incoming_msg(mucwin, nick, new_message, mentions, triggers, PROF_MSG_OMEMO);
|
||||
} else {
|
||||
mucwin_incoming_msg(mucwin, nick, new_message, mentions, triggers, PROF_MSG_PLAIN);
|
||||
}
|
||||
|
||||
g_slist_free(mentions);
|
||||
|
||||
@@ -607,15 +616,50 @@ sv_ev_incoming_carbon(char *barejid, char *resource, char *message, char *pgp_me
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBGPGME
|
||||
#ifndef HAVE_OMEMO
|
||||
if (pgp_message) {
|
||||
_sv_ev_incoming_pgp(chatwin, new_win, barejid, resource, message, pgp_message, NULL);
|
||||
} else {
|
||||
_sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, NULL);
|
||||
}
|
||||
#else
|
||||
_sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, NULL);
|
||||
#endif
|
||||
rosterwin_roster();
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBGPGME
|
||||
#ifdef HAVE_OMEMO
|
||||
if (pgp_message) {
|
||||
_sv_ev_incoming_pgp(chatwin, new_win, barejid, resource, message, pgp_message, NULL);
|
||||
} else if (omemo) {
|
||||
_sv_ev_incoming_omemo(chatwin, new_win, barejid, resource, message, NULL);
|
||||
} else {
|
||||
_sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, NULL);
|
||||
}
|
||||
rosterwin_roster();
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIBGPGME
|
||||
#ifdef HAVE_OMEMO
|
||||
if (omemo) {
|
||||
_sv_ev_incoming_omemo(chatwin, new_win, barejid, resource, message, NULL);
|
||||
} else {
|
||||
_sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, NULL);
|
||||
}
|
||||
rosterwin_roster();
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIBGPGME
|
||||
#ifndef HAVE_OMEMO
|
||||
_sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, NULL);
|
||||
rosterwin_roster();
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -46,9 +46,9 @@ void sv_ev_room_invite(jabber_invite_t invite_type,
|
||||
void sv_ev_room_broadcast(const char *const room_jid, const char *const message);
|
||||
void sv_ev_room_subject(const char *const room, const char *const nick, const char *const subject);
|
||||
void sv_ev_room_history(const char *const room_jid, const char *const nick,
|
||||
GDateTime *timestamp, const char *const message);
|
||||
GDateTime *timestamp, const char *const message, gboolean omemo);
|
||||
void sv_ev_room_message(const char *const room_jid, const char *const nick,
|
||||
const char *const message);
|
||||
const char *const message, gboolean omemo);
|
||||
void sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_message, GDateTime *timestamp, gboolean omemo);
|
||||
void sv_ev_incoming_private_message(const char *const fulljid, char *message);
|
||||
void sv_ev_delayed_private_message(const char *const fulljid, char *message, GDateTime *timestamp);
|
||||
|
||||
Reference in New Issue
Block a user