prosody
changeset 1236 eca772495e20
parent 1221 23c7d41ca93c
child 1237 a30ca0d0df38
equal deleted inserted replaced
1235:be8b51a8ab03 1236:eca772495e20
    70 
    70 
    71 bare_sessions = {};
    71 bare_sessions = {};
    72 full_sessions = {};
    72 full_sessions = {};
    73 hosts = {};
    73 hosts = {};
    74 
    74 
       
    75 -- Global 'prosody' object
       
    76 prosody = {};
       
    77 local prosody = prosody;
       
    78 
       
    79 prosody.bare_sessions = bare_sessions;
       
    80 prosody.full_sessions = full_sessions;
       
    81 prosody.hosts = hosts;
       
    82 
       
    83 prosody.paths = { source = CFG_SOURCEDIR, config = CFG_CONFIGDIR, 
       
    84                   plugins = CFG_PLUGINDIR, data = CFG_DATADIR };
       
    85 
       
    86 prosody.arg = arg;
       
    87 
    75 --- Load and initialise core modules
    88 --- Load and initialise core modules
    76 require "util.import"
    89 require "util.import"
    77 require "core.xmlhandlers"
    90 require "core.xmlhandlers"
    78 require "core.rostermanager"
    91 require "core.rostermanager"
    79 require "core.eventmanager"
    92 require "core.eventmanager"
   125 		end
   138 		end
   126 	end
   139 	end
   127 end
   140 end
   128 
   141 
   129 -- Function to reopen logfiles
   142 -- Function to reopen logfiles
   130 function prosody_reopen_logfiles()
   143 function prosody.reopen_logfiles()
   131 	log("info", "Re-opening log files");
   144 	log("info", "Re-opening log files");
   132 	eventmanager.fire_event("reopen-log-files"); -- Handled by appropriate log sinks
   145 	eventmanager.fire_event("reopen-log-files"); -- Handled by appropriate log sinks
   133 end
   146 end
   134 
   147 
       
   148 -- Temporary
       
   149 prosody_reopen_logfiles = prosody.reopen_logfiles;
       
   150 
   135 -- Function to initiate prosody shutdown
   151 -- Function to initiate prosody shutdown
   136 function prosody_shutdown(reason)
   152 function prosody.shutdown(reason)
   137 	log("info", "Shutting down: %s", reason or "unknown reason");
   153 	log("info", "Shutting down: %s", reason or "unknown reason");
   138 	eventmanager.fire_event("server-stopping", { reason = reason });
   154 	eventmanager.fire_event("server-stopping", { reason = reason });
   139 	server.setquitting(true);
   155 	server.setquitting(true);
   140 end
   156 end
       
   157 
       
   158 -- Temporary
       
   159 prosody_shutdown = prosody.shutdown;
   141 
   160 
   142 -- Signal to modules that we are ready to start
   161 -- Signal to modules that we are ready to start
   143 eventmanager.fire_event("server-starting");
   162 eventmanager.fire_event("server-starting");
   144 
   163 
   145 -- Load SSL settings from config, and create a ctx table
   164 -- Load SSL settings from config, and create a ctx table