aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--HACKERS7
-rw-r--r--doc/coding_style.txt33
-rw-r--r--main.lua17
-rw-r--r--tests/readme1
4 files changed, 56 insertions, 2 deletions
diff --git a/HACKERS b/HACKERS
new file mode 100644
index 00000000..c103c343
--- /dev/null
+++ b/HACKERS
@@ -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.
diff --git a/doc/coding_style.txt b/doc/coding_style.txt
new file mode 100644
index 00000000..c9113e81
--- /dev/null
+++ b/doc/coding_style.txt
@@ -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 --git a/main.lua b/main.lua
index c19ad8bf..97ea089f 100644
--- a/main.lua
+++ b/main.lua
@@ -8,7 +8,7 @@ require "lxp"
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.offlinemessage"
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 @@ function connect_host(host)
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 --git a/tests/readme b/tests/readme
new file mode 100644
index 00000000..d3b44845
--- /dev/null
+++ b/tests/readme
@@ -0,0 +1 @@
+This folder contains some test scripts. Or it will do. One day.