plugins.disco: Add set_ and add_identity()

Fri, 16 Dec 2011 22:01:29 +0100

author
Kim Alvefur <zash@zash.se>
date
Fri, 16 Dec 2011 22:01:29 +0100
changeset 267
d30897e4f5c2
parent 266
ad8a918fa6e6
child 268
06e6c6de6438

plugins.disco: Add set_ and add_identity()

plugins/disco.lua file | annotate | diff | comparison | revisions
--- a/plugins/disco.lua	Fri Dec 16 22:00:41 2011 +0100
+++ b/plugins/disco.lua	Fri Dec 16 22:01:29 2011 +0100
@@ -119,6 +119,17 @@
 		end
 	})
 	
+	function stream:set_identity(identity, node)
+		self.disco.info[node or false].identities = { identity };
+		stream:resend_presence();
+	end
+
+	function stream:add_identity(identity, node)
+		local identities = self.disco.info[node or false].identities;
+		identities[#identities + 1] = identity;
+		stream:resend_presence();
+	end
+
 	function stream:add_disco_feature(feature, node)
 		local feature = feature.var or feature;
 		self.disco.info[node or false].features[feature] = true;

mercurial