# HG changeset patch # User Mikael Berthe # Date 1128628294 -7200 # Node ID 00e2d3821a5b2127356adec42068e864c30a94a4 # Parent 4a10c04ac2fbca9f0a184ed863de3526160c8186 Display PRIV for private messages in a room when using /say_to Private conf. messages are not logged. diff -r 4a10c04ac2fb -r 00e2d3821a5b mcabber/src/commands.c --- a/mcabber/src/commands.c Wed Oct 05 21:46:13 2005 +0200 +++ b/mcabber/src/commands.c Thu Oct 06 21:51:34 2005 +0200 @@ -252,7 +252,7 @@ if (buddy_gettype(BUDDATA(current_buddy)) != ROSTER_TYPE_ROOM) { // local part (UI, logging, etc.) - hk_message_out(jid, 0, msg); + hk_message_out(jid, NULL, 0, msg); } // Network part @@ -693,8 +693,15 @@ // Jump to window, create one if needed scr_RosterJumpJid(bare_jid); + // Check if we're sending a message to a conference room + // If not, we must make sure p is NULL, for hk_message_out() + if (p) { + if (roster_find(bare_jid, jidsearch, ROSTER_TYPE_ROOM)) p++; + else p = NULL; + } + // local part (UI, logging, etc.) - hk_message_out(bare_jid, 0, msg); + hk_message_out(bare_jid, p, 0, msg); // Network part jb_send_msg(jid, msg, ROSTER_TYPE_USER, NULL); diff -r 4a10c04ac2fb -r 00e2d3821a5b mcabber/src/hooks.c --- a/mcabber/src/hooks.c Wed Oct 05 21:46:13 2005 +0200 +++ b/mcabber/src/hooks.c Thu Oct 06 21:51:34 2005 +0200 @@ -113,12 +113,27 @@ if (bmsg) g_free(bmsg); } -inline void hk_message_out(const char *jid, time_t timestamp, const char *msg) +// hk_message_out() +// nick should be set for private messages in a chat room, and null for +// normal messages. +inline void hk_message_out(const char *jid, const char *nick, + time_t timestamp, const char *msg) { - scr_WriteOutgoingMessage(jid, msg); - hlog_write_message(jid, timestamp, TRUE, msg); + char *wmsg = NULL, *bmsg = NULL; + + if (nick) { + wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", nick, msg); + } else { + wmsg = (char*)msg; + // We don't log private messages + hlog_write_message(jid, timestamp, TRUE, msg); + } + + scr_WriteOutgoingMessage(jid, wmsg); // External command hk_ext_cmd(jid, 'M', 'S', NULL); + + if (bmsg) g_free(bmsg); } inline void hk_statuschange(const char *jid, const char *resname, gchar prio, diff -r 4a10c04ac2fb -r 00e2d3821a5b mcabber/src/hooks.h --- a/mcabber/src/hooks.h Wed Oct 05 21:46:13 2005 +0200 +++ b/mcabber/src/hooks.h Thu Oct 06 21:51:34 2005 +0200 @@ -7,7 +7,8 @@ inline void hk_message_in(const char *jid, const char *resname, time_t timestamp, const char *msg, const char *type); -inline void hk_message_out(const char *jid, time_t timestamp, const char *msg); +inline void hk_message_out(const char *jid, const char *nickname, + time_t timestamp, const char *msg); inline void hk_statuschange(const char *jid, const char *resname, gchar prio, time_t timestamp, enum imstatus status, char const *status_msg);