Fix for never checking if the first module for a host is already loaded (affects...
[prosody.git] / core / sessionmanager.lua
index 34cc9f0f76d557d4de4153176f6a2854aa4e3433..571ce1fe43e6826f650e41a52b061f02c89b1291 100644 (file)
@@ -1,20 +1,9 @@
--- Prosody IM v0.1
--- Copyright (C) 2008 Matthew Wild
--- Copyright (C) 2008 Waqas Hussain
+-- Prosody IM v0.3
+-- Copyright (C) 2008-2009 Matthew Wild
+-- Copyright (C) 2008-2009 Waqas Hussain
 -- 
--- This program is free software; you can redistribute it and/or
--- modify it under the terms of the GNU General Public License
--- as published by the Free Software Foundation; either version 2
--- of the License, or (at your option) any later version.
--- 
--- This program is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--- GNU General Public License for more details.
--- 
--- You should have received a copy of the GNU General Public License
--- along with this program; if not, write to the Free Software
--- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+-- This project is MIT/X11 licensed. Please see the
+-- COPYING file in the source package for more information.
 --
 
 
@@ -58,6 +47,7 @@ function new_session(conn)
        log("info", "open sessions now: ".. open_sessions);
        local w = conn.write;
        session.send = function (t) w(tostring(t)); end
+       session.ip = conn.ip();
        return session;
 end
 
@@ -113,8 +103,6 @@ function bind_resource(session, resource)
        if session.resource then return nil, "cancel", "already-bound", "Cannot bind multiple resources on a single connection"; end
        -- We don't support binding multiple resources
 
-       session.conntimetotal = gettime()-session.conntime;
-       
        resource = resource or uuid_generate();
        --FIXME: Randomly-generated resources must be unique per-user, and never conflict with existing
        
@@ -209,4 +197,4 @@ function send_to_available_resources(user, host, stanza)
        return count;
 end
 
-return _M;
\ No newline at end of file
+return _M;