summaryrefslogtreecommitdiff
path: root/src/wrap.cpp
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:48 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:48 +0200
commit5a019f435eb0068b524566d9babf172d58d0e96e (patch)
treeb083dccdfbec4335a5967d50c4294f7501c77345 /src/wrap.cpp
parent4ecbf33fae730bc79c4a47e6efda615b104754ad (diff)
tagging ychat-0.7.9.2ychat-0.7.9.2
Diffstat (limited to 'src/wrap.cpp')
-rwxr-xr-xsrc/wrap.cpp84
1 files changed, 81 insertions, 3 deletions
diff --git a/src/wrap.cpp b/src/wrap.cpp
index f675c1a..c46d986 100755
--- a/src/wrap.cpp
+++ b/src/wrap.cpp
@@ -33,15 +33,93 @@ void
wrap::system_message( string s_message )
{
#ifdef NCURSES
- wrap::NCUR->print( s_message );
+ NCUR->print( s_message );
#endif
-#ifdef SERVMSG
+#ifdef SERVMSG
cout << s_message << endl;
#endif
+
+#ifdef LOGGING
+ LOGD->log_simple_line( s_message + "\n" );
+#endif
+}
+
+void
+wrap::init_wrapper(map<string,string>* p_start_params)
+{
+ // Init the dynamic wrapper (is needed to pass all wrapped objects through a single pointer).
+ WRAP = new dynamic_wrap;
+
+ // Init the config manager.
+ WRAP->CONF = CONF = new conf( CONFILE, p_start_params );
+ delete p_start_params,
+
+ // Init the statistic manager.
+ WRAP->STAT = STAT = new stats;
+
+ // Init the html-template manager.
+ WRAP->HTML = HTML = new html;
+
#ifdef LOGGING
+ // Init the system message logd
+ WRAP->LOGD = LOGD = new logd( CONF->get_elem("httpd.logging.systemfile"),
+ CONF->get_elem("httpd.logging.systemlines") );
+#endif
+
+ //<<*
+ // Init the session manager.
+ WRAP->SMAN = SMAN = new sman;
+ //*>>
+
- wrap::LOGD->log_simple_line( s_message + "\n" );
+#ifdef NCURSES
+
+ WRAP->NCUR = NCUR = new ncur; // init the ncurses admin interface.
+ NCUR->run(); // run the thread
+
+ // Wait until ncurses interface has been initialized.
+ do {
+ usleep(1000);
+ } while ( ! NCUR->is_ready() );
+
+ HTML->print_cached(0);
+#else
+#ifdef CLI
+ cli* p_cli = new cli;
+ p_cli->run();
+#endif
+#endif
+
+ // Init the thread pool
+ WRAP->POOL = POOL = new pool;
+
+ // Init the socket manager.
+ WRAP->SOCK = SOCK = new sock;
+
+ //<<*
+ // Init the chat manager.
+ WRAP->CHAT = CHAT = new chat;
+ //*>>
+
+ // Init the system timer.
+ WRAP->TIMR = TIMR = new timr;
+
+ //<<*
+ // Init the module-loader manager.
+ WRAP->MODL = MODL = new modl;
+
+ // Init the garbage collector
+ WRAP->GCOL = GCOL = new gcol;
+
+ // Init the data manager.
+#ifdef DATABASE
+ WRAP->DATA = DATA = new data;
#endif
+ //*>>
+
+ // Run threads
+ TIMR->run();
}
+
#endif