diff options
author | Kim Alvefur <zash@zash.se> | 2017-04-10 20:28:02 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-04-10 20:28:02 +0200 |
commit | d8b1435c70a092455c19d5bef1bd340f0cbd4d70 (patch) | |
tree | 3864e3f843d1a7a1496cdedbce7c9da380abb189 | |
parent | abdd9866e57240aab356a893653eb95fad7dd0e6 (diff) | |
download | prosody-d8b1435c70a092455c19d5bef1bd340f0cbd4d70.tar.gz prosody-d8b1435c70a092455c19d5bef1bd340f0cbd4d70.zip |
mod_presence: Use get_child_text on priority child element (fixes #552)
-rw-r--r-- | plugins/mod_presence.lua | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index c5b2ae85..0c243bc6 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -40,14 +40,11 @@ function handle_normal_presence(origin, stanza) priority[1] = "0"; end end - local priority = stanza:get_child("priority"); - if priority and #priority > 0 then - priority = t_concat(priority); - if s_find(priority, "^[+-]?[0-9]+$") then - priority = tonumber(priority); - if priority < -128 then priority = -128 end - if priority > 127 then priority = 127 end - else priority = 0; end + local priority = stanza:get_child_text("priority"); + if priority and s_find(priority, "^[+-]?[0-9]+$") then + priority = tonumber(priority); + if priority < -128 then priority = -128 end + if priority > 127 then priority = 127 end else priority = 0; end if full_sessions[origin.full_jid] then -- if user is still connected origin.send(stanza); -- reflect their presence back to them |