92 end |
92 end |
93 }) |
93 }) |
94 |
94 |
95 function stream:set_identity(identity, node) |
95 function stream:set_identity(identity, node) |
96 self.disco.info[node or false].identities = { identity }; |
96 self.disco.info[node or false].identities = { identity }; |
97 stream:resend_presence(); |
97 stream:event("disco-info-changed"); |
98 end |
98 end |
99 |
99 |
100 function stream:add_identity(identity, node) |
100 function stream:add_identity(identity, node) |
101 local identities = self.disco.info[node or false].identities; |
101 local identities = self.disco.info[node or false].identities; |
102 identities[#identities + 1] = identity; |
102 identities[#identities + 1] = identity; |
103 stream:resend_presence(); |
103 stream:event("disco-info-changed"); |
104 end |
104 end |
105 |
105 |
106 function stream:add_disco_feature(feature, node) |
106 function stream:add_disco_feature(feature, node) |
107 local feature = feature.var or feature; |
107 local feature = feature.var or feature; |
108 self.disco.info[node or false].features[feature] = true; |
108 self.disco.info[node or false].features[feature] = true; |
109 stream:resend_presence(); |
109 stream:event("disco-info-changed"); |
110 end |
110 end |
111 |
111 |
112 function stream:remove_disco_feature(feature, node) |
112 function stream:remove_disco_feature(feature, node) |
113 local feature = feature.var or feature; |
113 local feature = feature.var or feature; |
114 self.disco.info[node or false].features[feature] = nil; |
114 self.disco.info[node or false].features[feature] = nil; |
115 stream:resend_presence(); |
115 stream:event("disco-info-changed"); |
116 end |
116 end |
117 |
117 |
118 function stream:add_disco_item(item, node) |
118 function stream:add_disco_item(item, node) |
119 local items = self.disco.items[node or false]; |
119 local items = self.disco.items[node or false]; |
120 items[#items +1] = item; |
120 items[#items +1] = item; |
337 |
337 |
338 stream:hook("presence-out", function (presence) |
338 stream:hook("presence-out", function (presence) |
339 presence:remove_children("c", xmlns_caps); |
339 presence:remove_children("c", xmlns_caps); |
340 presence:reset():add_child(stream:caps()):reset(); |
340 presence:reset():add_child(stream:caps()):reset(); |
341 end, 10); |
341 end, 10); |
|
342 |
|
343 stream:hook("disco-info-changed", function () |
|
344 stream:resend_presence(); |
|
345 end); |
342 end |
346 end |
343 |
347 |
344 -- end of disco.lua |
348 -- end of disco.lua |