diff options
| author | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:42 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:42 +0200 |
| commit | 658bfd183905576ed5f4dbe57a2ee82711b6ac93 (patch) | |
| tree | 08cf25d1a1fb09b643a65c5b237c52bce791f307 /src | |
| parent | 42b79aa5c591dde88e78922a519802f948d9ea60 (diff) | |
tagging ychat-0.7.9.0ychat-0.7.9.0
Diffstat (limited to 'src')
103 files changed, 611 insertions, 913 deletions
diff --git a/src/CVS/Entries b/src/CVS/Entries new file mode 100644 index 0000000..9f8fee6 --- /dev/null +++ b/src/CVS/Entries @@ -0,0 +1,23 @@ +/Makefile.in/1.22/Tue Sep 7 17:14:39 2004// +/configure/1.39/Sun Mar 6 20:44:47 2005// +/glob.h/1.74/Wed Mar 9 21:09:31 2005// +/html.cpp/1.23/Wed Feb 23 20:23:31 2005// +/html.h/1.11/Wed Feb 23 03:12:05 2005// +/incl.h/1.7/Wed Feb 23 03:12:05 2005// +/logd.cpp/1.15/Sun Feb 27 06:28:53 2005// +/logd.h/1.11/Wed Feb 23 03:12:05 2005// +/main.cpp/1.38/Sun Mar 6 20:44:47 2005// +/modl.cpp/1.19/Sun Mar 6 20:44:47 2005// +/modl.h/1.11/Sun Mar 6 20:44:47 2005// +/msgs.h/1.207/Thu Mar 10 22:01:54 2005// +/name.cpp/1.8/Mon Feb 21 01:55:49 2005// +/name.h/1.6/Mon Feb 21 01:55:49 2005// +/reqp.cpp/1.42/Sun Mar 6 20:44:47 2005// +/reqp.h/1.15/Wed Feb 23 03:12:05 2005// +/sign.cpp/1.3/Mon Mar 7 00:24:57 2005// +/sign.h/1.1/Fri Mar 4 02:41:30 2005// +/stats.cpp/1.10/Mon Feb 21 01:55:49 2005// +/stats.h/1.7/Mon Feb 21 01:55:49 2005// +/wrap.cpp/1.18/Sun Mar 6 20:44:47 2005// +/wrap.h/1.25/Sun Mar 6 20:44:47 2005// +D diff --git a/src/CVS/Entries.Log b/src/CVS/Entries.Log new file mode 100644 index 0000000..7d9d881 --- /dev/null +++ b/src/CVS/Entries.Log @@ -0,0 +1,14 @@ +A D/chat//// +A D/cli//// +A D/conf//// +A D/contrib//// +A D/data//// +A D/irc//// +A D/maps//// +A D/memb//// +A D/mods//// +A D/ncur//// +A D/sock//// +A D/thrd//// +A D/time//// +A D/tool//// diff --git a/src/CVS/Repository b/src/CVS/Repository new file mode 100644 index 0000000..47f3b3c --- /dev/null +++ b/src/CVS/Repository @@ -0,0 +1 @@ +ychat/src diff --git a/src/CVS/Root b/src/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/chat/CVS/Entries b/src/chat/CVS/Entries new file mode 100644 index 0000000..1eaa9f0 --- /dev/null +++ b/src/chat/CVS/Entries @@ -0,0 +1,17 @@ +/base.h/1.8/Mon Feb 21 01:55:49 2005// +/base.tmpl/1.6/Mon Feb 21 01:55:49 2005// +/chat.cpp/1.20/Fri Feb 25 00:15:38 2005// +/chat.h/1.12/Wed Feb 23 03:12:05 2005// +/gcol.cpp/1.7/Mon Feb 21 01:55:49 2005// +/gcol.h/1.5/Mon Feb 21 01:55:49 2005// +/perm.cpp/1.10/Mon Feb 21 01:55:49 2005// +/perm.h/1.8/Mon Feb 21 01:55:49 2005// +/room.cpp/1.11/Fri Mar 4 00:34:29 2005// +/room.h/1.8/Fri Mar 4 00:34:29 2005// +/sess.cpp/1.6/Mon Feb 21 01:55:49 2005// +/sess.h/1.6/Mon Feb 21 01:55:49 2005// +/sman.cpp/1.11/Mon Feb 21 01:55:49 2005// +/sman.h/1.6/Mon Feb 21 01:55:49 2005// +/user.cpp/1.18/Sun Mar 6 20:44:47 2005// +/user.h/1.11/Mon Feb 21 01:55:49 2005// +D diff --git a/src/chat/CVS/Repository b/src/chat/CVS/Repository new file mode 100644 index 0000000..6215e07 --- /dev/null +++ b/src/chat/CVS/Repository @@ -0,0 +1 @@ +ychat/src/chat diff --git a/src/chat/CVS/Root b/src/chat/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/chat/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/chat/base.h b/src/chat/base.h index b995c5c..9da4304 100755 --- a/src/chat/base.h +++ b/src/chat/base.h @@ -9,9 +9,6 @@ template<class type> class base : public nhashmap<type*> { -protected: - void dumpit(); - public: base(); ~base(); @@ -25,7 +22,6 @@ public: } virtual type* get_elem( string s_name, bool &b_found ); // get a element. - virtual type* get_elem( string s_name ); virtual void add_elem( type* p_type ); // add a element. // chat::msg_post sends to all users of the system a message. diff --git a/src/chat/base.tmpl b/src/chat/base.tmpl index 5b0fceb..0be21aa 100755 --- a/src/chat/base.tmpl +++ b/src/chat/base.tmpl @@ -22,40 +22,10 @@ base<type>::get_elem( string s_name, bool &b_found ) } template<class type> -type* -base<type>::get_elem( string s_name) -{ - bool b; - return get_elem(s_name, b); -} - -template<class type> void base<type>::add_elem( type* p_type ) { nhashmap<type*>::add_elem(p_type, p_type->get_lowercase_name()); } -template<class type> -void -base<type>::dumpit() -{ - dumpable::add("[base]"); - vector<string>* p_vec = nhashmap<type*>::get_key_vector(); - - vector<string>::iterator iter; - for (iter = p_vec->begin(); iter != p_vec->end(); ++iter) - { - dumpable::add(*iter); - type* p_elem = get_elem(*iter); - if (p_elem) - { - dumpable::next_no_newline(); - dumpable::add(p_elem->dump(dumpable::get_level())); - } - } - - delete p_vec; -} - #endif diff --git a/src/chat/chat.cpp b/src/chat/chat.cpp index e4cbaac..0839261 100755 --- a/src/chat/chat.cpp +++ b/src/chat/chat.cpp @@ -165,6 +165,7 @@ chat::login( map<string,string> &map_params ) else { sess* p_sess = wrap::SMAN->create_session(); + //p_sess->set_value( string("nick"), (void *) new string(s_user) ); p_sess->set_user(p_user); map_params["tmpid"] = p_sess->get_tmpid(); p_user->set_tmpid( map_params["tmpid"] ); @@ -360,11 +361,4 @@ chat::string_replacer(string *p_msg) } } -void -chat::dumpit() -{ - dumpable::add("[chat]"); - base<room>::dumpit(); -} - #endif diff --git a/src/chat/chat.h b/src/chat/chat.h index bb087d5..47645c3 100755 --- a/src/chat/chat.h +++ b/src/chat/chat.h @@ -23,7 +23,6 @@ class chat : public base<room>, public perm private: map<string,string> map_replace_strings; vector<string> vec_replace_keys; - void dumpit(); public: virtual room* get_room( string s_name ) diff --git a/src/chat/gcol.cpp b/src/chat/gcol.cpp index d4c9416..7df111d 100755 --- a/src/chat/gcol.cpp +++ b/src/chat/gcol.cpp @@ -44,8 +44,6 @@ gcol::add_user_to_garbage( user* p_user ) p_user->s_mess_delete(); p_map_users->add_elem( p_user, tool::to_lower(p_user->get_name()) ); wrap::system_message( GARUSER + p_user->get_name() ); - p_user->destroy_session(); - #ifdef NCURSES print_garbage(); diff --git a/src/chat/room.cpp b/src/chat/room.cpp index 0e28c84..b927d40 100755 --- a/src/chat/room.cpp +++ b/src/chat/room.cpp @@ -101,14 +101,4 @@ room::set_name( string s_name ) #endif } -void -room::dumpit() -{ - dumpable::add("[room]"); - dumpable::add("Name: "+get_name()); - dumpable::add("Topic: "+get_topic()); - base<user>::dumpit(); -} - - #endif diff --git a/src/chat/room.h b/src/chat/room.h index 4c5fac6..06b0a9a 100755 --- a/src/chat/room.h +++ b/src/chat/room.h @@ -23,8 +23,6 @@ private: logd* p_logd; #endif - - void dumpit(); public: room( string s_name ); diff --git a/src/chat/sman.cpp b/src/chat/sman.cpp index 530aa17..d80d421 100755 --- a/src/chat/sman.cpp +++ b/src/chat/sman.cpp @@ -21,33 +21,23 @@ sman::~sman() string sman::generate_id( int i_len ) { - string s_valid = wrap::CONF->get_elem("chat.session.validchars"); + string valid_chars = wrap::CONF->get_elem("chat.session.validchars"); string s_ret = ""; srand(time(0)+tool::string2int(wrap::CONF->get_elem("chat.session.kloakkey"))); int i_char; - for (int i = 0; i < i_len; i++) { - i_char = rand() % s_valid.length(); - s_ret += s_valid[i_char]; + i_char = rand() % 64; + s_ret += valid_chars[i_char]; } if ( wrap::CONF->get_elem("chat.session.md5hash") == "true" ) { string s_salt = wrap::CONF->get_elem("chat.session.md5salt"); - string s_hash(md5::MD5Crypt(s_ret.c_str(), s_salt.c_str())); - s_ret.append(s_hash.substr(s_ret.find(s_salt) + s_salt.length() + 3)); - } - - // Prove, if the TempID already exists - sess* p_sess = get_elem(s_ret); - - if (p_sess) - { - wrap::system_message(SESSEXI); - return generate_id(i_len); + s_ret = string(md5::MD5Crypt(s_ret.c_str(), s_salt.c_str())); + return s_ret.substr(s_ret.find(s_salt) + s_salt.length() + 3); } return s_ret; diff --git a/src/chat/sman.h b/src/chat/sman.h index 13fc45a..992fc64 100755 --- a/src/chat/sman.h +++ b/src/chat/sman.h @@ -7,11 +7,10 @@ #include "sess.h" #include "../maps/shashmap.h" -#include "../monitor/dump.h" using namespace std; -class sman : public shashmap<sess*> +class sman : private shashmap<sess*> { private: string generate_id( int i_len ); diff --git a/src/chat/user.cpp b/src/chat/user.cpp index bac8b7e..d46f853 100755 --- a/src/chat/user.cpp +++ b/src/chat/user.cpp @@ -73,27 +73,23 @@ user::initialize() void user::clean() { - destroy_session(); - set_fake( false ); - set_invisible( false ); - set_away( false, "" ); -} - -void -user::destroy_session() -{ - if ( !get_has_sess() ) - return; + // If this user has a session + if ( get_has_sess() ) + { #ifdef DATABASE - // Store all changed data into the mysql table if this user is registered: - if ( b_is_reg ) - wrap::DATA->update_user_data( get_name(), "savechangednick", map_changed_data ); + // Store all changed data into the mysql table if this user is registered: + if ( b_is_reg ) + wrap::DATA->update_user_data( get_name(), "savechangednick", map_changed_data ); #endif - set_has_sess(false); - wrap::SMAN->destroy_session(get_tmpid()); - set_tmpid(""); + wrap::SMAN->destroy_session( get_tmpid() ); + // wrap::system_message( SESSION + tool::int2string( wrap::SMAN->get_session_count() ) ); + } + + set_fake( false ); + set_invisible( false ); + set_away( false, "" ); } string @@ -581,15 +577,4 @@ void user::reconf() {} -void -user::dumpit() -{ - dumpable::add("[user]"); - dumpable::add("Name: " + get_name() + - "; Room: " + get_room()->get_name() + - "; Status: " + tool::int2string(get_status())); - dumpable::add("TempID: " + get_tmpid()); -} - - #endif diff --git a/src/chat/user.h b/src/chat/user.h index 4632e07..443eef6 100755 --- a/src/chat/user.h +++ b/src/chat/user.h @@ -5,13 +5,13 @@ #include "../name.h" #include "../time/timo.h" -#include "../monitor/dump.h" +//#include "../memb/memb.h" class room; using namespace std; -class user : public name, public timo, public dumpable +class user : public name, public timo//, public memb<string> { private: @@ -56,8 +56,7 @@ private: pthread_mutex_t mut_map_changed_data; void initialize(); - void set_changed_data( string s_varname, string s_value ); - void dumpit(); + void set_changed_data( string s_varname, string s_value ); public: pthread_cond_t cond_message; @@ -68,7 +67,6 @@ public: ~user(); void clean(); - void destroy_session(); // gets specific data of this user und stores it in // (*p_map<string,string>)["nick"]. this method will be used diff --git a/src/cli/CVS/Entries b/src/cli/CVS/Entries new file mode 100644 index 0000000..10c9656 --- /dev/null +++ b/src/cli/CVS/Entries @@ -0,0 +1,3 @@ +/cli.cpp/1.28/Mon Feb 28 18:03:02 2005// +/cli.h/1.13/Mon Feb 21 02:14:23 2005// +D diff --git a/src/cli/CVS/Repository b/src/cli/CVS/Repository new file mode 100644 index 0000000..4d44c85 --- /dev/null +++ b/src/cli/CVS/Repository @@ -0,0 +1 @@ +ychat/src/cli diff --git a/src/cli/CVS/Root b/src/cli/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/cli/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index cc0f5e5..96a0010 100755 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -37,8 +37,6 @@ cli::parse_input( string s_input ) cout << CLIPRMO << " (d)ebug - Starts debug routine (cli.cpp)" << endl; #endif - cout << CLIPRMO << " (du)mp [part] - Prints out a dump of the data structure" << endl; - cout << CLIPRMO << " (Run without part to list all possibilities)" << endl; cout << CLIPRMO << " (e)cho VAR - Prints out configuration value of VAR" << endl; cout << CLIPRMO << " Wildcards can be used too, example: echo http*" << endl; #ifdef NCURSES @@ -80,11 +78,6 @@ cli::parse_input( string s_input ) cout << CLIPRMI; } #endif - else if ( s_input.compare("du") == 0 || s_input.compare("dump") == 0 ) - { - dump d(vectorize(s_param)); - cout << CLIPRMI; - } else if( s_input.compare("echo") == 0 || s_input.compare("e") == 0 ) { string s_val; @@ -141,7 +134,6 @@ cli::parse_input( string s_input ) { cout << CLIPRMO; wrap::MODL->reload_modules(); - cout << MODRELO << endl; cout << CLIPRMI; } //*>> @@ -215,7 +207,6 @@ cli::parse_input( string s_input ) { cout << CLIPRMO; wrap::MODL->unload_modules(); - cout << MODUNLO << endl; cout << CLIPRMI; } //*>> @@ -294,26 +285,6 @@ cli::print_rusage() delete p_rusage; } -vector<string> -cli::vectorize(string s_param) -{ - vector<string> vec_ret; - unsigned i_pos; - - for (i_pos = s_param.find(" "); - i_pos != string::npos; - i_pos = s_param.find(" ")) - { - vec_ret.push_back(s_param.substr(0, i_pos)); - s_param = s_param.substr(i_pos+1); - } - - if (!s_param.empty()) - vec_ret.push_back(s_param); - - return vec_ret; -} - #ifdef DEBUG void cli::debug_routine() diff --git a/src/cli/cli.h b/src/cli/cli.h index 7d51e3f..23e1d1c 100755 --- a/src/cli/cli.h +++ b/src/cli/cli.h @@ -22,8 +22,6 @@ #include "../thrd/thro.h" #endif -#include "../monitor/dump.h" - using namespace std; #ifndef NCURSES @@ -34,9 +32,8 @@ class cli { #endif private: - int parse_input(string s_input); - vector<string> vectorize(string s_param); - + int parse_input(string s_input); + public: cli( ); ~cli( ); @@ -55,6 +52,7 @@ void start(void* p_void); void start(); #endif + }; #endif diff --git a/src/conf/CVS/Entries b/src/conf/CVS/Entries new file mode 100644 index 0000000..cfb51ed --- /dev/null +++ b/src/conf/CVS/Entries @@ -0,0 +1,3 @@ +/conf.cpp/1.14/Sun Feb 27 06:28:53 2005// +/conf.h/1.11/Sun Feb 27 06:28:53 2005// +D diff --git a/src/conf/CVS/Repository b/src/conf/CVS/Repository new file mode 100644 index 0000000..28454e5 --- /dev/null +++ b/src/conf/CVS/Repository @@ -0,0 +1 @@ +ychat/src/conf diff --git a/src/conf/CVS/Root b/src/conf/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/conf/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/conf/conf.cpp b/src/conf/conf.cpp index 38c29c4..2e5893b 100755 --- a/src/conf/conf.cpp +++ b/src/conf/conf.cpp @@ -36,7 +36,6 @@ conf::conf( string s_conf, map<string,string>* p_start_params ) : name::name( s_ cout << CFILEFA << endl; exit(1); } - else { cout << CFILEOK << "..." << endl; @@ -77,18 +76,12 @@ conf::parse_xml(TiXmlNode* p_node, vector<string>* p_vec) { //cout << p_vec->size() << ": (Value:" << p_child->Value() << ") (Type:" << p_child->Type() << ")" << endl; - if ( strcmp(p_child->Value(),"config") == 0 ) - { - parse_xml(p_child, p_vec); - } - - else if ( strcmp(p_child->Value(),"category") == 0 ) + if ( strcmp(p_child->Value(),"category") == 0 ) { p_vec->push_back(p_child->ToElement()->Attribute("name")); parse_xml(p_child, p_vec); p_vec->pop_back(); } - else if ( strcmp(p_child->Value(),"option") == 0 ) { string s_option_name = ""; diff --git a/src/configure b/src/configure index 125890c..973e85a 100755 --- a/src/configure +++ b/src/configure @@ -70,7 +70,7 @@ perl -e ' remove_from_array("libmysqlclient.so",\@libs); } - if ( /\/\/#define NCURSES/ ) + elsif ( /\/\/#define NCURSES/ ) { remove_from_array("ncurses.h",\@headers); remove_from_array("libncurses.so",\@libs); @@ -158,21 +158,19 @@ perl -e ' print Fout "\t\@if ! test -d `dirname ../obj/$ofile`; then mkdir -p `dirname ../obj/$ofile`; fi\n"; my $class = $ofile; $class =~ s/\.o//; - - my $text; if ( $class =~ /contrib\/.+/ ) { my $dirname = `dirname $class`; - $text = "\t\@echo -n \"Contributed class $class \"\n"; + print Fout "\t\@echo -n \"Compiling contributed class $class \"\n"; } else { - $text = "\t\@echo -n \"Base class $class \"\n"; + print Fout "\t\@echo -n \"Compiling base class $class \"\n"; } print Fout "\t\@\$(CC) \$(CFLAGS) \$(INCLUDES) $args -c -o ../obj/$ofile $cppfile\n"; - print Fout $text."\t\@du -hc ../obj/$ofile | tail -n 1 | sed s/total// | sed \"s/ //g\"\n"; + print Fout "\t\@du -hc ../obj/$ofile | tail -n 1 | sed s/total// | sed \"s/ //g\"\n"; } close Fout; diff --git a/src/contrib/CVS/Entries b/src/contrib/CVS/Entries new file mode 100644 index 0000000..06e533f --- /dev/null +++ b/src/contrib/CVS/Entries @@ -0,0 +1,2 @@ +/README/1.2/Thu Sep 2 18:41:04 2004// +D diff --git a/src/contrib/CVS/Entries.Log b/src/contrib/CVS/Entries.Log new file mode 100644 index 0000000..ed82d0a --- /dev/null +++ b/src/contrib/CVS/Entries.Log @@ -0,0 +1,2 @@ +A D/crypt//// +A D/xml//// diff --git a/src/contrib/CVS/Repository b/src/contrib/CVS/Repository new file mode 100644 index 0000000..72ffe25 --- /dev/null +++ b/src/contrib/CVS/Repository @@ -0,0 +1 @@ +ychat/src/contrib diff --git a/src/contrib/CVS/Root b/src/contrib/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/contrib/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/contrib/crypt/CVS/Entries b/src/contrib/crypt/CVS/Entries new file mode 100644 index 0000000..78ab490 --- /dev/null +++ b/src/contrib/crypt/CVS/Entries @@ -0,0 +1,5 @@ +/how/1.1/Tue Aug 31 17:50:55 2004// +/md5.cpp/1.4/Mon Feb 21 01:55:49 2005// +/md5.h/1.4/Mon Feb 21 01:55:49 2005// +/md5crypt.cpp/1.4/Mon Feb 21 01:55:49 2005// +D diff --git a/src/contrib/crypt/CVS/Repository b/src/contrib/crypt/CVS/Repository new file mode 100644 index 0000000..d0db555 --- /dev/null +++ b/src/contrib/crypt/CVS/Repository @@ -0,0 +1 @@ +ychat/src/contrib/crypt diff --git a/src/contrib/crypt/CVS/Root b/src/contrib/crypt/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/contrib/crypt/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/contrib/xml/CVS/Entries b/src/contrib/xml/CVS/Entries new file mode 100644 index 0000000..baf8483 --- /dev/null +++ b/src/contrib/xml/CVS/Entries @@ -0,0 +1,6 @@ +/README/1.1/Tue Sep 7 17:28:34 2004// +/tinyxml.cpp/1.4/Mon Feb 21 01:55:49 2005// +/tinyxml.h/1.5/Mon Feb 21 01:55:49 2005// +/tinyxmlerror.cpp/1.4/Mon Feb 21 01:55:49 2005// +/tinyxmlparser.cpp/1.4/Mon Feb 21 01:55:49 2005// +D diff --git a/src/contrib/xml/CVS/Repository b/src/contrib/xml/CVS/Repository new file mode 100644 index 0000000..e2aeffc --- /dev/null +++ b/src/contrib/xml/CVS/Repository @@ -0,0 +1 @@ +ychat/src/contrib/xml diff --git a/src/contrib/xml/CVS/Root b/src/contrib/xml/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/contrib/xml/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/data/CVS/Entries b/src/data/CVS/Entries new file mode 100644 index 0000000..1c04c12 --- /dev/null +++ b/src/data/CVS/Entries @@ -0,0 +1,10 @@ +/README/1.1/Sun Apr 11 05:17:03 2004// +/con.cpp/1.9/Mon Feb 21 01:55:49 2005// +/con.h/1.7/Mon Feb 21 01:55:49 2005// +/con_base.cpp/1.7/Fri Jan 7 21:17:53 2005// +/con_base.h/1.8/Mon Feb 21 01:55:49 2005// +/data.cpp/1.13/Fri Feb 25 00:52:24 2005// +/data.h/1.10/Fri Feb 25 00:52:24 2005// +/data_base.cpp/1.15/Sun Mar 6 20:44:47 2005// +/data_base.h/1.12/Sun Mar 6 20:44:47 2005// +D diff --git a/src/data/CVS/Repository b/src/data/CVS/Repository new file mode 100644 index 0000000..430304a --- /dev/null +++ b/src/data/CVS/Repository @@ -0,0 +1 @@ +ychat/src/data diff --git a/src/data/CVS/Root b/src/data/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/data/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot @@ -1,11 +1,11 @@ /* Notice: - + All #defines which start with an CONFIG can be edited through gmake config in the main directory! */ -#include "maps/hashmap.h" +#include "maps/hashmap.h" // global variables. #ifndef GLOB_H @@ -18,15 +18,15 @@ //<<* /* FIRST THE YCHAT ONLY OPTIONS */ -/* - CONFIG - +/* - CONFIG - Should yChat get compiled with database support? Currently MyS- QL only is a supported database. */ //#define DATABASE #ifdef DATABASE -#define USE_MYSQL -/* - CONFIG - +#define USE_MYSQL +/* - CONFIG - Should all database queries printed out at the admin interface? (This option wont take action if database support has not been chosen) @@ -54,12 +54,12 @@ */ #define CONFILE "ychat.conf" -/* - DISABLED - +/* - DISABLED - Enable debugging options. */ //#define DEBUG -/* - DISABLED - +/* - DISABLED - If you want to enable EXPERIMENTAL features, then set this val- ue to true. Else use false which is recommended! All experimen- al features are marked inside of the running yChat! @@ -68,7 +68,7 @@ /* - CONFIG - Should yChat get compiled with logging support? -*/ +*/ #define LOGGING /* - CONFIG - @@ -80,33 +80,23 @@ */ #define MAXPORT 65535 -/* Specifies the max amount of lines to read from a HTTP request - header -*/ -#define MAXLINES 30 - -/* Specifies the max length of a lines to read from a HTTP request - header -*/ -#define MAXLENGTH 1024 - /* - CONFIG - Should yChat get compiled with ncurses support? -*/ +*/ #define NCURSES -/* - CONFIG - +/* - CONFIG - Please specify the maximum length of a HTTP post request. */ #define POSTBUF 512 -/* - CONFIG - +/* - CONFIG - Please specify the size of a temporary buffer. (Will be used f- or different tasks) */ #define READBUF 2048 -/* - CONFIG - +/* - CONFIG - Please specify the maximum length of a line read from a socket or a file. ( config-file, html-template ) */ @@ -133,7 +123,7 @@ */ //#define CTCSEGV -/* - CONFIG - +/* - CONFIG - Please chose if you want to use verbose server outputs or not. The verbose messages will appear in the ncurses menu if ncurses is enabled or in the server-window if yChat has been compiled @@ -149,42 +139,42 @@ // The following values define the positions of the data stats in the NCURSES interface. #ifdef NCURSES #define NCUR_SERVER_HEADER_X 21 -#define NCUR_SERVER_HEADER_Y 2 +#define NCUR_SERVER_HEADER_Y 2 #define NCUR_PORT_X 22 #define NCUR_PORT_Y 2 #define NCUR_HITS_X 23 #define NCUR_HITS_Y 2 #define NCUR_POOL_HEADER_X 21 -#define NCUR_POOL_HEADER_Y 16 +#define NCUR_POOL_HEADER_Y 16 #define NCUR_POOL_WAIT_X 22 -#define NCUR_POOL_WAIT_Y 16 +#define NCUR_POOL_WAIT_Y 16 #define NCUR_POOL_RUNNING_X 23 -#define NCUR_POOL_RUNNING_Y 16 +#define NCUR_POOL_RUNNING_Y 16 #define NCUR_DATA_HEADER_X 21 -#define NCUR_DATA_HEADER_Y 35 +#define NCUR_DATA_HEADER_Y 35 #define NCUR_GARBAGE_X 22 #define NCUR_GARBAGE_Y 35 -#define NCUR_CON_QUEUE_X 23 +#define NCUR_CON_QUEUE_X 23 #define NCUR_CON_QUEUE_Y 35 #define NCUR_CHAT_HEADER_X 21 #define NCUR_CHAT_HEADER_Y 52 #define NCUR_NUM_ROOMS_X 22 -#define NCUR_NUM_ROOMS_Y 52 +#define NCUR_NUM_ROOMS_Y 52 #define NCUR_SESSION_X 23 -#define NCUR_SESSION_Y 52 +#define NCUR_SESSION_Y 52 #define NCUR_CACHED_HEADER_X 21 -#define NCUR_CACHED_HEADER_Y 68 +#define NCUR_CACHED_HEADER_Y 68 #define NCUR_CACHED_DOCS_X 22 -#define NCUR_CACHED_DOCS_Y 68 -#define NCUR_CACHED_MODS_X 23 -#define NCUR_CACHED_MODS_Y 68 +#define NCUR_CACHED_DOCS_Y 68 +#define NCUR_CACHED_MODS_X 23 +#define NCUR_CACHED_MODS_Y 68 #define NCUR_MENU_CHAR_X 0 -#define NCUR_MENU_CHAR_Y 33 +#define NCUR_MENU_CHAR_Y 33 #define NCUR_UPTIME_X 0 #define NCUR_UPTIME_Y 44 #define NCUR_TIME_X 0 @@ -202,13 +192,13 @@ typedef int function( void *v_arg ); struct container { - void* elem[4]; + void* elem[4]; }; struct dynmod { - function *the_func ; - void *the_module; + function *the_func ; + void *the_module; }; typedef enum method_ { diff --git a/src/html.cpp b/src/html.cpp index 3f47867..4160f60 100755 --- a/src/html.cpp +++ b/src/html.cpp @@ -43,11 +43,12 @@ html::parse( map<string,string> &map_params ) if ( ! if_templ ) { wrap::system_message( OFFFOUND + s_path ); - if(map_params["request"] == wrap::CONF->get_elem( "httpd.html.notfound" )) + if(map_params["request"]== wrap::CONF->get_elem( "httpd.html.notfound" )) return ""; map_params["request"] = wrap::CONF->get_elem( "httpd.html.notfound" ); return parse( map_params ); + } char c_buf; diff --git a/src/irc/CVS/Entries b/src/irc/CVS/Entries new file mode 100644 index 0000000..1784810 --- /dev/null +++ b/src/irc/CVS/Entries @@ -0,0 +1 @@ +D diff --git a/src/irc/CVS/Repository b/src/irc/CVS/Repository new file mode 100644 index 0000000..5585e3c --- /dev/null +++ b/src/irc/CVS/Repository @@ -0,0 +1 @@ +ychat/src/irc diff --git a/src/irc/CVS/Root b/src/irc/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/irc/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/main.cpp b/src/main.cpp index 2bfe28c..6d0434f 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,8 +1,7 @@ /* * yChat; Contact: www.yChat.org; Mail@yChat.org * Copyright (C) 2003 Paul C. Buetow, Volker Richter - * Copyright (C) 2004 Paul C. Buetow - * Copyright (C) 2005 EXA Digital Solutions GbR + * Copyright (C) 2004, 2005 Paul C. Buetow * ----------------------------------------------------------------- * * This program is free software; you can redistribute it and/or @@ -89,6 +88,7 @@ main(int argc, char* argv[]) wrap::init_wrapper(parse_argc(argc, argv)); + //<<* // Initialize database connection queue #ifdef DATABASE diff --git a/src/maps/CVS/Entries b/src/maps/CVS/Entries new file mode 100644 index 0000000..991bf8b --- /dev/null +++ b/src/maps/CVS/Entries @@ -0,0 +1,9 @@ +/hashmap.h/1.12/Fri Mar 4 21:00:44 2005// +/hashmap.tmpl/1.6/Fri Mar 4 21:00:44 2005// +/mtools.h/1.7/Mon Feb 21 01:55:49 2005// +/mtools.tmpl/1.6/Mon Feb 21 01:55:49 2005// +/nhashmap.h/1.5/Fri Mar 4 21:00:44 2005// +/nhashmap.tmpl/1.4/Fri Mar 4 21:00:44 2005// +/shashmap.h/1.8/Fri Mar 4 21:00:44 2005// +/shashmap.tmpl/1.6/Fri Mar 4 21:00:45 2005// +D diff --git a/src/maps/CVS/Repository b/src/maps/CVS/Repository new file mode 100644 index 0000000..b7c8ecb --- /dev/null +++ b/src/maps/CVS/Repository @@ -0,0 +1 @@ +ychat/src/maps diff --git a/src/maps/CVS/Root b/src/maps/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/maps/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/maps/shashmap.h b/src/maps/shashmap.h index 99dd7c8..6152ba2 100644 --- a/src/maps/shashmap.h +++ b/src/maps/shashmap.h @@ -4,8 +4,6 @@ #include <pthread.h> #include "hashmap.h" -#include "../monitor/dump.h" - using namespace std; template @@ -15,15 +13,11 @@ template class hash_type = size_hash<string>, class alloc_type = compare_allocator<string> > -class shashmap : protected hashmap<obj_type, key_type_, hash_type, alloc_type>, - public dumpable +class shashmap : protected hashmap<obj_type, key_type_, hash_type, alloc_type> { private: pthread_mutex_t mut_shashmap; -protected: - virtual void dumpit(); - public: explicit shashmap(); ~shashmap(); @@ -42,7 +36,6 @@ public: virtual inline vector<key_type_>* get_key_vector(); virtual inline void run_func( void (*func)(obj_type) ); virtual inline void run_func( void (*func)(obj_type, void*), void* v_arg ); - }; #include "shashmap.tmpl" diff --git a/src/maps/shashmap.tmpl b/src/maps/shashmap.tmpl index c864d28..4559284 100644 --- a/src/maps/shashmap.tmpl +++ b/src/maps/shashmap.tmpl @@ -139,17 +139,3 @@ shashmap<obj_type, key_type_, hash_type, alloc_type>::run_func( void (*func)(obj hashmap<obj_type, key_type_, hash_type, alloc_type>::run_func(func, v_arg); pthread_mutex_unlock( &mut_shashmap ); } - -template<class obj_type, class key_type_, class hash_type, class alloc_type> -void -shashmap<obj_type, key_type_, hash_type, alloc_type>::dumpit() -{ - dumpable::add("[shashmap]"); - vector<key_type_>* p_vec = get_key_vector(); - - typename vector<key_type_>::iterator iter; - for (iter = p_vec->begin(); iter != p_vec->end(); ++iter) - dumpable::add(*iter); - - delete p_vec; -} diff --git a/src/memb/CVS/Entries b/src/memb/CVS/Entries new file mode 100644 index 0000000..ba3a2e5 --- /dev/null +++ b/src/memb/CVS/Entries @@ -0,0 +1,5 @@ +/memb.h/1.2/Mon Feb 21 01:55:49 2005// +/memb.tmpl/1.2/Mon Feb 21 01:55:49 2005// +/tupel.h/1.2/Mon Feb 21 01:55:49 2005// +/tupel.tmpl/1.2/Mon Feb 21 01:55:49 2005// +D diff --git a/src/memb/CVS/Repository b/src/memb/CVS/Repository new file mode 100644 index 0000000..cf42388 --- /dev/null +++ b/src/memb/CVS/Repository @@ -0,0 +1 @@ +ychat/src/memb diff --git a/src/memb/CVS/Root b/src/memb/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/memb/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/memb/memb.h b/src/memb/memb.h index 1997750..9c398ec 100644 --- a/src/memb/memb.h +++ b/src/memb/memb.h @@ -1,33 +1,8 @@ -/*:* - *: File: ./src/memb/memb.h - *: - *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: - *: 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *:*/ - #ifndef MEMB_H #define MEMB_H #include "../incl.h" -#include "../wrap.h" -#include "../maps/hashmap.h" +#include "../maps/nhashmap.h" #include "tupel.h" using namespace std; @@ -36,58 +11,13 @@ template<class obj_type> class memb { private: - hashmap< mutexed_tupel<obj_type>* > map_elems; + nhashmap< mutexed_tupel<obj_type>* > map_elems; public: - memb() - {} - memb(vector<string> &vec_fields); - void initialize(vector<string> &vec_fields); inline obj_type get_elem(string s_key); inline void set_elem(obj_type t_obj, string s_key); -}; - -struct memb_string : protected memb<string> -{ - memb_string() - {} - memb_string(vector<string> &vec_fields) : memb<string>(vec_fields) - {} - void init_strings(vector<string> vec_fields) - { - initialize(vec_fields); - } - inline string get_string(string s_key); - inline void set_string(string s_obj, string s_key); -}; -struct memb_int : protected memb<int> -{ - memb_int() - {} - void init_ints(vector<string> vec_fields) - { - initialize(vec_fields); - } - inline int get_int(string s_key); - inline void set_int(int i_obj, string s_key); }; -struct memb_bool : protected memb<bool> -{ - memb_bool() - {} - void init_bools(vector<string> vec_fields) - { - initialize(vec_fields); - } - inline bool get_bool(string s_key); - inline void set_bool(bool b_obj, string s_key); -}; - -class memb_base : public memb_string, public memb_int, public memb_bool - {} -; - #include "memb.tmpl" #endif diff --git a/src/memb/memb.tmpl b/src/memb/memb.tmpl index 37eb2ab..0b4da0e 100644 --- a/src/memb/memb.tmpl +++ b/src/memb/memb.tmpl @@ -1,44 +1,3 @@ -/*:* - *: File: ./src/memb/memb.tmpl - *: - *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: - *: 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *:*/ - - -template<class obj_type> -memb<obj_type>::memb(vector<string> &vec_fields) -{ - initialize(vec_fields); -} - -template<class obj_type> -void -memb<obj_type>::initialize(vector<string> &vec_fields) -{ - obj_type t_default; - vector<string>::iterator iter; - for (iter = vec_fields.begin(); iter != vec_fields.end(); ++iter) - map_elems[*iter] = new mutexed_tupel<obj_type>(t_default); -} - template<class obj_type> obj_type memb<obj_type>::get_elem(string s_key) @@ -47,58 +6,12 @@ memb<obj_type>::get_elem(string s_key) if ( p_tupel ) return p_tupel->get_elem(); - obj_type t_ret; - return t_ret; + return obj_type(); } template<class obj_type> void memb<obj_type>::set_elem(obj_type t_obj, string s_key) { - mutexed_tupel<obj_type> *p_tupel = map_elems.get_elem(s_key); - if ( p_tupel ) - { - p_tupel->set_elem(t_obj); - return; - } - - //wrap::system_message(MEMBERE+string("("+s_key+")")); + // mutexed_tupel<obj_type> *p_tupel = map_elems } - -string -memb_string::get_string(string s_key) -{ - return get_elem(s_key); -} - -void -memb_string::set_string(string s_obj, string s_key) -{ - set_elem(s_obj, s_key); -} - -int -memb_int::get_int(string s_key) -{ - return get_elem(s_key); -} - -void -memb_int::set_int(int i_obj, string s_key) -{ - set_elem(i_obj, s_key); -} - -bool -memb_bool::get_bool(string s_key) -{ - return get_elem(s_key); -} - -void -memb_bool::set_bool(bool b_obj, string s_key) -{ - set_elem(b_obj, s_key); -} - - diff --git a/src/memb/tupel.h b/src/memb/tupel.h index f4cc288..bb1939e 100644 --- a/src/memb/tupel.h +++ b/src/memb/tupel.h @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/memb/tupel.h - *: - *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: - *: 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *:*/ - #ifndef TUPEL_H #define TUPEL_H @@ -37,9 +13,7 @@ class tupel private: pthread_mutex_t mut_tupel; obj_type t_obj; - public: - tupel(); tupel(obj_type t_obj); ~tupel(); diff --git a/src/memb/tupel.tmpl b/src/memb/tupel.tmpl index acc8c40..bdde516 100644 --- a/src/memb/tupel.tmpl +++ b/src/memb/tupel.tmpl @@ -1,53 +1,29 @@ -/*:* - *: File: ./src/memb/tupel.tmpl - *: - *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: - *: 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *:*/ - template<class obj_type> tupel<obj_type>::tupel() { - pthread_mutex_init(&mut_tupel, NULL); + pthread_mutex_init( &mut_tupel, NULL ); } template<class obj_type> tupel<obj_type>::tupel(obj_type t_obj) { this->t_obj = t_obj; - pthread_mutex_init(&mut_tupel, NULL); + pthread_mutex_init( &mut_tupel, NULL ); } template<class obj_type> tupel<obj_type>::~tupel() { - pthread_mutex_destroy(&mut_tupel); + pthread_mutex_destroy( &mut_tupel ); } template<class obj_type> obj_type tupel<obj_type>::get_elem() { - pthread_mutex_lock(&mut_tupel); + pthread_mutex_lock( &mut_tupel ); obj_type t_ret = t_obj; - pthread_mutex_unlock(&mut_tupel); + pthread_mutex_unlock( &mut_tupel ); return t_ret; } @@ -55,7 +31,7 @@ template<class obj_type> void tupel<obj_type>::set_elem(obj_type t_obj) { - pthread_mutex_lock(&mut_tupel); + pthread_mutex_lock( &mut_tupel ); this->t_obj = t_obj; - pthread_mutex_unlock(&mut_tupel); + pthread_mutex_unlock( &mut_tupel ); } @@ -7,7 +7,7 @@ using namespace std; -class modl : public shashmap<dynmod*> +class modl : private shashmap<dynmod*> { private: static void dlclose_( dynmod* mod ); diff --git a/src/mods/CVS/Entries b/src/mods/CVS/Entries new file mode 100644 index 0000000..7567a1c --- /dev/null +++ b/src/mods/CVS/Entries @@ -0,0 +1,3 @@ +/Makefile/1.4/Tue Jan 4 13:51:00 2005// +/configure/1.7/Thu Jul 8 14:39:03 2004// +D diff --git a/src/mods/CVS/Entries.Log b/src/mods/CVS/Entries.Log new file mode 100644 index 0000000..e9f894a --- /dev/null +++ b/src/mods/CVS/Entries.Log @@ -0,0 +1,3 @@ +A D/commands//// +A D/html//// +A D/irc//// diff --git a/src/mods/CVS/Repository b/src/mods/CVS/Repository new file mode 100644 index 0000000..d3c2e91 --- /dev/null +++ b/src/mods/CVS/Repository @@ -0,0 +1 @@ +ychat/src/mods diff --git a/src/mods/CVS/Root b/src/mods/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/mods/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/mods/commands/CVS/Entries b/src/mods/commands/CVS/Entries new file mode 100644 index 0000000..0e0d041 --- /dev/null +++ b/src/mods/commands/CVS/Entries @@ -0,0 +1,32 @@ +/Makefile/1.31/Sun Mar 6 20:44:47 2005// +/Makefile.in/1.8/Sun Mar 6 20:44:47 2005// +/yc_about.cpp/1.2/Mon Feb 21 01:55:49 2005// +/yc_all.cpp/1.2/Mon Feb 21 01:55:49 2005// +/yc_away.cpp/1.9/Mon Feb 21 01:55:49 2005// +/yc_col.cpp/1.10/Mon Feb 21 01:55:49 2005// +/yc_compopt.cpp/1.4/Mon Feb 21 01:55:49 2005// +/yc_exec.cpp/1.10/Mon Feb 21 01:55:49 2005// +/yc_fake.cpp/1.12/Mon Feb 21 01:55:49 2005// +/yc_getroom.cpp/1.7/Mon Feb 21 01:55:49 2005// +/yc_getrusage.cpp/1.9/Mon Feb 21 01:55:49 2005// +/yc_help.cpp/1.5/Mon Feb 21 01:55:49 2005// +/yc_invisible.cpp/1.10/Mon Feb 21 01:55:49 2005// +/yc_j.cpp/1.10/Mon Feb 21 01:55:50 2005// +/yc_ko.cpp/1.8/Mon Feb 21 01:55:50 2005// +/yc_m.cpp/1.8/Mon Feb 21 01:55:50 2005// +/yc_md5.cpp/1.8/Mon Feb 21 01:55:50 2005// +/yc_me.cpp/1.8/Mon Feb 21 01:55:50 2005// +/yc_morph.cpp/1.4/Mon Feb 21 01:55:50 2005// +/yc_msg.cpp/1.10/Mon Feb 21 01:55:50 2005// +/yc_q.cpp/1.9/Mon Feb 21 01:55:50 2005// +/yc_reload.cpp/1.8/Mon Feb 21 01:55:50 2005// +/yc_ren.cpp/1.8/Mon Feb 21 01:55:50 2005// +/yc_s.cpp/1.9/Mon Feb 21 01:55:50 2005// +/yc_set.cpp/1.8/Mon Feb 21 01:55:50 2005// +/yc_template.cpp/1.8/Mon Feb 21 01:55:50 2005// +/yc_time.cpp/1.7/Mon Feb 21 01:55:50 2005// +/yc_topic.cpp/1.11/Mon Feb 21 01:55:50 2005// +/yc_uptime.cpp/1.7/Mon Feb 21 01:55:50 2005// +/yc_users.cpp/1.2/Mon Feb 21 01:55:50 2005// +/yc_version.cpp/1.10/Mon Feb 21 01:55:50 2005// +D diff --git a/src/mods/commands/CVS/Repository b/src/mods/commands/CVS/Repository new file mode 100644 index 0000000..567651e --- /dev/null +++ b/src/mods/commands/CVS/Repository @@ -0,0 +1 @@ +ychat/src/mods/commands diff --git a/src/mods/commands/CVS/Root b/src/mods/commands/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/mods/commands/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/mods/commands/Makefile b/src/mods/commands/Makefile new file mode 100644 index 0000000..977b548 --- /dev/null +++ b/src/mods/commands/Makefile @@ -0,0 +1,48 @@ +SRCS=yc_about.cpp yc_all.cpp yc_away.cpp yc_col.cpp yc_compopt.cpp yc_exec.cpp yc_fake.cpp yc_getroom.cpp yc_getrusage.cpp yc_help.cpp yc_invisible.cpp yc_j.cpp yc_ko.cpp yc_m.cpp yc_md5.cpp yc_me.cpp yc_morph.cpp yc_msg.cpp yc_q.cpp yc_reload.cpp yc_ren.cpp yc_s.cpp yc_set.cpp yc_template.cpp yc_time.cpp yc_topic.cpp yc_uptime.cpp yc_users.cpp yc_version.cpp +MODS=$(addprefix ../../../mods/commands/, $(SRCS:.cpp=.so)) +CC=g++ +INCLUDES=`cat ../../includes.add` +CFLAGS=`cat ../cflags.add` +all: mods +$(MODS): + @echo -n "Compiling command module `basename $@ | sed s/\.so// | sed s/yc_//` " + @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi + @$(CC) $(CFLAGS) $(INCLUDES) -shared -s -o $@ `echo $(notdir $@) | sed s/.so/.cpp/` + @du -hc $@ | tail -n 1 | sed s/total// | sed "s/ //g" +infotext: + @echo Compiling command modules +mods: infotext $(MODS) + @echo "Num of command modules: " + @ls ../../../mods/commands/*.so | wc -l +clean: + @echo Cleaning command modules + @if test -d ../../../mods/commands; then rm -Rf ../../../mods/commands; fi +../../../mods/commands/yc_about.so: yc_about.cpp +../../../mods/commands/yc_all.so: yc_all.cpp +../../../mods/commands/yc_away.so: yc_away.cpp +../../../mods/commands/yc_col.so: yc_col.cpp +../../../mods/commands/yc_compopt.so: yc_compopt.cpp +../../../mods/commands/yc_exec.so: yc_exec.cpp +../../../mods/commands/yc_fake.so: yc_fake.cpp +../../../mods/commands/yc_getroom.so: yc_getroom.cpp +../../../mods/commands/yc_getrusage.so: yc_getrusage.cpp +../../../mods/commands/yc_help.so: yc_help.cpp +../../../mods/commands/yc_invisible.so: yc_invisible.cpp +../../../mods/commands/yc_j.so: yc_j.cpp +../../../mods/commands/yc_ko.so: yc_ko.cpp +../../../mods/commands/yc_m.so: yc_m.cpp +../../../mods/commands/yc_md5.so: yc_md5.cpp +../../../mods/commands/yc_me.so: yc_me.cpp +../../../mods/commands/yc_morph.so: yc_morph.cpp +../../../mods/commands/yc_msg.so: yc_msg.cpp +../../../mods/commands/yc_q.so: yc_q.cpp +../../../mods/commands/yc_reload.so: yc_reload.cpp +../../../mods/commands/yc_ren.so: yc_ren.cpp +../../../mods/commands/yc_s.so: yc_s.cpp +../../../mods/commands/yc_set.so: yc_set.cpp +../../../mods/commands/yc_template.so: yc_template.cpp +../../../mods/commands/yc_time.so: yc_time.cpp +../../../mods/commands/yc_topic.so: yc_topic.cpp +../../../mods/commands/yc_uptime.so: yc_uptime.cpp +../../../mods/commands/yc_users.so: yc_users.cpp +../../../mods/commands/yc_version.so: yc_version.cpp diff --git a/src/mods/commands/Makefile.in b/src/mods/commands/Makefile.in index 42884b6..7ca8455 100755 --- a/src/mods/commands/Makefile.in +++ b/src/mods/commands/Makefile.in @@ -4,9 +4,9 @@ INCLUDES=`cat ../../includes.add` CFLAGS=`cat ../cflags.add` all: mods $(MODS): + @echo -n "Compiling command module `basename $@ | sed s/\.so// | sed s/yc_//` " @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi @$(CC) $(CFLAGS) $(INCLUDES) -shared -s -o $@ `echo $(notdir $@) | sed s/.so/.cpp/` - @echo -n "Command module `basename $@ | sed s/\.so// | sed s/yc_//` " @du -hc $@ | tail -n 1 | sed s/total// | sed "s/ //g" infotext: @echo Compiling command modules diff --git a/src/mods/html/CVS/Entries b/src/mods/html/CVS/Entries new file mode 100644 index 0000000..c3b5155 --- /dev/null +++ b/src/mods/html/CVS/Entries @@ -0,0 +1,9 @@ +/Makefile/1.27/Sun Mar 6 20:44:47 2005// +/Makefile.in/1.9/Sun Mar 6 20:44:47 2005// +/yc_admin.cpp/1.8/Fri Feb 25 00:52:24 2005// +/yc_colors.cpp/1.10/Fri Feb 25 00:52:24 2005// +/yc_help.cpp/1.13/Fri Feb 25 00:52:24 2005// +/yc_loggedin.cpp/1.4/Fri Feb 25 00:52:24 2005// +/yc_options.cpp/1.10/Fri Feb 25 00:52:24 2005// +/yc_register.cpp/1.13/Fri Feb 25 00:52:24 2005// +D diff --git a/src/mods/html/CVS/Repository b/src/mods/html/CVS/Repository new file mode 100644 index 0000000..bb3b6b7 --- /dev/null +++ b/src/mods/html/CVS/Repository @@ -0,0 +1 @@ +ychat/src/mods/html diff --git a/src/mods/html/CVS/Root b/src/mods/html/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/mods/html/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/mods/html/Makefile b/src/mods/html/Makefile new file mode 100644 index 0000000..7c3b970 --- /dev/null +++ b/src/mods/html/Makefile @@ -0,0 +1,25 @@ +SRCS=yc_admin.cpp yc_colors.cpp yc_help.cpp yc_loggedin.cpp yc_options.cpp yc_register.cpp +MODS=$(addprefix ../../../mods/html/, $(SRCS:.cpp=.so)) +CC=g++ +INCLUDES=`cat ../../includes.add` +CFLAGS=`cat ../cflags.add` +all: mods +$(MODS): + @echo -n "Compiling html module `basename $@ | sed s/\.so// | sed s/yc_//` " + @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi + @$(CC) $(CFLAGS) $(INCLUDES) -shared -s -o $@ `echo $(notdir $@) | sed s/.so/.cpp/` + @du -hc $@ | tail -n 1 | sed s/total// | sed "s/ //g" +infotext: + @echo Compiling html modules +mods: infotext $(MODS) + @echo "Num of html modules: " + @ls ../../../mods/html/*.so | wc -l +clean: + @echo Cleaning html modules + @if test -d ../../../mods/html; then rm -Rf ../../../mods/html; fi +../../../mods/html/yc_admin.so: yc_admin.cpp +../../../mods/html/yc_colors.so: yc_colors.cpp +../../../mods/html/yc_help.so: yc_help.cpp +../../../mods/html/yc_loggedin.so: yc_loggedin.cpp +../../../mods/html/yc_options.so: yc_options.cpp +../../../mods/html/yc_register.so: yc_register.cpp diff --git a/src/mods/html/Makefile.in b/src/mods/html/Makefile.in index 4b7c728..b65c9e6 100755 --- a/src/mods/html/Makefile.in +++ b/src/mods/html/Makefile.in @@ -4,12 +4,12 @@ INCLUDES=`cat ../../includes.add` CFLAGS=`cat ../cflags.add` all: mods $(MODS): + @echo -n "Compiling html module `basename $@ | sed s/\.so// | sed s/yc_//` " @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi @$(CC) $(CFLAGS) $(INCLUDES) -shared -s -o $@ `echo $(notdir $@) | sed s/.so/.cpp/` - @echo -n "HTML module `basename $@ | sed s/\.so// | sed s/yc_//` " @du -hc $@ | tail -n 1 | sed s/total// | sed "s/ //g" infotext: - @echo Compiling HTML modules + @echo Compiling html modules mods: infotext $(MODS) @echo "Num of html modules: " @ls ../../../mods/html/*.so | wc -l diff --git a/src/mods/irc/CVS/Entries b/src/mods/irc/CVS/Entries new file mode 100644 index 0000000..1784810 --- /dev/null +++ b/src/mods/irc/CVS/Entries @@ -0,0 +1 @@ +D diff --git a/src/mods/irc/CVS/Repository b/src/mods/irc/CVS/Repository new file mode 100644 index 0000000..f48a470 --- /dev/null +++ b/src/mods/irc/CVS/Repository @@ -0,0 +1 @@ +ychat/src/mods/irc diff --git a/src/mods/irc/CVS/Root b/src/mods/irc/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/mods/irc/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot @@ -86,15 +86,12 @@ #define SESSION "Session: Count " #define SESSDMP "Session: Dump of session" #define SESSERR "Session: Could not find session " -#define SESSEXI "Session: New TempID already exists, recalc." #define SHELLER "Shell: Could not execute command" #define SHELLEX "Shell: Executing the following command:" #define SIGSIGV "Signal: SIGV received!" #define STATUPR "Stats: Updated rusage history" #define STATRSS "Stats: Max resident set size " #define REUROOM "Garbage: Reusing room object " -#define SOCKER1 "Sock: Can't create socket, aborting" -#define SOCKUNS "Sock: Starting hypertext transport [HTTP]" #define SOCKCLN "Sock: Initializing a client socket at " #define SOCKCON "Sock: Connecting to " #define SOCKCRT "Sock: Created socket on " @@ -115,14 +112,14 @@ #define XMLREAD "XML: Reading " #define XMLERR "XML Error: " #define XMLER1 "XML Error: Unable to load file " -#define VERSION "0.7.9.4" +#define VERSION "0.7.9" #define BRANCH "RELEASE" -#define BUILDNR 3807 -#define UNAME "FreeBSD 5.4-RELEASE i386" +#define BUILDNR 3624 +#define UNAME "FreeBSD 5.3-RELEASE-p5 i386" #define COMPOPT "Using built-in specs.; Configured with: FreeBSD/i386 system compiler; Thread model: posix; gcc version 3.4.2 [FreeBSD] 20040728; 3.4; g++" #define YCUSAGE "Usage: ./ychat {h|v}|{o confkey confvalue}\n" -#define HEADER1 "HTTP/1.1 200 OK\r\n" +#define HEADER1 "HTTP/1.0 200 OK\r\n" #define HEADER2 "Server: yChat/" VERSION "-" BRANCH "\r\n" #define HEADER3 "Cache-control: no-cache\r\n" #define HEADER4 "Pragma: no-cache\r\n" @@ -130,7 +127,6 @@ #define HEADER6 "Connection: keep-alive\r\n" #define HEADER7 "Content-Length: "; #define HEADER8 "Content-Type: "; -#define HEADER8b "; charset=ISO-8859-1\r\n"; -#define HEADER9 "Allow: GET\r\n"; +#define HEADER9 "Allow: GET\n"; #endif diff --git a/src/ncur/CVS/Entries b/src/ncur/CVS/Entries new file mode 100644 index 0000000..b757331 --- /dev/null +++ b/src/ncur/CVS/Entries @@ -0,0 +1,5 @@ +/menu.cpp/1.8/Mon Feb 21 01:55:50 2005// +/menu.h/1.6/Mon Feb 21 01:55:50 2005// +/ncur.cpp/1.26/Wed Mar 9 21:09:32 2005// +/ncur.h/1.11/Sun Mar 6 20:44:47 2005// +D diff --git a/src/ncur/CVS/Repository b/src/ncur/CVS/Repository new file mode 100644 index 0000000..694be25 --- /dev/null +++ b/src/ncur/CVS/Repository @@ -0,0 +1 @@ +ychat/src/ncur diff --git a/src/ncur/CVS/Root b/src/ncur/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/ncur/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/reqp.cpp b/src/reqp.cpp index 9b5da0b..cbd2705 100755 --- a/src/reqp.cpp +++ b/src/reqp.cpp @@ -13,7 +13,6 @@ const string reqp::s_http = HEADER; const string reqp::s_http_stream = STREAM; const string reqp::s_http_colength = HEADER7; const string reqp::s_http_cotype = HEADER8; -const string reqp::s_http_cotype_add = HEADER8b; reqp::reqp( ) {} @@ -44,7 +43,7 @@ reqp::get_request_parameters( string s_parameters, map<string,string>& map_param } string -reqp::get_url( string s_req, map<string, string> &map_params, int& i_postpayloadoffset ) +reqp::get_url( int &i_sock, string s_req, map<string, string> &map_params ) { unsigned i_pos, i_pos2; string s_vars( "" ); @@ -89,20 +88,31 @@ reqp::get_url( string s_req, map<string, string> &map_params, int& i_postpayload { if ( (i_pos2 = s_req.find("HTTP")) != string::npos ) { - if (i_pos2 > 13) + if ( 13 < i_pos2 ) { s_ret = url_decode( s_req.substr(6,i_pos2-7) ); - //wrap::system_message(s_req); - //wrap::system_message(string("data offset=") + tool::int2string(i_postpayloadoffset)); - i_pos = s_req.find("event=",i_postpayloadoffset ); - if(i_pos != string::npos) + int i_len = s_ret.length(); + int i_len2 = s_req.length()-1; + + s_req = s_req.substr( i_len < i_len2 ? i_len : i_len2 ); + + if ( (i_pos = s_req.find("event=")) == string::npos) { - get_request_parameters( url_decode( s_req.substr(i_pos) ), map_params); + char c_req[POSTBUF]; + i_len = read(i_sock, c_req, POSTBUF); + s_req = c_req; + s_req = s_req.substr(0, i_len); + + if ( (i_pos = s_req.find("event=")) != string::npos ) + get_request_parameters( url_decode( s_req.substr(i_pos) ), map_params ); + } + else + { + get_request_parameters( url_decode( s_req.substr(i_pos) ), map_params ); } } } - } #ifdef VERBOSE @@ -121,7 +131,7 @@ reqp::get_url( string s_req, map<string, string> &map_params, int& i_postpayload } string -reqp::get_content_type(string &s_file) +reqp::get_content_type( string s_file ) { string s_ext(tool::get_extension( s_file )); @@ -223,12 +233,11 @@ reqp::get_from_header( string s_req, string s_hdr ) } string -reqp::parse( socketcontainer *p_sock, string s_req, map<string,string> &map_params, int &i_postpayloadoffset ) +reqp::parse( int &i_sock, string s_req, map<string,string> &map_params ) { - // store all request informations in map_params. store the url in // map_params["request"]. - get_url( s_req, map_params, i_postpayloadoffset ); + get_url( i_sock, s_req, map_params ); parse_headers( s_req, map_params ); string s_event( map_params["event"] ); @@ -264,7 +273,7 @@ reqp::parse( socketcontainer *p_sock, string s_req, map<string,string> &map_para } else { - wrap::system_message(SESSERR); + wrap::system_message(SESSERR); return s_rep; } @@ -292,7 +301,7 @@ reqp::parse( socketcontainer *p_sock, string s_req, map<string,string> &map_para { string s_msg ( wrap::HTML->parse( map_params ) ); p_user->msg_post( &s_msg); - wrap::SOCK->chat_stream( p_sock, p_user, map_params ); + wrap::SOCK->chat_stream( i_sock, p_user, map_params ); } // if a request for the online list of the active room. @@ -329,9 +338,8 @@ reqp::parse( socketcontainer *p_sock, string s_req, map<string,string> &map_para if ( s_event.compare("stream") == 0 ) s_resp.append( s_http_stream ); - s_resp.append( s_http_colength + tool::int2string(s_rep.size()) + "\r\n" + - s_http_cotype + map_params["content-type"] + - s_http_cotype_add + "\r\n" ); + s_resp.append( s_http_colength + tool::int2string(s_rep.size()) + "\n" + + s_http_cotype + map_params["content-type"] + "\r\n\r\n" ); s_resp.append(s_rep); @@ -365,10 +373,10 @@ string reqp::remove_dots( string s_ret ) { // remove ".." from the request. - unsigned i_pos; + unsigned pos; - if ( (i_pos = s_ret.find( ".." )) != string::npos ) - return remove_dots(s_ret.substr(0, i_pos)); + if( (pos = s_ret.find( ".." )) != string::npos) + return s_ret.substr(0, pos); return s_ret; } @@ -13,12 +13,11 @@ private: static const string s_http_stream; static const string s_http_colength; static const string s_http_cotype; - static const string s_http_cotype_add; // returns the request url from thr client's http request header // until the first "?" and stores all request parameter values // ( behind "?" ) into map_params. - string get_url( string s_req, map<string,string> &map_params, int& i_postpayloadoffset ); + string get_url( int &i_sock, string s_req, map<string,string> &map_params ); // returns a specific value of the client's http request header. // ( s.t. like the User-Agent, Referer etc... ). string get_from_header( string s_req, string s_hdr ); @@ -33,9 +32,9 @@ private: public: reqp( ); - string parse( socketcontainer* p_sock, string s_req, map<string,string> &map_params, int &i_postpayloadoffset ); + string parse( int &i_sock, string s_req, map<string,string> &map_params ); string url_decode ( string s_url ); - string get_content_type( string& s_file ); + string get_content_type( string s_file ); void parse_headers( string s_req, map<string,string> &map_params ); }; diff --git a/src/sock/CVS/Entries b/src/sock/CVS/Entries new file mode 100644 index 0000000..8431283 --- /dev/null +++ b/src/sock/CVS/Entries @@ -0,0 +1,3 @@ +/sock.cpp/1.29/Sat Mar 5 12:43:37 2005// +/sock.h/1.14/Sun Feb 27 06:28:53 2005// +D diff --git a/src/sock/CVS/Repository b/src/sock/CVS/Repository new file mode 100644 index 0000000..bbe6e49 --- /dev/null +++ b/src/sock/CVS/Repository @@ -0,0 +1 @@ +ychat/src/sock diff --git a/src/sock/CVS/Root b/src/sock/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/sock/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/sock/sock.cpp b/src/sock/sock.cpp index 8f66268..42daf24 100755 --- a/src/sock/sock.cpp +++ b/src/sock/sock.cpp @@ -5,8 +5,9 @@ #include <errno.h> #include <sys/types.h> #include <unistd.h> - #include "sock.h" +#include "../chat/chat.h" +#include "../chat/user.h" using namespace std; @@ -19,40 +20,21 @@ sock::sock() this->log_daemon = new logd( wrap::CONF->get_elem( "httpd.logging.accessfile" ), - wrap::CONF->get_elem( "httpd.logging.access_lines" ) ); + wrap::CONF->get_elem( "httpd.logging.accesslines" ) ); #endif } -int -sock::_send(socketcontainer *p_sock, const char *sz, int len) -{ - - return send( p_sock->i_sock, sz, len, 0 ); -} - -int -sock::_read(socketcontainer *p_sock, char *sz, int len) -{ - - return read( p_sock->i_sock, sz, len ); -} - -int -sock::_close(socketcontainer *p_sock) -{ - shutdown( p_sock->i_sock, 2 ); - close ( p_sock->i_sock ); - delete p_sock; -} +sock::~sock() +{} //<<* void -sock::chat_stream( socketcontainer *p_sock, user *p_user, map<string,string> &map_params ) +sock::chat_stream( int i_sock, user *p_user, map<string,string> &map_params ) { string s_msg( "\n" ); for ( int i = 0; i < PUSHSTR; i++ ) - _send(p_sock,s_msg.c_str(), s_msg.size()); + send( i_sock, s_msg.c_str(), s_msg.size(), 0 ); pthread_mutex_t mutex; pthread_mutex_init( &mutex, NULL ); @@ -62,7 +44,7 @@ sock::chat_stream( socketcontainer *p_sock, user *p_user, map<string,string> &ma { s_msg = p_user->get_mess( ); - if ( 0 > _send( p_sock, s_msg.c_str(), s_msg.size() ) ) + if ( 0 > send( i_sock, s_msg.c_str(), s_msg.size(), 0 ) ) { p_user->set_online( false ); break; @@ -78,7 +60,7 @@ sock::chat_stream( socketcontainer *p_sock, user *p_user, map<string,string> &ma s_msg = p_user->get_mess( ); if ( ! s_msg.empty() ) - _send( p_sock, s_msg.c_str(), s_msg.size()); + send( i_sock, s_msg.c_str(), s_msg.size(), 0 ); // remove the user from its room. string s_user( p_user->get_name() ); @@ -105,7 +87,7 @@ sock::chat_stream( socketcontainer *p_sock, user *p_user, map<string,string> &ma //*>> int -sock::_make_server_socket( int i_port ) +sock::make_server_socket( int i_port ) { size_t i_sock; struct sockaddr_in name; @@ -121,7 +103,7 @@ sock::_make_server_socket( int i_port ) wrap::system_message( SOCKERR ); - return _make_server_socket( i_port ); + return make_server_socket( i_port ); } // give the server socket a name. @@ -143,200 +125,26 @@ sock::_make_server_socket( int i_port ) wrap::system_message( string(SOCKERR) + tool::int2string(i_port) ); // Rerun recursive. - return _make_server_socket( i_port ); + return make_server_socket( i_port ); } wrap::system_message( SOCKCRT + string("localhost:") + tool::int2string(i_port) ); - i_server_port = i_port; - i_server_sock = i_sock; - - return i_sock; -} - -string -sock::read_http_line(socketcontainer *p_sock) -{ - string s_line; - int i_total = 0; - int i_read = 0; - char ch; - - do - { - i_read = _read(p_sock, &ch, sizeof(ch)); - - if(i_read <= 0) - return ""; - - s_line += ch; - i_total++; - } - while((ch != '\n') && i_total < MAXLENGTH); - - if(ch != '\n') - /* - ** the games people play - */ - return ""; - - return s_line; -} -int -sock::read_http(socketcontainer *p_sock, char *c_zbuf, int i_buflen, int &i_postpayloadoffset) -{ - /* - ** 1) Read the first line - ** 2) If GET, handle as such - ** 3) If POST, handle as such - */ - char ch; - int i_read; - int i_ret = -1; - int x,z; - - string s_content_length; - string s_cl; - string s_post_return; - string s_line = read_http_line(p_sock); - - i_postpayloadoffset = 0; - if(s_line.length() <= 0) - return -1; - - /* - ** GET yada\r\n Followed by stuff we don't care about :) heh. - ** 01234 - */ - /* - ** POST yada\r\n - ** xxxxx - ** Content-Length: NNN\n - ** \n - */ - if(s_line.substr(0,3) == "GET") - { - if(s_line.length() > i_buflen) - { - /* - ** Buffer overflow - */ - return -1; - } - else - { - memcpy(c_zbuf,s_line.c_str(),s_line.length()); - return s_line.length(); - } - } - - else - { - /* - ** POST yada - ** 01234 - */ - if(s_line.substr(0,4) != "POST") - return -1; - - /* - ** Get us to the Content-Length: - */ - s_post_return += s_line; - i_postpayloadoffset += s_line.length(); - - for(x=0 ;x < MAXLINES; x++) - { - s_line = read_http_line(p_sock); - s_post_return += s_line; - i_postpayloadoffset += s_line.length(); - - if (s_line.compare(0, 15, "Content-Length:")) - continue; - - // Match found on Content-Length:... process, and then break out and get us to the promised land - s_content_length = s_line.substr( 16 /*strlen("Content-Length: ")*/, - s_line.length() - 16 /*strlen("Content-Length: ")*/); - - /* - ** Content-Length: 333\n - ** 0123456789abcdefghijklmnopqrstuvwxyzAB - */ - - z = 0; - - do - { - ch = s_content_length[z]; - if(isdigit(ch)) - s_cl += ch; - - z++; - - } - while(ch != '\n'); - - break; - } - - if(s_cl.length() <= 0) - return -1; - - z = atoi(s_cl.c_str()); - - /* - ** If we are going to overflow the buffer just by the payload, leave - ** of, if z did not convert correctly. (should have been ok by isdigit) - */ - if(z > i_buflen || z < 0) - return -1; - - /* - ** We have MAXLINES to get to the blank line separating POST data. - */ - for(x=0 ;x < MAXLINES; x++) - { - s_line = read_http_line(p_sock); - s_post_return += s_line; - - i_postpayloadoffset += s_line.length(); - if(s_line == "\r\n") - break; - } - - /* - ** funny business - */ - if(x == MAXLINES) - return -1; - - for(x=0; x < z; x++) - { - if(_read(p_sock,&ch,sizeof(ch)) != 1) - return -1; - - s_post_return += ch; - } +#ifdef NCURSES - if(s_post_return.length() > i_buflen) - return -1; + mvprintw( NCUR_PORT_X,NCUR_PORT_Y, "Port: %d ", i_port); + refresh(); +#endif - memcpy(c_zbuf,s_post_return.c_str(),s_post_return.length()); - return s_post_return.length(); - } + return i_sock; } int -sock::read_write(socketcontainer* p_sock) +sock::read_write( int* p_sock ) { - int i_postpayloadoffset; - int i_sock = p_sock->i_sock; - + int i_sock = *p_sock; char c_req[READSOCK]; - - memset(c_req,0,sizeof(c_req)); - - int i_bytes = read_http(p_sock, c_req, READSOCK-1,i_postpayloadoffset); + int i_bytes = read(i_sock, c_req, READSOCK); if (i_bytes <= 0) { @@ -352,17 +160,25 @@ sock::read_write(socketcontainer* p_sock) struct sockaddr_in client; size_t size = sizeof(client); - getpeername(i_sock, (struct sockaddr *)&client, &size); +#ifdef CYGWIN + getpeername( i_sock, (struct sockaddr *)&client, (int*)&size); +#else + getpeername( i_sock, (struct sockaddr *)&client, &size); +#endif + uint32_t &s_addr = client.sin_addr.s_addr; - if ( (map_params["REMOTE_ADDR"] = get_elem(s_addr)) == "" ) + if ( (map_params["REMOTE_ADDR"] = get_elem(s_addr)) == "" ) { map_params["REMOTE_ADDR"] = string(inet_ntoa(client.sin_addr)); set_elem(map_params["REMOTE_ADDR"], s_addr); wrap::system_message(SOCKCAC+map_params["REMOTE_ADDR"]); } - string s_rep = req_parser->parse(p_sock, string(c_req), map_params, i_postpayloadoffset); + //map_params["REMOTE_ADDR"] = inet_ntoa_callback(&client.sin_addr); + //map_params["REMOTE_PORT"] = ntohs(client.sin_port); + + string s_rep = req_parser->parse(i_sock, string(c_req), map_params); #ifdef LOGGING @@ -370,31 +186,21 @@ sock::read_write(socketcontainer* p_sock) #endif // send s_rep to the client. - _send(p_sock, s_rep.c_str(), s_rep.size()); + send(i_sock, s_rep.c_str(), s_rep.size(), 0); // dont need those vals anymore. map_params.clear(); - _close(p_sock); + shutdown( i_sock, 2 ); + close ( i_sock ); + return 0; } - _close(p_sock); - return 1; -} - -void -sock::_main_loop_init() -{ - wrap::system_message(SOCKUNS); -} + shutdown( i_sock, 2 ); + close ( i_sock ); -socketcontainer* -sock::_create_container(int &i_sock) -{ - socketcontainer* p_sock = new socketcontainer; - p_sock->i_sock = i_sock; - return p_sock; + return 1; } int @@ -402,22 +208,22 @@ sock::start() { wrap::system_message( SOCKSRV ); pool* p_pool = wrap::POOL; - int i_sock = i_server_sock; #ifdef NCURSES - print_hits(); p_pool->print_pool_size(); #endif int i_port = tool::string2int( wrap::CONF->get_elem( "httpd.serverport" ) ); - _main_loop_init(); - - int i; + int i_sock, i; fd_set active_fd_set, read_fd_set; struct sockaddr_in clientname; size_t size; + + // create the server socket and set it up to accept connections. + i_sock = make_server_socket ( i_port ); + if (listen (i_sock, 1) < 0) { wrap::system_message( LISTERR ); @@ -430,8 +236,6 @@ sock::start() FD_ZERO (&active_fd_set); FD_SET (i_sock, &active_fd_set); - print_server_port(); - while( b_run ) { // block until input arrives on one or more active sockets. @@ -459,23 +263,36 @@ sock::start() int i_new_sock; size = sizeof(clientname); - i_new_sock = accept (i_sock, (struct sockaddr *) &clientname, &size); +#ifdef CYGWIN -#ifdef VERBOSE + i_new_sock = accept (i_sock, (struct sockaddr *) &clientname, (int*)&size); +#else - wrap::system_message(NEWREQU - + tool::int2string(i_req) + " " - + string(inet_ntoa( clientname.sin_addr )) + ":" - + tool::int2string(ntohs ( clientname.sin_port )) - ); + i_new_sock = accept (i_sock, (struct sockaddr *) &clientname, &size); #endif - FD_SET (i_new_sock, &active_fd_set); + if (i_new_sock < 0) + { + wrap::system_message( ACCPERR ); + close(i_new_sock); + } + else + { +#ifdef VERBOSE + wrap::system_message(NEWREQU + + tool::int2string(i_req) + " " + + string(inet_ntoa( clientname.sin_addr )) + ":" + + tool::int2string(ntohs ( clientname.sin_port )) + ); +#endif + FD_SET (i_new_sock, &active_fd_set); + } } else { - socketcontainer *p_sock = _create_container(i); + int *p_sock = new int; + *p_sock = i; p_pool->run( (void*) p_sock ); FD_CLR( i, &active_fd_set ); } @@ -492,19 +309,13 @@ sock::clean_ipcache() if ( i_currentsize > 0 && (i_ipcachesize == 0 || i_ipcachesize <= i_currentsize) ) { wrap::system_message( - SOCKCA2+tool::int2string(i_currentsize)+","+tool::int2string(i_ipcachesize)+")"); + SOCKCA2+tool::int2string(i_currentsize)+","+tool::int2string(i_ipcachesize)+")"); clear(); } } #ifdef NCURSES void -sock::print_server_port() { - mvprintw( NCUR_PORT_X,NCUR_PORT_Y, "Port: %d ", i_server_port); - refresh(); -} - -void sock::print_hits() { if ( wrap::NCUR->is_ready() ) diff --git a/src/sock/sock.h b/src/sock/sock.h index 6e93468..62f32ae 100755 --- a/src/sock/sock.h +++ b/src/sock/sock.h @@ -12,7 +12,6 @@ #include "../reqp.h" #include "../chat/user.h" - #include "../thrd/pool.h" #include "../maps/shashmap.h" @@ -22,22 +21,19 @@ using namespace std; -class sock : public shashmap - < string, uint32_t, self_hash<uint32_t>, equals_allocator<uint32_t> > +class sock : protected shashmap +< string, uint32_t, self_hash<uint32_t>, equals_allocator<uint32_t> > { -protected: +private: #ifdef LOGGING - logd *log_daemon; // the log daemon #endif - int i_server_sock; - int i_server_port; - // total number of server requests. unsigned long long i_req; bool b_run; // true while socket manager is running. reqp *req_parser; // parses the http requests from clients. + char *c_buffer; // char buffer! pthread_mutex_t mut_hits; @@ -45,44 +41,34 @@ protected: public: // creates a server socket. - int read_http(socketcontainer *p_sock, char *c_zbuf, int i_buflen, int &i_payloadoffset); - string read_http_line(socketcontainer *p_sock); + int make_server_socket( int i_port ); // small inline methods: - bool get_server_() const - { - return b_run; - } - // small inline methods: bool get_run() const { return b_run; } + bool set_run( bool b_run ) { this->b_run = b_run; } - sock(); - - int read_write( socketcontainer* p_sock ); + sock( ); + ~sock( ); + int read_write( int* p_sock ); int start(); void clean_ipcache(); // the chat stream there all the chat messages will sent through. - void chat_stream( socketcontainer* p_sock, user* p_user, map<string,string> &map_params ); //<< - virtual inline int _send(socketcontainer *p_sock, const char *sz, int len); - virtual inline int _read(socketcontainer *p_sock, char *sz, int len); - virtual inline int _close(socketcontainer *p_sock); - virtual void _main_loop_init(); - virtual inline socketcontainer* _create_container(int& i_sock); - virtual int _make_server_socket(int i_port); + static void chat_stream( int i_sock, user* p_user, map<string,string> &map_params ); //<< #ifdef NCURSES - void print_server_port(); + void print_hits(); #endif }; + #endif diff --git a/src/stats.cpp b/src/stats.cpp index 7fba04d..4579f69 100644 --- a/src/stats.cpp +++ b/src/stats.cpp @@ -8,128 +8,130 @@ using namespace std; stats::stats() { - i_rusage_vec_size = tool::string2int( - wrap::CONF->get_elem("httpd.stats.rusagehistory")); + i_rusage_vec_size = tool::string2int( + wrap::CONF->get_elem("httpd.stats.rusagehistory")); - i_num_rooms = 0; //<< + i_num_rooms = 0; //<< - pthread_mutex_init( &mut_vec_rusage, NULL ); - pthread_mutex_init( &mut_num_rooms, NULL ); //<< + pthread_mutex_init( &mut_vec_rusage, NULL ); + pthread_mutex_init( &mut_num_rooms, NULL ); //<< } stats::~stats() { - pthread_mutex_destroy( &mut_vec_rusage ); - pthread_mutex_destroy( &mut_num_rooms ); //<< + pthread_mutex_destroy( &mut_vec_rusage ); + pthread_mutex_destroy( &mut_num_rooms ); //<< } void stats::update_rusage_history() { - wrap::system_message(STATUPR); - - rusage* p_rusage = new rusage; - getrusage( RUSAGE_SELF, p_rusage ); - - map<string,long> map_rusage; - - map_rusage["ru_maxrss"] = p_rusage->ru_maxrss; - map_rusage["ru_ixrss"] = p_rusage->ru_ixrss; - map_rusage["ru_idrss"] = p_rusage->ru_idrss; - map_rusage["ru_isrss"] = p_rusage->ru_isrss; - map_rusage["ru_minflt"] = p_rusage->ru_minflt; - map_rusage["ru_majflt"] = p_rusage->ru_majflt; - map_rusage["ru_nswap"] = p_rusage->ru_nswap; - map_rusage["ru_inblock"] = p_rusage->ru_inblock; - map_rusage["ru_oublock"] = p_rusage->ru_oublock; - map_rusage["ru_msgsnd"] = p_rusage->ru_msgsnd; - map_rusage["ru_msgrcv"] = p_rusage->ru_msgrcv; - map_rusage["ru_nsignals"] = p_rusage->ru_nsignals; - map_rusage["ru_nvcsw"] = p_rusage->ru_nvcsw; - map_rusage["ru_nivcsw"] = p_rusage->ru_nivcsw; - - delete p_rusage; - - pthread_mutex_lock ( &mut_vec_rusage ); - - if ( vec_rusage_history.size() >= i_rusage_vec_size ) - vec_rusage_history.erase( vec_rusage_history.begin() ); - - vec_rusage_history.push_back(map_rusage); - - pthread_mutex_unlock( &mut_vec_rusage ); + wrap::system_message(STATUPR); + + rusage* p_rusage = new rusage; + getrusage( RUSAGE_SELF, p_rusage ); + + map<string,long> map_rusage; + + map_rusage["ru_maxrss"] = p_rusage->ru_maxrss; + map_rusage["ru_ixrss"] = p_rusage->ru_ixrss; + map_rusage["ru_idrss"] = p_rusage->ru_idrss; + map_rusage["ru_isrss"] = p_rusage->ru_isrss; + map_rusage["ru_minflt"] = p_rusage->ru_minflt; + map_rusage["ru_majflt"] = p_rusage->ru_majflt; + map_rusage["ru_nswap"] = p_rusage->ru_nswap; + map_rusage["ru_inblock"] = p_rusage->ru_inblock; + map_rusage["ru_oublock"] = p_rusage->ru_oublock; + map_rusage["ru_msgsnd"] = p_rusage->ru_msgsnd; + map_rusage["ru_msgrcv"] = p_rusage->ru_msgrcv; + map_rusage["ru_nsignals"] = p_rusage->ru_nsignals; + map_rusage["ru_nvcsw"] = p_rusage->ru_nvcsw; + map_rusage["ru_nivcsw"] = p_rusage->ru_nivcsw; + + delete p_rusage; + + pthread_mutex_lock ( &mut_vec_rusage ); + + if ( vec_rusage_history.size() >= i_rusage_vec_size ) + vec_rusage_history.erase( vec_rusage_history.begin() ); + + vec_rusage_history.push_back(map_rusage); + + pthread_mutex_unlock( &mut_vec_rusage ); } void stats::set_rusage_vec_size( int i_rusage_vec_size ) { - pthread_mutex_lock ( &mut_vec_rusage ); - this->i_rusage_vec_size = i_rusage_vec_size; - pthread_mutex_unlock( &mut_vec_rusage ); + pthread_mutex_lock ( &mut_vec_rusage ); + this->i_rusage_vec_size = i_rusage_vec_size; + pthread_mutex_unlock( &mut_vec_rusage ); } long stats::get_ru_maxrss() { - rusage* p_rusage = new rusage; - getrusage( RUSAGE_SELF, p_rusage ); + rusage* p_rusage = new rusage; + getrusage( RUSAGE_SELF, p_rusage ); - long l_ret = p_rusage->ru_maxrss; - delete p_rusage; + long l_ret = p_rusage->ru_maxrss; + delete p_rusage; - return l_ret; + return l_ret; } string stats::get_rusage_history( string s_type, string s_seperator ) { - string s_ret; - int i_count = 0; - vector< map<string,long> >::iterator iter; - - pthread_mutex_lock ( &mut_vec_rusage ); - - for ( iter = vec_rusage_history.begin(); - iter != vec_rusage_history.end(); - iter++, i_count++ ) - s_ret.append(s_seperator + - tool::int2string(i_count) + ". " + iter->find(s_type)->first + " " + - tool::int2string( iter->find(s_type)->second) + "\n"); - - pthread_mutex_unlock( &mut_vec_rusage ); - - return s_ret; + string s_ret; + int i_count = 0; + vector< map<string,long> >::iterator iter; + + pthread_mutex_lock ( &mut_vec_rusage ); + + for ( iter = vec_rusage_history.begin(); + iter != vec_rusage_history.end(); + iter++, i_count++ ) + s_ret.append(s_seperator + + tool::int2string(i_count) + ". " + iter->find(s_type)->first + " " + + tool::int2string( iter->find(s_type)->second) + "\n"); + + pthread_mutex_unlock( &mut_vec_rusage ); + + return s_ret; } //<<* -int +int stats::get_num_rooms() { - pthread_mutex_lock ( &mut_num_rooms ); - int i_ret = i_num_rooms; - pthread_mutex_unlock( &mut_num_rooms ); - return i_ret; + pthread_mutex_lock ( &mut_num_rooms ); + int i_ret = i_num_rooms; + pthread_mutex_unlock( &mut_num_rooms ); + return i_ret; } -void +void stats::increment_num_rooms() { - pthread_mutex_lock ( &mut_num_rooms ); - ++i_num_rooms; - pthread_mutex_unlock( &mut_num_rooms ); + pthread_mutex_lock ( &mut_num_rooms ); + ++i_num_rooms; + pthread_mutex_unlock( &mut_num_rooms ); #ifdef NCURSES - print_num_rooms(); + + print_num_rooms(); #endif } -void +void stats::decrement_num_rooms() { - pthread_mutex_lock ( &mut_num_rooms ); - --i_num_rooms; - pthread_mutex_unlock( &mut_num_rooms ); + pthread_mutex_lock ( &mut_num_rooms ); + --i_num_rooms; + pthread_mutex_unlock( &mut_num_rooms ); #ifdef NCURSES - print_num_rooms(); + + print_num_rooms(); #endif } @@ -137,12 +139,13 @@ stats::decrement_num_rooms() void stats::print_num_rooms() { - if ( !wrap::NCUR->is_ready() ) - return; + if ( !wrap::NCUR->is_ready() ) + return; - mvprintw( NCUR_NUM_ROOMS_X, NCUR_NUM_ROOMS_Y, "Rooms: %d", get_num_rooms()); - refresh(); + mvprintw( NCUR_NUM_ROOMS_X, NCUR_NUM_ROOMS_Y, "Rooms: %d", get_num_rooms()); + refresh(); } #endif //*>> + #endif diff --git a/src/stats.h b/src/stats.h index 647f504..4458b6a 100644 --- a/src/stats.h +++ b/src/stats.h @@ -4,30 +4,30 @@ #define STATS_H #include "tool/tool.h" + #include <stdio.h> #include <sys/types.h> #include <sys/time.h> #include <sys/resource.h> -#include <iostream> using namespace std; class stats { private: - // Specifies the max. amount of elements in vec_rusage_history; - int i_rusage_vec_size; - // History of the last i_rusage_vec_size rusage values. - vector< map<string,long> > vec_rusage_history; - pthread_mutex_t mut_vec_rusage; + // Specifies the max. amount of elements in vec_rusage_history; + int i_rusage_vec_size; + // History of the last i_rusage_vec_size rusage values. + vector< map<string,long> > vec_rusage_history; + pthread_mutex_t mut_vec_rusage; + + int i_num_rooms; //<< + pthread_mutex_t mut_num_rooms; //<< - int i_num_rooms; //<< - pthread_mutex_t mut_num_rooms; //<< - - void set_rusage_vec_size( int i_rusage_vec_size ); + void set_rusage_vec_size( int i_rusage_vec_size ); public: - stats( ); + stats( ); ~stats( ); //<<* @@ -40,6 +40,7 @@ public: long get_ru_maxrss(); //<<* #ifdef NCURSES + void print_num_rooms(); #endif //*>> diff --git a/src/thrd/CVS/Entries b/src/thrd/CVS/Entries new file mode 100644 index 0000000..bb6bf86 --- /dev/null +++ b/src/thrd/CVS/Entries @@ -0,0 +1,5 @@ +/pool.cpp/1.17/Fri Feb 25 01:22:35 2005// +/pool.h/1.12/Sun Mar 6 20:44:47 2005// +/thro.cpp/1.7/Sun Mar 6 20:44:47 2005// +/thro.h/1.6/Sun Mar 6 20:44:47 2005// +D diff --git a/src/thrd/CVS/Repository b/src/thrd/CVS/Repository new file mode 100644 index 0000000..058942a --- /dev/null +++ b/src/thrd/CVS/Repository @@ -0,0 +1 @@ +ychat/src/thrd diff --git a/src/thrd/CVS/Root b/src/thrd/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/thrd/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/thrd/pool.cpp b/src/thrd/pool.cpp index dd29d6a..1f4ace6 100755 --- a/src/thrd/pool.cpp +++ b/src/thrd/pool.cpp @@ -14,7 +14,7 @@ pool::pool() i_num_total_threads = 0; i_num_avail_threads = tool::string2int( wrap::CONF->get_elem( "httpd.thread.initpoolsize" ) ); - increase_pool(i_num_avail_threads); + increase_pool(i_num_avail_threads); } pool::~pool() @@ -91,10 +91,10 @@ pool::wait_for_task( void* p_void ) } pthread_mutex_unlock(&p_pool->mut_num_avail_threads); - pthread_mutex_lock(&p_pool->mut_queue_tasks); + pthread_mutex_lock(&p_pool->mut_queue_tasks); task* p_task = p_pool->queue_tasks.front(); p_pool->queue_tasks.pop(); - pthread_mutex_unlock(&p_pool->mut_queue_tasks); + pthread_mutex_unlock(&p_pool->mut_queue_tasks); pthread_mutex_unlock(&p_pool->mut_threads); @@ -118,8 +118,9 @@ pool::run(void* p_void) void pool::run_func(void *p_void) { - socketcontainer* p_sock = static_cast<socketcontainer*>(p_void); + int* p_sock = static_cast<int*>(p_void); wrap::SOCK->read_write(p_sock); + delete p_sock; } bool diff --git a/src/thrd/pool.h b/src/thrd/pool.h index 3a5f7b6..ab03b57 100755 --- a/src/thrd/pool.h +++ b/src/thrd/pool.h @@ -7,7 +7,7 @@ using namespace std; -class pool +class pool { private: friend class thro; @@ -22,7 +22,7 @@ private: this->p_func = p_func; this->p_void = p_void; } - }; + }; pthread_mutex_t mut_threads; pthread_mutex_t mut_queue_tasks; @@ -43,11 +43,10 @@ public: pool(); ~pool(); - void run(void* p_void); + void run(void* p_void); bool allow_user_login(); #ifdef NCURSES - void print_pool_size(); #endif }; diff --git a/src/time/CVS/Entries b/src/time/CVS/Entries new file mode 100644 index 0000000..6a8c339 --- /dev/null +++ b/src/time/CVS/Entries @@ -0,0 +1,5 @@ +/timo.cpp/1.5/Mon Feb 21 01:55:50 2005// +/timo.h/1.4/Mon Feb 21 01:55:50 2005// +/timr.cpp/1.16/Sat Mar 5 11:53:19 2005// +/timr.h/1.5/Mon Feb 21 01:55:50 2005// +D diff --git a/src/time/CVS/Repository b/src/time/CVS/Repository new file mode 100644 index 0000000..0922ad7 --- /dev/null +++ b/src/time/CVS/Repository @@ -0,0 +1 @@ +ychat/src/time diff --git a/src/time/CVS/Root b/src/time/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/time/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/tool/CVS/Entries b/src/tool/CVS/Entries new file mode 100644 index 0000000..0f8f81b --- /dev/null +++ b/src/tool/CVS/Entries @@ -0,0 +1,5 @@ +/dir.cpp/1.6/Mon Feb 21 01:55:50 2005// +/dir.h/1.5/Mon Feb 21 01:55:50 2005// +/tool.cpp/1.9/Mon Feb 21 01:55:50 2005// +/tool.h/1.9/Mon Feb 21 01:55:50 2005// +D diff --git a/src/tool/CVS/Repository b/src/tool/CVS/Repository new file mode 100644 index 0000000..27d92be --- /dev/null +++ b/src/tool/CVS/Repository @@ -0,0 +1 @@ +ychat/src/tool diff --git a/src/tool/CVS/Root b/src/tool/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/src/tool/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/src/wrap.cpp b/src/wrap.cpp index d7e0dba..d737038 100755 --- a/src/wrap.cpp +++ b/src/wrap.cpp @@ -6,42 +6,34 @@ using namespace std; //<<* -chat* wrap::CHAT = NULL; +chat* wrap::CHAT; #ifdef DATABASE -data* wrap::DATA = NULL; +data* wrap::DATA; #endif -gcol* wrap::GCOL = NULL; -sman* wrap::SMAN = NULL; -modl* wrap::MODL = NULL; +gcol* wrap::GCOL; +sman* wrap::SMAN; +modl* wrap::MODL; //*>> -conf* wrap::CONF = NULL; -html* wrap::HTML = NULL; +conf* wrap::CONF; +html* wrap::HTML; #ifdef LOGGING -logd* wrap::LOGD = NULL; +logd* wrap::LOGD; #endif #ifdef NCURSES -ncur* wrap::NCUR = NULL; +ncur* wrap::NCUR; #endif -sock* wrap::SOCK = NULL; -stats* wrap::STAT = NULL; -timr* wrap::TIMR = NULL; -pool* wrap::POOL = NULL; -dynamic_wrap* wrap::WRAP = NULL; +sock* wrap::SOCK; +stats* wrap::STAT; +timr* wrap::TIMR; +pool* wrap::POOL; +dynamic_wrap* wrap::WRAP; void wrap::system_message( string s_message ) { #ifdef NCURSES - if(NCUR) - { - NCUR->print( s_message ); - } - - else - { - cout << s_message << endl; - } + NCUR->print( s_message ); #endif #ifdef SERVMSG @@ -49,20 +41,19 @@ wrap::system_message( string s_message ) #endif #ifdef LOGGING - LOGD->log_simple_line( s_message + "\n" ); #endif } void -wrap::init_wrapper(map<string,string>* p_main_loop_params) +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_main_loop_params ); - delete p_main_loop_params, + WRAP->CONF = CONF = new conf( CONFILE, p_start_params ); + delete p_start_params, // Init the statistic manager. WRAP->STAT = STAT = new stats; @@ -80,17 +71,7 @@ wrap::init_wrapper(map<string,string>* p_main_loop_params) // Init the session manager. WRAP->SMAN = SMAN = new sman; //*>> - // Init the socket manager. - int i_port = tool::string2int( wrap::CONF->get_elem( "httpd.serverport" ) ); - - WRAP->SOCK = SOCK = new sock; - // create the server socket and set it up to accept connections. - if(SOCK->_make_server_socket ( i_port ) <= 0) - { - system_message(SOCKER1); - exit(-1); - } #ifdef NCURSES @@ -98,16 +79,13 @@ wrap::init_wrapper(map<string,string>* p_main_loop_params) NCUR->run(); // run the thread // Wait until ncurses interface has been initialized. - do - { + do { usleep(1000); - } - while ( ! NCUR->is_ready() ); + } while ( ! NCUR->is_ready() ); HTML->print_cached(0); #else #ifdef CLI - cli* p_cli = new cli; p_cli->run(); #endif @@ -116,6 +94,9 @@ wrap::init_wrapper(map<string,string>* p_main_loop_params) // 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; @@ -133,13 +114,12 @@ wrap::init_wrapper(map<string,string>* p_main_loop_params) // Init the data manager. #ifdef DATABASE - WRAP->DATA = DATA = new data; #endif //*>> // Run threads - TIMR->run(); -} + TIMR->run(); +} #endif @@ -2,13 +2,6 @@ #define WRAP_H #include "incl.h" - - -struct socketcontainer -{ - int i_sock; -}; - #ifdef DATABASE #include "data/data.h" #endif @@ -32,16 +25,14 @@ struct socketcontainer #endif #include "chat/sman.h" - #include "sock/sock.h" -#include "monitor/stats.h" +#include "stats.h" #include "time/timr.h" #include "thrd/pool.h" using namespace std; - class dynamic_wrap { public: @@ -89,7 +80,7 @@ public: static void system_message( string s_message ); - static void init_wrapper(map<string,string>* p_main_loop_params); + static void init_wrapper(map<string,string>* p_start_params); //<<* static chat* CHAT; @@ -126,5 +117,4 @@ public: static dynamic_wrap* WRAP; }; - #endif |
