[Tkabber-dev] r438 - trunk/plugins/juick

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


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

Modified:
   trunk/plugins/juick/juick.tcl
Log:
Juick: only PM make your juick tab red

Modified: trunk/plugins/juick/juick.tcl
===================================================================
--- trunk/plugins/juick/juick.tcl	2010-11-29 19:10:15 UTC (rev 437)
+++ trunk/plugins/juick/juick.tcl	2010-11-29 22:46:20 UTC (rev 438)
@@ -31,6 +31,9 @@
     hook::add draw_message_hook [namespace current]::handle_message 21
     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
 }
 
 proc unload {} {
@@ -39,6 +42,9 @@
     hook::remove chat_window_click_hook [namespace current]::insert_from_window
     hook::remove chat_win_popup_menu_hook [namespace current]::add_juick_things_menu 20
 
+    hook::remove draw_message_hook [namespace current]::update_juick_tab 8
+    hook::add draw_message_hook ::plugins::update_tab::update 8
+
     ::richtext::entity_state juick_numbers 0
     ::richtext::entity_state citing 0
     ::richtext::entity_state juick 0
@@ -67,6 +73,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