Software /
code /
prosody
Changeset
19:65622bf34afc
Merged in Tobias's SASL lib
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 26 Aug 2008 13:15:06 +0100 |
parents | 18:ae161e907149 (diff) 17:9a2685f39f9f (current diff) |
children | 20:6885fd2cf51f |
files | |
diffstat | 4 files changed, 56 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HACKERS Tue Aug 26 13:15:06 2008 +0100 @@ -0,0 +1,7 @@ +Welcome hackers! + +This project accepts and *encourages* contributions. If you would like to get involved you can join us on our mailing list at: <doh, we need a mailing list> + +You can also find us in the chatroom at lxmppd@chatbox.heavy-horse.co.uk + +Patches are welcome, though before sending we would appreciate if you read docs/coding_style.txt for guidelines on how to format your code.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/coding_style.txt Tue Aug 26 13:15:06 2008 +0100 @@ -0,0 +1,33 @@ +This file describes some coding styles to try and adhere to when contributing to this project. +Please try to follow, and feel free to fix code you see not following this standard. + +== Indentation == + + 1 tab indentation for all blocks + +== Spacing == + +No space between function names and parenthesis and parenthesis and paramters: + + function foo(bar, baz) + +Single space between braces and key/value pairs in table constructors: + + { foo = "bar", bar = "foo" } + +== Local variable naming == + +In this project there are many places where use of globals is restricted, and locals used for faster access. + +Local versions of standard functions should follow the below form: + + math.random -> m_random + string.char -> s_char + +== Miscellaneous == + +Single-statement blocks may be written on one line when short + + if foo then bar(); end + +'do' and 'then' keywords should be placed at the end of the line, and never on a line by themself.
--- a/main.lua Tue Aug 26 14:11:52 2008 +0200 +++ b/main.lua Tue Aug 26 13:15:06 2008 +0100 @@ -8,7 +8,7 @@ function log(type, area, message) print(type, area, message); end - + require "core.stanza_dispatch" local init_xmlhandlers = require "core.xmlhandlers" require "core.rostermanager" @@ -16,7 +16,7 @@ require "core.usermanager" require "util.stanza" require "util.jid" - + -- Locals for faster access -- local t_insert = table.insert; local t_concat = table.concat; @@ -50,6 +50,19 @@ hosts[host] = { type = "remote", sendbuffer = {} }; end +local function route_stanza(stanza) + if not stanza.attr.to then + -- Has no 'to' attribute, handle internally + end + local node, host, resource = jid.split(stanza.attr.to); + if host and hosts[host] and hosts[host].type == "local" then + -- Is a local host, handle internally + + else + -- Is not for us or a local user, route accordingly + end +end + local function send_to(session, to, stanza) local node, host, resource = jid.split(to); if not hosts[host] then