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

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


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

Modified:
   branches/plugins-0.11.1/juick/juick.tcl
Log:
Juick, tkabber-0.11.1: add star to title only if message from juick is PM

Modified: branches/plugins-0.11.1/juick/juick.tcl
===================================================================
--- branches/plugins-0.11.1/juick/juick.tcl	2010-11-30 01:38:30 UTC (rev 440)
+++ branches/plugins-0.11.1/juick/juick.tcl	2010-11-30 01:38:59 UTC (rev 441)
@@ -19,6 +19,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
+
 # Determines whether given chatid correspond to Juick
 proc is_juick {chatid} {
     set jid [chat::get_jid $chatid]
@@ -70,6 +73,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