verse.plugins.groupchat: Add support for MUC passwords https://xmpp.org/extensions/xep-0045.html#example-27

Fri, 02 Oct 2020 16:42:37 +0200

author
Seve Ferrer <seve@delape.net>
date
Fri, 02 Oct 2020 16:42:37 +0200
changeset 435
cf31a5ef8a9b
parent 426
9813b17ee096
child 436
a9be85b2da17

verse.plugins.groupchat: Add support for MUC passwords https://xmpp.org/extensions/xep-0045.html#example-27

plugins/groupchat.lua file | annotate | diff | comparison | revisions
--- a/plugins/groupchat.lua	Mon Jun 17 12:32:00 2019 +0100
+++ b/plugins/groupchat.lua	Fri Oct 02 16:42:37 2020 +0200
@@ -38,7 +38,7 @@
 		end
 	end, 500);
 
-	function stream:join_room(jid, nick, opts)
+	function stream:join_room(jid, nick, opts, password)
 		if not nick then
 			return false, "no nickname supplied"
 		end
@@ -104,6 +104,9 @@
 			end
 		end, 2000);
 		local join_st = verse.presence():tag("x",{xmlns = xmlns_muc}):reset();
+		if password then
+			join_st:get_child("x", xmlns_muc):tag("password"):text(password):reset();
+		end
 		self:event("pre-groupchat/joining", join_st);
 		room:send(join_st)
 		self:event("groupchat/joining", room);

mercurial