aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkostix <kostix@cc602e41-bd33-0410-9637-a208f32f1443>2009-02-19 10:25:54 +0000
committerkostix <kostix@cc602e41-bd33-0410-9637-a208f32f1443>2009-02-19 10:25:54 +0000
commitd823d50386c28a585596928b69e860725f18dcf0 (patch)
tree3e21c6ccbf71925329cf44499081783b085c7a0b
parent51e6df92cffc2bd84eec59a2c68e3c997db7c2dd (diff)
downloadurgent-d823d50386c28a585596928b69e860725f18dcf0.tar.gz
urgent-d823d50386c28a585596928b69e860725f18dcf0.tar.xz
urgent-d823d50386c28a585596928b69e860725f18dcf0.zip
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
-rw-r--r--urgent.tcl20
1 files 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