Software /
code /
prosody
Comparison
plugins/mod_motd.lua @ 4389:886eebf10802
mod_motd: Send no message (instead of 'blank') if no message is set in the config (thanks medics)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 27 Sep 2011 19:05:14 +0100 |
parent | 4083:4d0599e85411 |
child | 4390:5e84fb3c4ba0 |
comparison
equal
deleted
inserted
replaced
4388:eded80beab58 | 4389:886eebf10802 |
---|---|
6 -- This project is MIT/X11 licensed. Please see the | 6 -- This project is MIT/X11 licensed. Please see the |
7 -- COPYING file in the source package for more information. | 7 -- COPYING file in the source package for more information. |
8 -- | 8 -- |
9 | 9 |
10 local host = module:get_host(); | 10 local host = module:get_host(); |
11 local motd_text = module:get_option("motd_text") or "MOTD: (blank)"; | 11 local motd_text = module:get_option("motd_text"); |
12 local motd_jid = module:get_option("motd_jid") or host; | 12 local motd_jid = module:get_option("motd_jid") or host; |
13 | |
14 if not motd_text then return; end | |
13 | 15 |
14 local st = require "util.stanza"; | 16 local st = require "util.stanza"; |
15 | 17 |
16 motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n%s+", "\n"); -- Strip indentation from the config | 18 motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n%s+", "\n"); -- Strip indentation from the config |
17 | 19 |