Software /
code /
prosody
Annotate
plugins/mod_message.lua @ 1261:497178e0ddbe
Automated merge with http://waqas.ath.cx:8000/
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 01 Jun 2009 01:36:42 +0100 |
parent | 1234:0ff02499f05c |
child | 1271:e78c161944ab |
rev | line source |
---|---|
1232 | 1 |
2 local full_sessions = full_sessions; | |
3 local bare_sessions = bare_sessions; | |
4 | |
5 local jid_bare = require "util.jid".bare; | |
6 local user_exists = require "core.usermanager".user_exists; | |
7 | |
8 module:hook("message/full", function(data) | |
9 -- message to full JID recieved | |
10 local origin, stanza = data.origin, data.stanza; | |
11 | |
12 local session = full_sessions[stanza.attr.to]; | |
13 if session then | |
14 -- TODO fire post processing event | |
15 session.send(stanza); | |
16 return true; | |
17 else -- resource not online | |
18 -- TODO fire event to send to bare JID | |
19 end | |
20 end); | |
21 | |
22 module:hook("message/bare", function(data) | |
23 -- message to bare JID recieved | |
24 local origin, stanza = data.origin, data.stanza; | |
25 | |
1234
0ff02499f05c
mod_message, mod_iq: A little cleanup
Waqas Hussain <waqas20@gmail.com>
parents:
1232
diff
changeset
|
26 local sessions = bare_sessions[stanza.attr.to]; |
1232 | 27 if sessions then sessions = sessions.sessions; end |
28 | |
29 if sessions then | |
30 -- some resources are online | |
31 -- TODO find top resources willing to accept this message | |
32 -- TODO then send them each the stanza | |
33 else | |
34 -- no resources are online | |
35 -- TODO check if the user exists | |
36 -- TODO if it doesn't, return an error reply | |
37 -- TODO otherwise, apply the default privacy list | |
38 -- TODO and store into offline storage | |
39 -- TODO or maybe the offline store can apply privacy lists | |
40 end | |
41 end); |