diff mcabber/src/hooks.c @ 484:00e2d3821a5b

Display PRIV for private messages in a room when using /say_to Private conf. messages are not logged.
author Mikael Berthe <mikael@lilotux.net>
date Thu, 06 Oct 2005 21:51:34 +0200
parents 4a10c04ac2fb
children 55aa45eb7ece
line wrap: on
line diff
--- 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,