Software /
code /
prosody
Changeset
208:23245a92b275
Merge (for some reason)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 04 Nov 2008 01:26:56 +0000 |
parents | 207:90c387884234 (diff) 204:1f4aa5369941 (current diff) |
children | 209:e9de0803676d 211:22e17cfab36c |
files | |
diffstat | 4 files changed, 42 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/core/stanza_router.lua Sun Nov 02 17:36:40 2008 +0000 +++ b/core/stanza_router.lua Tue Nov 04 01:26:56 2008 +0000 @@ -51,7 +51,7 @@ if origin.type == "c2s" then stanza.attr.from = origin.full_jid; -- quick fix to prevent impersonation (FIXME this would be incorrect when the origin is not c2s) end - + if not to then core_handle_stanza(origin, stanza); elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then @@ -78,7 +78,7 @@ if modules_handle_stanza(origin, stanza) then return; end if origin.type == "c2s" or origin.type == "c2s_unauthed" then local session = origin; - + if stanza.name == "presence" and origin.roster then if stanza.attr.type == nil or stanza.attr.type == "unavailable" then for jid in pairs(origin.roster) do -- broadcast to all interested contacts @@ -260,7 +260,7 @@ function core_route_stanza(origin, stanza) -- Hooks --- ...later - + -- Deliver local to = stanza.attr.to; local node, host, resource = jid_split(to);
--- a/lxmppd.cfg.dist Sun Nov 02 17:36:40 2008 +0000 +++ b/lxmppd.cfg.dist Tue Nov 04 01:26:56 2008 +0000 @@ -1,25 +1,26 @@ +---- lxmppd configuration file ---- -sessions = {}; -hosts = { - ["localhost"] = { - type = "local"; - connected = true; - sessions = {}; - }; - ["getjabber.ath.cx"] = { - type = "local"; - connected = true; - sessions = {}; - }; - } - --- If the following is not defined, no SSL will be set up on 5223 -ssl_ctx = { - mode = "server", - protocol = "sslv23", - - key = "/home/matthew/ssl_cert/server.key", - certificate = "/home/matthew/ssl_cert/server.crt", - capath = "/etc/ssl/certs", verify = "none", - } +-- define the local hosts +hosts = { + ["localhost"] = { + type = "local"; + connected = true; + sessions = {}; + }; + ["getjabber.ath.cx"] = { + type = "local"; + connected = true; + sessions = {}; + }; +} + +-- if the following is not defined, no SSL will be set up on 5223 +ssl_ctx = { + mode = "server", + protocol = "sslv23", + + key = "/home/matthew/ssl_cert/server.key", + certificate = "/home/matthew/ssl_cert/server.crt", + capath = "/etc/ssl/certs", verify = "none", +}
--- a/main.lua Sun Nov 02 17:36:40 2008 +0000 +++ b/main.lua Tue Nov 04 01:26:56 2008 +0000 @@ -10,12 +10,12 @@ end dofile "lxmppd.cfg" - + -- Maps connections to sessions -- sessions = {}; - + -- Load and initialise core modules -- - + require "util.import" require "core.xmlhandlers" require "core.rostermanager"
--- a/util/datamanager.lua Sun Nov 02 17:36:40 2008 +0000 +++ b/util/datamanager.lua Tue Nov 04 01:26:56 2008 +0000 @@ -5,8 +5,10 @@ local loadfile, setfenv, pcall = loadfile, setfenv, pcall; local log = log; local io_open = io.open; +local os_remove = os.remove; local tostring = tostring; local error = error; +local next = next; local indent = function(f, i) for n = 1, i do @@ -93,14 +95,23 @@ end function store(username, host, datastore, data) + if not data then + data = {}; + end + -- save the datastore local f, msg = io_open(getpath(username, host, datastore), "w+"); if not f then log("error", "Unable to write to "..datastore.." storage ('"..msg.."') for user: "..(username or "nil").."@"..(host or "nil")); - return nil; + return; end f:write("return "); simplesave(f, data, 1); f:close(); + if not next(data) then -- try to delete empty datastore + os_remove(getpath(username, host, datastore)); + end + -- we write data even when we are deleting because lua doesn't have a + -- platform independent way of checking for non-exisitng files return true; end