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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Jan 21 01:04:44 MSK 2011


Author: Totktonada
Date: 2011-01-21 01:04:44 +0300 (Fri, 21 Jan 2011)
New Revision: 460

Modified:
   trunk/plugins/juick/juick.tcl
Log:
Drop jabber:x:oob element in messages from Juick

Modified: trunk/plugins/juick/juick.tcl
===================================================================
--- trunk/plugins/juick/juick.tcl	2011-01-17 20:13:58 UTC (rev 459)
+++ trunk/plugins/juick/juick.tcl	2011-01-20 22:04:44 UTC (rev 460)
@@ -82,12 +82,16 @@
     ::richtext::entity_state juick_ligth 0
 }
 
+proc is_juick_jid {jid} {
+    variable options
+    set accept_list [split $options(juick_jids) " "]
+    return [expr [lsearch -exact $accept_list $jid] >= 0]
+}
+
 # Determines whether given chatid correspond to Juick
 proc is_juick {chatid} {
-    variable options
     set jid [chat::get_jid $chatid]
-    set accept_list [split $options(juick_jids) " "]
-    return [expr [lsearch -exact $accept_list $jid] >= 0]
+    return [is_juick_jid $jid]
 #    return [expr [cequal $jid "juick at juick.com/Juick"] || [regexp "juick%juick.com at .+/Juick" $jid]]
 }
 
@@ -169,12 +173,34 @@
 proc rewrite_juick_message \
      {vxlib vfrom vid vtype vis_subject vsubject \
       vbody verr vthread vpriority vx} {
+    upvar 2 $vfrom from
+    upvar 2 $vtype type
     upvar 2 $vbody body
     upvar 2 $vx x
 
+    if {![is_juick_jid $from] || ![cequal $type "chat"]} {
+        return
+    }
+
+#############################
+# Remove jabber:x:oob element
+    set newx {}
+
     foreach xe $x {
         ::xmpp::xml::split $xe tag xmlns attrs cdata subels
 
+        if {![cequal $xmlns "jabber:x:oob"]} {
+            lappend newx $xe
+        }
+    }
+
+    set x $newx
+
+#############################
+# Add GMT time
+    foreach xe $x {
+        ::xmpp::xml::split $xe tag xmlns attrs cdata subels
+
         if {[cequal $xmlns "http://juick.com/message"]} {
             foreach {key val} $attrs {
                 if {[cequal $key "ts"]} {



More information about the Tkabber-dev mailing list