Software / code / prosody
Comparison
plugins/mod_motd.lua @ 4083:4d0599e85411
mod_motd: Process value to strip any indentation from the config
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 07 Jan 2011 03:46:10 +0000 |
| parent | 3170:bf83d75c961a |
| child | 4389:886eebf10802 |
comparison
equal
deleted
inserted
replaced
| 4081:ce02a56b268f | 4083:4d0599e85411 |
|---|---|
| 11 local motd_text = module:get_option("motd_text") or "MOTD: (blank)"; | 11 local motd_text = module:get_option("motd_text") or "MOTD: (blank)"; |
| 12 local motd_jid = module:get_option("motd_jid") or host; | 12 local motd_jid = module:get_option("motd_jid") or host; |
| 13 | 13 |
| 14 local st = require "util.stanza"; | 14 local st = require "util.stanza"; |
| 15 | 15 |
| 16 motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n%s+", "\n"); -- Strip indentation from the config | |
| 17 | |
| 16 module:hook("resource-bind", | 18 module:hook("resource-bind", |
| 17 function (event) | 19 function (event) |
| 18 local session = event.session; | 20 local session = event.session; |
| 19 local motd_stanza = | 21 local motd_stanza = |
| 20 st.message({ to = session.username..'@'..session.host, from = motd_jid }) | 22 st.message({ to = session.username..'@'..session.host, from = motd_jid }) |