Software / code / prosody
Comparison
plugins/mod_announce.lua @ 1397:4c7b8b8ab569
mod_announce: Work with non-local admins
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Tue, 23 Jun 2009 23:59:21 +0500 |
| parent | 1396:ce3eb5f71899 |
| child | 1522:569d58d21612 |
comparison
equal
deleted
inserted
replaced
| 1396:ce3eb5f71899 | 1397:4c7b8b8ab569 |
|---|---|
| 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"); |