plugins/mod_announce.lua
changeset 8977 71500c68fed4
parent 8963 9d0d1e427b82
child 10030 1117138fa372
equal deleted inserted replaced
8976:188c05e906f1 8977:71500c68fed4
    35 end
    35 end
    36 
    36 
    37 
    37 
    38 -- Old <message>-based jabberd-style announcement sending
    38 -- Old <message>-based jabberd-style announcement sending
    39 function handle_announcement(event)
    39 function handle_announcement(event)
    40 	local origin, stanza = event.origin, event.stanza;
    40 	local stanza = event.stanza;
    41 	local node, host, resource = jid.split(stanza.attr.to);
    41 	local node, host, resource = jid.split(stanza.attr.to);
    42 
    42 
    43 	if resource ~= "announce/online" then
    43 	if resource ~= "announce/online" then
    44 		return; -- Not an announcement
    44 		return; -- Not an announcement
    45 	end
    45 	end
    70 	{ name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/admin" };
    70 	{ name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/admin" };
    71 	{ name = "subject", type = "text-single", label = "Subject" };
    71 	{ name = "subject", type = "text-single", label = "Subject" };
    72 	{ name = "announcement", type = "text-multi", required = true, label = "Announcement" };
    72 	{ name = "announcement", type = "text-multi", required = true, label = "Announcement" };
    73 };
    73 };
    74 
    74 
    75 function announce_handler(self, data, state)
    75 function announce_handler(_, data, state)
    76 	if state then
    76 	if state then
    77 		if data.action == "cancel" then
    77 		if data.action == "cancel" then
    78 			return { status = "canceled" };
    78 			return { status = "canceled" };
    79 		end
    79 		end
    80 
    80