Software /
code /
prosody
Comparison
plugins/mod_presence.lua @ 8074:4b403f881176
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 10 Apr 2017 23:16:13 +0200 |
parent | 8072:194409dcba22 |
child | 8574:f89d8ec48d86 |
comparison
equal
deleted
inserted
replaced
8068:5abb6bc45edd | 8074:4b403f881176 |
---|---|
34 function handle_normal_presence(origin, stanza) | 34 function handle_normal_presence(origin, stanza) |
35 if ignore_presence_priority then | 35 if ignore_presence_priority then |
36 local priority = stanza:get_child("priority"); | 36 local priority = stanza:get_child("priority"); |
37 if priority and priority[1] ~= "0" then | 37 if priority and priority[1] ~= "0" then |
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,1,-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; |