# HG changeset patch # User Matthew Wild # Date 1219752906 -3600 # Node ID 65622bf34afc9dc6dab2c6d211ae0f72572e10e3 # Parent ae161e9071492b4d7f8142d54dfc0613ba22ead7# Parent 9a2685f39f9f489a5759eca07ae333bbcf022837 Merged in Tobias's SASL lib diff -r 9a2685f39f9f -r 65622bf34afc HACKERS --- /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: + +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. diff -r 9a2685f39f9f -r 65622bf34afc doc/coding_style.txt --- /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. diff -r 9a2685f39f9f -r 65622bf34afc main.lua --- 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 diff -r 9a2685f39f9f -r 65622bf34afc tests/readme --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/readme Tue Aug 26 13:15:06 2008 +0100 @@ -0,0 +1,1 @@ +This folder contains some test scripts. Or it will do. One day.