From d823d50386c28a585596928b69e860725f18dcf0 Mon Sep 17 00:00:00 2001 From: kostix Date: Thu, 19 Feb 2009 10:25:54 +0000 Subject: Backported "urgent" plugin to 0.11.1 (and older) git-svn-id: http://svn.xmpp.ru/repos/tkabber-3rd-party/branches/plugins-0.11.1/urgent@173 cc602e41-bd33-0410-9637-a208f32f1443 --- urgent.tcl | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/urgent.tcl b/urgent.tcl index 4242987..e782bf4 100644 --- a/urgent.tcl +++ b/urgent.tcl @@ -36,12 +36,24 @@ namespace eval urgent { -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 @@ proc urgent::chat_message_notify {chatid from type body extras} { } } 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 -- cgit v1.2.3