mcabber/src/hooks.c
changeset 485 55aa45eb7ece
parent 484 00e2d3821a5b
child 489 21ab22a60bcb
--- a/mcabber/src/hooks.c	Thu Oct 06 21:51:34 2005 +0200
+++ b/mcabber/src/hooks.c	Fri Oct 07 18:52:37 2005 +0200
@@ -121,15 +121,17 @@
 {
   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);
-  }
+  if (nick) wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", nick, msg);
+  else      wmsg = (char*)msg;
 
+  // Note: the hlog_write should not be called first, because in some
+  // cases scr_WriteOutgoingMessage() will load the history and we'd
+  // have the message twice...
   scr_WriteOutgoingMessage(jid, wmsg);
+
+  // We don't log private messages
+  if (!nick) hlog_write_message(jid, timestamp, TRUE, msg);
+
   // External command
   hk_ext_cmd(jid, 'M', 'S', NULL);