plugins/pubsub.lua

changeset 438
98dc1750584d
parent 437
2762abec4c63
child 468
fae5ae0ddb84
--- a/plugins/pubsub.lua	Mon Dec 06 09:03:39 2021 +0000
+++ b/plugins/pubsub.lua	Mon Dec 06 09:09:50 2021 +0000
@@ -256,15 +256,39 @@
 	, callback);
 end
 
-function pubsub_node:retract(id, callback)
-	self.stream:send_iq(pubsub_iq("set", self.service, nil, "retract", self.node, nil, id)
-	, callback);
+function pubsub_node:retract(id, notify, callback)
+	if type(notify) == "function" then -- COMPAT w/ older versions before 'notify' was added
+		notify, callback = false, notify;
+	end
+	self.stream:send_iq(
+		pubsub_iq(
+			"set",
+			self.service,
+			nil,
+			"retract",
+			self.node,
+			nil,
+			id,
+			{ notify = notify and "1" or nil }
+		),
+		callback
+	);
 end
 
 function pubsub_node:purge(notify, callback)
-	assert(not notify, "Not implemented yet.");
-	self.stream:send_iq(pubsub_iq("set", self.service, xmlns_pubsub_owner, "purge", self.node)
-	, callback);
+	self.stream:send_iq(
+		pubsub_iq(
+			"set",
+			self.service,
+			xmlns_pubsub_owner,
+			"purge",
+			self.node,
+			nil,
+			nil,
+			{ notify = notify and "1" or nil }
+		),
+		callback
+	);
 end
 
 function pubsub_node:delete(redirect_uri, callback)

mercurial