9 |
9 |
10 if resource ~= "announce/online" then |
10 if resource ~= "announce/online" then |
11 return; -- Not an announcement |
11 return; -- Not an announcement |
12 end |
12 end |
13 |
13 |
14 if not is_admin(origin.full_jid) then |
14 if not is_admin(stanza.attr.from) then |
15 -- Not an admin? Not allowed! |
15 -- Not an admin? Not allowed! |
16 module:log("warn", "Non-admin %s tried to send server announcement", tostring(jid.bare(origin.full_jid))); |
16 module:log("warn", "Non-admin %s tried to send server announcement", tostring(jid.bare(stanza.attr.from))); |
17 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
17 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
18 return; |
18 return; |
19 end |
19 end |
20 |
20 |
21 module:log("info", "Sending server announcement to all online users"); |
21 module:log("info", "Sending server announcement to all online users"); |