# HG changeset patch # User Waqas Hussain # Date 1354303893 -18000 # Node ID c2b431042a54d7ad0d4fa911ca65ca85322f099b # Parent afa9b7e18e43c07bea9130d6a4ea677579613413# Parent 80635a6cb12683a484c9c2370cadfe927f77f9cb Merge 0.9->trunk. diff -r afa9b7e18e43 -r c2b431042a54 core/sessionmanager.lua --- a/core/sessionmanager.lua Thu Nov 29 07:38:24 2012 +0500 +++ b/core/sessionmanager.lua Sat Dec 01 00:31:33 2012 +0500 @@ -185,6 +185,7 @@ bare_sessions[session.username..'@'..session.host] = nil; hosts[session.host].sessions[session.username] = nil; end + session.log("error", "Roster loading failed: %s", err); return nil, "cancel", "internal-server-error", "Error loading roster"; end diff -r afa9b7e18e43 -r c2b431042a54 plugins/mod_storage_sql.lua --- a/plugins/mod_storage_sql.lua Thu Nov 29 07:38:24 2012 +0500 +++ b/plugins/mod_storage_sql.lua Sat Dec 01 00:31:33 2012 +0500 @@ -228,7 +228,8 @@ return ...; end local function commit(...) - if not connection:commit() then return nil, "SQL commit failed"; end + local success,err = connection:commit(); + if not success then return nil, "SQL commit failed: "..tostring(err); end return ...; end diff -r afa9b7e18e43 -r c2b431042a54 plugins/muc/mod_muc.lua --- a/plugins/muc/mod_muc.lua Thu Nov 29 07:38:24 2012 +0500 +++ b/plugins/muc/mod_muc.lua Sat Dec 01 00:31:33 2012 +0500 @@ -77,17 +77,22 @@ if forced then datamanager.store(nil, muc_host, "persistent", persistent_rooms); end end +function create_room(jid) + local room = muc_new_room(jid); + room.route_stanza = room_route_stanza; + room.save = room_save; + rooms[jid] = room; + return room; +end + local persistent_errors = false; for jid in pairs(persistent_rooms) do local node = jid_split(jid); local data = datamanager.load(node, muc_host, "config"); if data then - local room = muc_new_room(jid); + local room = create_room(jid); room._data = data._data; room._affiliations = data._affiliations; - room.route_stanza = room_route_stanza; - room.save = room_save; - rooms[jid] = room; else -- missing room data persistent_rooms[jid] = nil; module:log("error", "Missing data for room '%s', removing from persistent room list", jid); @@ -149,10 +154,7 @@ if not(restrict_room_creation) or (restrict_room_creation == "admin" and is_admin(stanza.attr.from)) or (restrict_room_creation == "local" and select(2, jid_split(stanza.attr.from)) == module.host:gsub("^[^%.]+%.", "")) then - room = muc_new_room(bare); - room.route_stanza = room_route_stanza; - room.save = room_save; - rooms[bare] = room; + room = create_room(bare); end end if room then @@ -190,14 +192,11 @@ end module.restore = function(data) for jid, oldroom in pairs(data.rooms or {}) do - local room = muc_new_room(jid); + local room = create_room(jid); room._jid_nick = oldroom._jid_nick; room._occupants = oldroom._occupants; room._data = oldroom._data; room._affiliations = oldroom._affiliations; - room.route_stanza = room_route_stanza; - room.save = room_save; - rooms[jid] = room; end hosts[module:get_host()].muc = { rooms = rooms }; end