Software /
code /
verse
Changeset
475:68a4fb45afbc
disco: Fire disco-info-changed when necessary, move presence resending there
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 17 Mar 2023 11:15:18 +0000 |
parents | 474:fca0c7672148 |
children | 476:c34b263499be |
files | plugins/disco.lua |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/disco.lua Fri Mar 17 11:12:12 2023 +0000 +++ b/plugins/disco.lua Fri Mar 17 11:15:18 2023 +0000 @@ -94,25 +94,25 @@ function stream:set_identity(identity, node) self.disco.info[node or false].identities = { identity }; - stream:resend_presence(); + stream:event("disco-info-changed"); end function stream:add_identity(identity, node) local identities = self.disco.info[node or false].identities; identities[#identities + 1] = identity; - stream:resend_presence(); + stream:event("disco-info-changed"); end function stream:add_disco_feature(feature, node) local feature = feature.var or feature; self.disco.info[node or false].features[feature] = true; - stream:resend_presence(); + stream:event("disco-info-changed"); end function stream:remove_disco_feature(feature, node) local feature = feature.var or feature; self.disco.info[node or false].features[feature] = nil; - stream:resend_presence(); + stream:event("disco-info-changed"); end function stream:add_disco_item(item, node) @@ -339,6 +339,10 @@ presence:remove_children("c", xmlns_caps); presence:reset():add_child(stream:caps()):reset(); end, 10); + + stream:hook("disco-info-changed", function () + stream:resend_presence(); + end); end -- end of disco.lua