Software /
code /
prosody
Diff
plugins/mod_presence.lua @ 6304:ace08821e4ee
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 04 Jul 2014 23:05:27 +0200 |
parent | 6302:76699a0ae4c4 |
child | 6613:2aae36312eb9 |
line wrap: on
line diff
--- a/plugins/mod_presence.lua Mon Jun 30 13:12:16 2014 +0200 +++ b/plugins/mod_presence.lua Fri Jul 04 23:05:27 2014 +0200 @@ -55,14 +55,14 @@ function handle_normal_presence(origin, stanza) if ignore_presence_priority then - local priority = stanza:child_with_name("priority"); + local priority = stanza:get_child("priority"); if priority and priority[1] ~= "0" then for i=#priority.tags,1,-1 do priority.tags[i] = nil; end for i=#priority,1,-1 do priority[i] = nil; end priority[1] = "0"; end end - local priority = stanza:child_with_name("priority"); + local priority = stanza:get_child("priority"); if priority and #priority > 0 then priority = t_concat(priority); if s_find(priority, "^[+-]?[0-9]+$") then @@ -90,6 +90,7 @@ end end if stanza.attr.type == nil and not origin.presence then -- initial presence + module:fire_event("presence/initial", { origin = origin, stanza = stanza } ); origin.presence = stanza; -- FIXME repeated later local probe = st.presence({from = origin.full_jid, type = "probe"}); for jid, item in pairs(roster) do -- probe all contacts we are subscribed to @@ -137,9 +138,6 @@ origin.directed = nil; end else - if not origin.presence then - module:fire_event("presence/initial", { origin = origin, stanza = stanza } ); - end origin.presence = stanza; stanza:tag("delay", { xmlns = "urn:xmpp:delay", from = host, stamp = datetime.datetime() }):up(); if origin.priority ~= priority then