Comparison

plugins/mod_motd.lua @ 3169:e37e83660114

Add motd plugin, giving text to a user on each login.
author Jeff Mitchell <jeff@jefferai.org>
date Sat, 29 May 2010 14:02:58 -0400
child 3170:bf83d75c961a
comparison
equal deleted inserted replaced
3168:20c851616ade 3169:e37e83660114
1 -- Prosody IM
2 -- Copyright (C) 2008-2010 Matthew Wild
3 -- Copyright (C) 2008-2010 Waqas Hussain
4 -- Copyright (C) 2010 Jeff Mitchell
5 --
6 -- This project is MIT/X11 licensed. Please see the
7 -- COPYING file in the source package for more information.
8 --
9
10 local host = module:get_host();
11 local motd_text = module:get_option("motd_text") or "MOTD: (blank)";
12
13 local st = require "util.stanza";
14
15 module:hook("resource-bind",
16 function (event)
17 local session = event.session;
18 local motd_stanza =
19 st.message({ to = session.username..'@'..session.host, from = host })
20 :tag("body"):text(motd_text);
21 core_route_stanza(hosts[host], motd_stanza);
22 module:log("debug", "MOTD send to user %s@%s", session.username, session.host);
23
24 end);