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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Nov 30 04:38:30 MSK 2010


Author: Totktonada
Date: 2010-11-30 04:38:30 +0300 (Tue, 30 Nov 2010)
New Revision: 440

Modified:
   trunk/plugins/juick/juick.tcl
Log:
Juick: add star to title only if message from juick is PM

Modified: trunk/plugins/juick/juick.tcl
===================================================================
--- trunk/plugins/juick/juick.tcl	2010-11-29 22:46:50 UTC (rev 439)
+++ trunk/plugins/juick/juick.tcl	2010-11-30 01:38:30 UTC (rev 440)
@@ -34,6 +34,9 @@
 
     hook::add draw_message_hook [namespace current]::update_juick_tab 8
     hook::remove draw_message_hook ::plugins::update_tab::update 8
+
+    hook::add draw_message_hook [namespace current]::add_number_of_messages_from_juick_to_title 18
+    hook::remove draw_message_hook ::::ifacetk::add_number_of_messages_to_title 18
 }
 
 proc unload {} {
@@ -45,6 +48,9 @@
     hook::remove draw_message_hook [namespace current]::update_juick_tab 8
     hook::add draw_message_hook ::plugins::update_tab::update 8
 
+    hook::remove draw_message_hook [namespace current]::add_number_of_messages_from_juick_to_title 18
+    hook::add draw_message_hook ::::ifacetk::add_number_of_messages_to_title 18
+
     ::richtext::entity_state juick_numbers 0
     ::richtext::entity_state citing 0
     ::richtext::entity_state juick 0
@@ -102,6 +108,49 @@
     }
 }
 
+proc add_number_of_messages_from_juick_to_title {chatid from type body x} {
+    if {![is_juick $chatid] || ![cequal $type "chat"]} {
+        ::ifacetk::add_number_of_messages_to_title $chatid $from $type $body $x
+        return
+    }
+
+    # See ${PATH_TO_TKABBER}/ifacetk/iface.tcl
+    foreach xelem $x {
+        ::xmpp::xml::split $xelem tag xmlns attrs cdata subels
+        if {[string equal $tag ""] && [string equal $xmlns tkabber:x:nolog]} {
+            return
+        }
+    }
+
+    if {[::ifacetk::chat_window_is_active $chatid]} return
+    if {$from == ""} return
+
+    variable ::ifacetk::number_msg
+    variable ::ifacetk::personal_msg
+
+    incr number_msg($chatid)
+
+    if {[regexp {^Private message from @.+:\n} $body]} {
+        incr personal_msg($chatid)
+    }
+
+    ::ifacetk::update_chat_title $chatid
+    ::ifacetk::update_main_window_title
+}
+
+#proc rewrite_message \
+#     {vxlib vfrom vid vtype vis_subject vsubject \
+#      vbody verr vthread vpriority vx} {
+#    upvar 2 $vfrom from
+#    upvar 2 $vtype type
+#
+#    foreach xe $x {
+#        ::xmpp::xml::split $xe tag xmlns attrs cdata subels
+#
+#        switch -- $xmlns
+#        }
+#}
+
 proc insert_from_window {chatid w x y} {
     set thing ""
     set cw [chat::chat_win $chatid]



More information about the Tkabber-dev mailing list