Comparison

plugins/mod_motd.lua @ 6009:1579b53351e2

mod_motd: Strip indentation only, leave multiple newlines
author Kim Alvefur <zash@zash.se>
date Thu, 06 Feb 2014 10:44:21 +0100
parent 5371:706206e191e8
child 6010:fad7084a0b35
comparison
equal deleted inserted replaced
6006:95ce7bfbfa6f 6009:1579b53351e2
13 13
14 if not motd_text then return; end 14 if not motd_text then return; end
15 15
16 local st = require "util.stanza"; 16 local st = require "util.stanza";
17 17
18 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[ \t]+", "\n"); -- Strip indentation from the config
19 19
20 module:hook("presence/bare", function (event) 20 module:hook("presence/bare", function (event)
21 local session, stanza = event.origin, event.stanza; 21 local session, stanza = event.origin, event.stanza;
22 if session.username and not session.presence 22 if session.username and not session.presence
23 and not stanza.attr.type and not stanza.attr.to then 23 and not stanza.attr.type and not stanza.attr.to then