Software /
code /
prosody
Comparison
plugins/mod_presence.lua @ 8072:194409dcba22
mod_presence: Use get_child_text on priority child element (fixes #552)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 10 Apr 2017 20:28:02 +0200 |
parent | 8071:c3790ca4144f |
child | 8574:f89d8ec48d86 |
comparison
equal
deleted
inserted
replaced
8071:c3790ca4144f | 8072:194409dcba22 |
---|---|
38 for i=#priority.tags,1,-1 do priority.tags[i] = nil; end | 38 for i=#priority.tags,1,-1 do priority.tags[i] = nil; end |
39 for i=#priority,2,-1 do priority[i] = nil; end | 39 for i=#priority,2,-1 do priority[i] = nil; end |
40 priority[1] = "0"; | 40 priority[1] = "0"; |
41 end | 41 end |
42 end | 42 end |
43 local priority = stanza:get_child("priority"); | 43 local priority = stanza:get_child_text("priority"); |
44 if priority and #priority > 0 then | 44 if priority and s_find(priority, "^[+-]?[0-9]+$") then |
45 priority = t_concat(priority); | 45 priority = tonumber(priority); |
46 if s_find(priority, "^[+-]?[0-9]+$") then | 46 if priority < -128 then priority = -128 end |
47 priority = tonumber(priority); | 47 if priority > 127 then priority = 127 end |
48 if priority < -128 then priority = -128 end | |
49 if priority > 127 then priority = 127 end | |
50 else priority = 0; end | |
51 else priority = 0; end | 48 else priority = 0; end |
52 if full_sessions[origin.full_jid] then -- if user is still connected | 49 if full_sessions[origin.full_jid] then -- if user is still connected |
53 origin.send(stanza); -- reflect their presence back to them | 50 origin.send(stanza); -- reflect their presence back to them |
54 end | 51 end |
55 local roster = origin.roster; | 52 local roster = origin.roster; |