changeset 4560:724003f24308

Back out 82689acd1294 (non-standard buttons)
author Kim Alvefur <zash@zash.se>
date Fri, 21 May 2021 20:58:10 +0200 (2021-05-21)
parents 33b1b6ff23d8
children c6b740ccf6ec
files mod_slack_webhooks/mod_slack_webhooks.lua
diffstat 1 files changed, 1 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/mod_slack_webhooks/mod_slack_webhooks.lua	Thu May 20 15:25:07 2021 +0200
+++ b/mod_slack_webhooks/mod_slack_webhooks.lua	Fri May 21 20:58:10 2021 +0200
@@ -21,7 +21,6 @@
 		return rooms[room_jid];
 	end
 
-local button_ns = "xmpp:prosody.im/community/mod_slack_webhooks#buttons";
 local routing = module:get_option("outgoing_webhook_routing") or {};
 local listen_path = module:get_option("incoming_webhook_path") or "/webhook";
 local default_from_nick = module:get_option("incoming_webhook_default_nick") or "Bot";
@@ -56,28 +55,6 @@
 		team_domain = from_host,
 		user_name = from_nick,
 	};
-
-	local form = stanza:get_child("x", "jabber:x:form");
-	if form and form.attr.type == "submit" then
-		local callback_id, button_name, button_value;
-		for field in form:childtags("field") do
-			if field.attr.var == "callback_id" then
-				button_name = field:get_child_text("text");
-			elseif field.attr.var == "button_name" then
-				button_name = field:get_child_text("text");
-			elseif field.attr.var ~= "FORM_TYPE" or field:get_child_text("text") ~= button_ns then
-				callback_id, button_name, button_value = nil, nil, nil;
-				break;
-			end
-		end
-		if callback_id and button_name and button_value then
-			json_out.callback_id = callback_id;
-			json_out.actions = {
-				{ type = "button", name = button_name, value = button_value }
-			};
-		end
-	end
-
 	local stanzaid = stanza:get_child("id");
 	if stanzaid and string.sub(stanzaid,1,string.len("webhookbot"))=="webhookbot" then
 		json_out["bot_id"] = "webhookbot";
@@ -168,7 +145,7 @@
 					message:add_direct_child(dataform.new({
 						{
 							type = "hidden", name = "FORM_TYPE",
-							value = button_ns,
+							value = "xmpp:prosody.im/community/mod_slack_webhooks#buttons",
 						},
 						{
 							type = "hidden", name = "callback_id",