Sun Jun 17 20:08:26 CEST 2007 Jochen Eisinger <coffee@silcnet.org>
authorJochen Eisinger <coffee@silcnet.org>
Sun, 17 Jun 2007 18:09:20 +0000 (18:09 +0000)
committerJochen Eisinger <coffee@silcnet.org>
Sun, 17 Jun 2007 18:09:20 +0000 (18:09 +0000)
* Rewrite signed public message handling, adopting the new
  hilight interface.  Affected file is
  apps/irssi/src/fe-common/silc/fe-silc-messages.c

CHANGES
apps/irssi/src/fe-common/silc/fe-silc-messages.c

diff --git a/CHANGES b/CHANGES
index 50d6dfa5cfe269817bd47c9b405c2218cc47ddad..33b48e66d86eb4edf9e4b7e963100ec01d645401 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+Sun Jun 17 20:08:26 CEST 2007  Jochen Eisinger <coffee@silcnet.org>
+
+       * Rewrite signed public message handling, adopting the new
+         hilight interface.  Affected file is
+         apps/irssi/src/fe-common/silc/fe-silc-messages.c
+
 Thu Jun 14 21:15:31 CEST 2007  Jochen Eisinger <coffee@silcnet.org>
 
        * Fix off by one error when loading modules.  Affected file is
index 7674d904e4559dbf1467547b32c514a4cc10e062..5d87ae25d372ed7cbf5b8c0befb26126352c575a 100644 (file)
@@ -57,6 +57,7 @@ static void sig_signed_message_public(SERVER_REC * server, const char *msg,
   const char *nickmode, *printnick;
   int for_me, print_channel, level;
   char *color, *freemsg = NULL;
+  HILIGHT_REC *hilight;
 
   /* NOTE: this may return NULL if some channel is just closed with
      /WINDOW CLOSE and server still sends the few last messages */
@@ -66,9 +67,9 @@ static void sig_signed_message_public(SERVER_REC * server, const char *msg,
 
   for_me = !settings_get_bool("hilight_nick_matches") ? FALSE :
       nick_match_msg(chanrec, msg, server->nick);
-  color = for_me ? NULL :
-    (char *)hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC,
-                              msg);
+  hilight = for_me ? NULL :
+         hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg);
+  color = (hilight == NULL) ? NULL : hilight_get_color(hilight);
 
   print_channel = chanrec == NULL ||
       !window_item_is_active((WI_ITEM_REC *) chanrec);
@@ -77,7 +78,7 @@ static void sig_signed_message_public(SERVER_REC * server, const char *msg,
     print_channel = TRUE;
 
   level = MSGLEVEL_PUBLIC;
-  if (for_me || color != NULL)
+  if (for_me)
     level |= MSGLEVEL_HILIGHT;
 
   if (settings_get_bool("emphasis"))
@@ -91,35 +92,35 @@ static void sig_signed_message_public(SERVER_REC * server, const char *msg,
   if (printnick == NULL)
     printnick = nick;
 
-  if (!print_channel) {
-    /* message to active channel in window */
-    if (color != NULL) {
-      /* highlighted nick */
-      printformat_module("fe-common/silc", server, target,
-                        level, VERIFIED_MSG(verified, SILCTXT_PUBMSG_HILIGHT),
-                        color, printnick, msg, nickmode);
-    } else {
-      printformat_module("fe-common/silc", server, target, level,
-                        for_me ? VERIFIED_MSG(verified, SILCTXT_PUBMSG_ME) :
-                                 VERIFIED_MSG(verified,SILCTXT_PUBMSG),
-                        printnick, msg, nickmode);
-    }
-  } else {
-    /* message to not existing/active channel */
-    if (color != NULL) {
-      /* highlighted nick */
-      printformat_module("fe-common/silc", server, target, level,
+  if (color != NULL) {
+    /* highlighted nick */
+    TEXT_DEST_REC dest;
+    format_create_dest(&dest, server, target, level, NULL);
+    hilight_update_text_dest(&dest,hilight);
+    if (!print_channel) /* message to active channel in windpw */
+      printformat_module_dest("fe-common/silc", &dest, 
+                VERIFIED_MSG(verified, SILCTXT_PUBMSG_HILIGHT),
+                color, printnick, msg, nickmode);
+    else /* message to not existing/active channel */
+      printformat_module_dest("fe-common/silc", &dest,
                         VERIFIED_MSG(verified, SILCTXT_PUBMSG_HILIGHT_CHANNEL),
                         color, printnick, target, msg, nickmode);
-    } else {
+
+  } else {
+    if (!print_channel)
+      printformat_module("fe-common/silc", server, target, level,
+                for_me ? VERIFIED_MSG(verified, SILCTXT_PUBMSG_ME) :
+                         VERIFIED_MSG(verified,SILCTXT_PUBMSG),
+                printnick, msg, nickmode);
+    else
       printformat_module("fe-common/silc", server, target, level,
                         for_me ? VERIFIED_MSG(verified, SILCTXT_PUBMSG_ME_CHANNEL) :
                         VERIFIED_MSG(verified, SILCTXT_PUBMSG_CHANNEL),
                         printnick, target, msg, nickmode);
-    }
   }
 
   g_free_not_null(freemsg);
+  g_free_not_null(color);
 }
 
 static void sig_signed_message_own_public(SERVER_REC * server,