[Tkabber-dev] r439 - branches/plugins-0.11.1/juick

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Nov 30 01:46:50 MSK 2010


Author: Totktonada
Date: 2010-11-30 01:46:50 +0300 (Tue, 30 Nov 2010)
New Revision: 439

Modified:
   branches/plugins-0.11.1/juick/juick.tcl
Log:
Juick, tkabber-0.11.1: only PM make your juick tab red

Modified: branches/plugins-0.11.1/juick/juick.tcl
===================================================================
--- branches/plugins-0.11.1/juick/juick.tcl	2010-11-29 22:46:20 UTC (rev 438)
+++ branches/plugins-0.11.1/juick/juick.tcl	2010-11-29 22:46:50 UTC (rev 439)
@@ -16,6 +16,9 @@
 hook::add chat_window_click_hook [namespace current]::insert_from_window
 hook::add chat_win_popup_menu_hook [namespace current]::add_juick_things_menu 20
 
+hook::add draw_message_hook [namespace current]::update_juick_tab 8
+hook::remove draw_message_hook ::plugins::update_tab::update 8
+
 # Determines whether given chatid correspond to Juick
 proc is_juick {chatid} {
     set jid [chat::get_jid $chatid]
@@ -38,6 +41,29 @@
     }
 }
 
+proc update_juick_tab {chatid from type body x} {
+    if {![is_juick $chatid] || ![cequal $type "chat"]} {
+        ::plugins::update_tab::update $chatid $from $type $body $x
+        return
+    }
+
+    # See ${PATH_TO_TKABBER}/plugins/chat/update_tab.tcl
+    foreach xelem $x {
+        ::xmpp::xml::split $xelem tag xmlns attrs cdata subels
+        if {[string equal $tag ""] && [string equal $xmlns tkabber:x:nolog]} {
+            return
+        }
+    }
+
+    set cw [chat::winid $chatid]
+
+    if {[regexp {^Private message from @.+:\n} $body]} {
+        tab_set_updated $cw 1 mesg_to_user
+    } else {
+        tab_set_updated $cw 1 message
+    }
+}
+
 proc ignore_server_messages {chatid from type body x} {
     if {[is_juick $chatid] && $from == ""} {
         return stop;



More information about the Tkabber-dev mailing list