[Tkabber-dev] r173 - branches/plugins-0.11.1/urgent

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Feb 19 13:25:54 MSK 2009


Author: kostix
Date: 2009-02-19 13:25:54 +0300 (Thu, 19 Feb 2009)
New Revision: 173

Modified:
   branches/plugins-0.11.1/urgent/urgent.tcl
Log:
Backported "urgent" plugin to 0.11.1 (and older)

Modified: branches/plugins-0.11.1/urgent/urgent.tcl
===================================================================
--- branches/plugins-0.11.1/urgent/urgent.tcl	2009-02-19 10:08:00 UTC (rev 172)
+++ branches/plugins-0.11.1/urgent/urgent.tcl	2009-02-19 10:25:54 UTC (rev 173)
@@ -36,12 +36,24 @@
 	-group Urgent
 }
 
+proc urgent::is_delayed {xml} {
+    foreach xelem $xml {
+	::jlib::wrapper:splitxml $xelem tag vars isempty chdata children
+	switch -- [::jlib::wrapper:getattr $vars xmlns] {
+	    urn:xmpp:delay -
+	    jabber:x:delay {
+		return 1
+	    }
+	}
+    }
+    return 0
+}
 proc urgent::chat_message_notify {chatid from type body extras} {
     variable options
 
     if {!$options(enabled)} return
 
-    set delayed [::xmpp::delay::exists $extras]
+    set delayed [is_delayed $extras]
     if {$delayed} return
 
     switch -- $type {
@@ -65,10 +77,10 @@
 	    }
 	}
 	chat {
+	    # Handle special tag indicating history messages:
 	    foreach xelem $extras {
-		::xmpp::xml::split $xelem tag xmlns attrs cdata subels
-		# Don't play sound if this 'empty' tag is present. It indicates
-		# messages history in chat window.
+		::jlib::wrapper:splitxml $xelem tag vars ? ? ?
+		set xmlns [::jlib::wrapper:getattr $vars xmlns]
 		if {[string equal $tag ""] && \
 				    [string equal $xmlns tkabber:x:nolog]} {
 		    return



More information about the Tkabber-dev mailing list