From 5ecef758a2826bd28dd0676940cd12ef6792126f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Apr 2013 13:14:49 +0200 Subject: tagging ychat-0.4 --- COPYING | 0 CVS/Entries | 78 ++- CVS/Entries.Log | 9 +- CVS/Root | 2 +- README | 592 ++++--------------- base.cpp | 54 +- base.h | 88 +-- chat.cpp | 181 +++--- chat.h | 34 +- cmnd.cpp | 6 +- cmnd.h | 8 +- cmnd/CVS/Entries | 2 + cmnd/CVS/Root | 2 +- cmnd/yc_q.cpp | 17 +- cmnd/yc_test.cpp | 13 +- conf.cpp | 71 ++- conf.h | 8 +- conf.txt | 25 +- configure | 1618 +++++++++++++++++++++++++++++++++++++++++++++++++--- cont.cpp | 8 +- cont.h | 19 +- gfx/CVS/Root | 2 +- glob.h | 33 +- hmap.cpp | 159 +++--- hmap.h | 175 +++--- html.cpp | 175 +++--- html.h | 40 +- html/CVS/Entries | 29 +- html/CVS/Root | 2 +- html/frameset.html | 12 +- html/index.html | 46 +- html/input.html | 52 +- html/notfound.html | 4 +- html/online.html | 21 +- html/stream.html | 42 +- html/style.css | 45 +- incl.h | 4 +- lang.cpp | 75 ++- lang.h | 8 +- lang/CVS/Root | 2 +- logd.cpp | 65 ++- logd.h | 25 +- main.cpp | 71 ++- modl.cpp | 104 ++-- modl.h | 16 +- msgs.h | 9 +- mutx.cpp | 6 +- mutx.h | 12 +- name.cpp | 9 +- name.h | 22 +- pool.cpp | 294 +++++----- pool.h | 89 +-- reqp.cpp | 405 ++++++------- reqp.h | 52 +- room.cpp | 6 +- room.h | 28 +- s_chat.h | 21 +- s_conf.h | 21 +- s_html.h | 21 +- s_lang.h | 22 +- s_modl.h | 21 +- s_mutx.h | 21 +- s_sman.h | 21 +- s_sock.h | 21 +- s_tool.cpp | 159 +++--- s_tool.h | 15 +- sess.cpp | 30 +- sess.h | 20 +- sman.cpp | 43 +- sman.h | 30 +- sock.cpp | 304 +++++----- sock.h | 46 +- thrd.cpp | 5 +- thrd.h | 19 +- user.cpp | 175 +++--- user.h | 151 +++-- 76 files changed, 3557 insertions(+), 2583 deletions(-) mode change 100755 => 100644 COPYING mode change 100644 => 100755 base.h mode change 100644 => 100755 chat.cpp mode change 100644 => 100755 chat.h mode change 100644 => 100755 cmnd.cpp mode change 100644 => 100755 cmnd.h mode change 100644 => 100755 conf.cpp mode change 100644 => 100755 conf.h mode change 100644 => 100755 cont.cpp mode change 100644 => 100755 cont.h mode change 100644 => 100755 glob.h mode change 100644 => 100755 html.cpp mode change 100644 => 100755 html.h mode change 100755 => 100644 html/style.css mode change 100644 => 100755 incl.h mode change 100644 => 100755 lang.cpp mode change 100644 => 100755 lang.h mode change 100644 => 100755 main.cpp mode change 100644 => 100755 modl.cpp mode change 100644 => 100755 modl.h mode change 100644 => 100755 msgs.h mode change 100644 => 100755 mutx.cpp mode change 100644 => 100755 mutx.h mode change 100644 => 100755 name.cpp mode change 100644 => 100755 name.h mode change 100644 => 100755 pool.cpp mode change 100644 => 100755 pool.h mode change 100644 => 100755 reqp.cpp mode change 100644 => 100755 reqp.h mode change 100644 => 100755 room.cpp mode change 100644 => 100755 room.h mode change 100644 => 100755 sock.cpp mode change 100644 => 100755 sock.h mode change 100644 => 100755 thrd.cpp mode change 100644 => 100755 thrd.h mode change 100644 => 100755 user.cpp mode change 100644 => 100755 user.h diff --git a/COPYING b/COPYING old mode 100755 new mode 100644 diff --git a/CVS/Entries b/CVS/Entries index 6e0ccd2..ba61f67 100644 --- a/CVS/Entries +++ b/CVS/Entries @@ -1,10 +1,70 @@ -/CHANGES/1.32/Sat Mar 5 11:35:09 2005// -/COPYING/1.6/Sun Jun 27 06:32:26 2004// -/INSTALL/1.7/Fri Jul 9 22:33:20 2004// -/Makefile/1.34/Sun Feb 27 06:28:53 2005// -/NEWS/1.42/Sat Mar 5 11:36:48 2005// -/README/1.115/Sat Mar 5 11:35:09 2005// -/RELEASES/1.13/Sat Mar 5 11:35:09 2005// -/TODO/1.75/Sat Mar 5 00:15:23 2005// -/configure/1.34/Fri Mar 4 21:00:44 2005// +/COPYING/1.1/Fri Mar 28 00:27:16 2003// +/Makefile.in/1.7/Sat Apr 19 16:16:14 2003// +/README/1.2/Wed Apr 2 10:50:18 2003// +/base.cpp/1.8/Wed Apr 2 10:50:18 2003// +/base.h/1.5/Wed Apr 2 10:50:18 2003// +/chat.cpp/1.12/Sat Apr 19 19:39:17 2003// +/chat.h/1.8/Sat Apr 19 16:16:14 2003// +/cmnd.cpp/1.3/Tue Mar 25 14:54:07 2003// +/cmnd.h/1.1.1.1/Fri Mar 21 15:54:56 2003// +/conf.cpp/1.5/Fri Apr 4 21:35:59 2003// +/conf.h/1.2/Tue Mar 25 14:54:07 2003// +/conf.txt/1.18/Sat Apr 19 16:16:14 2003// +/configure/1.4/Fri Mar 28 02:02:00 2003// +/configure.in/1.5/Fri Mar 28 02:02:00 2003// +/cont.cpp/1.3/Tue Mar 25 14:54:07 2003// +/cont.h/1.2/Sun Mar 30 00:26:42 2003// +/glob.h/1.5/Fri Apr 4 21:35:59 2003// +/hmap.cpp/1.8/Mon Apr 7 13:24:09 2003// +/hmap.h/1.8/Wed Apr 2 10:50:18 2003// +/html.cpp/1.7/Wed Apr 2 10:50:18 2003// +/html.h/1.3/Tue Mar 25 14:54:07 2003// +/incl.h/1.1.1.1/Fri Mar 21 15:54:56 2003// +/lang.cpp/1.1/Fri Apr 4 22:14:35 2003// +/lang.h/1.1/Fri Apr 4 22:14:35 2003// +/logd.cpp/1.2/Thu Apr 10 15:36:10 2003// +/logd.h/1.1/Fri Apr 4 15:19:11 2003// +/main.cpp/1.11/Sat Apr 19 16:16:14 2003// +/modl.cpp/1.2/Wed Apr 2 21:57:34 2003// +/modl.h/1.1/Wed Apr 2 13:23:09 2003// +/msgs.h/1.10/Mon Apr 7 13:18:23 2003// +/mutx.cpp/1.3/Tue Mar 25 14:54:07 2003// +/mutx.h/1.2/Tue Mar 25 14:54:08 2003// +/name.cpp/1.3/Tue Mar 25 22:19:51 2003// +/name.h/1.3/Tue Mar 25 22:21:26 2003// +/pool.cpp/1.6/Tue Mar 25 14:54:08 2003// +/pool.h/1.1/Sun Mar 23 04:55:58 2003// +/reqp.cpp/1.15/Sat Apr 19 19:39:17 2003// +/reqp.h/1.10/Fri Apr 4 15:19:11 2003// +/room.cpp/1.2/Sun Mar 23 05:41:19 2003// +/room.h/1.2/Fri Mar 28 02:51:03 2003// +/s_chat.cpp/1.1/Tue Mar 25 14:54:08 2003// +/s_chat.h/1.1/Tue Mar 25 14:54:08 2003// +/s_conf.cpp/1.1/Tue Mar 25 14:54:08 2003// +/s_conf.h/1.2/Fri Apr 4 21:35:59 2003// +/s_html.cpp/1.1/Tue Mar 25 14:54:08 2003// +/s_html.h/1.1/Tue Mar 25 14:54:08 2003// +/s_lang.cpp/1.1/Fri Apr 4 22:14:35 2003// +/s_lang.h/1.1/Fri Apr 4 22:14:35 2003// +/s_modl.cpp/1.1/Wed Apr 2 23:01:20 2003// +/s_modl.h/1.1/Wed Apr 2 23:01:20 2003// +/s_mutx.cpp/1.1/Tue Mar 25 14:54:08 2003// +/s_mutx.h/1.1/Tue Mar 25 14:54:08 2003// +/s_sman.cpp/1.1/Sat Apr 19 16:16:15 2003// +/s_sman.h/1.1/Sat Apr 19 16:17:09 2003// +/s_sock.cpp/1.1/Tue Mar 25 14:54:08 2003// +/s_sock.h/1.1/Tue Mar 25 14:54:08 2003// +/s_tool.cpp/1.4/Fri Apr 4 10:41:12 2003// +/s_tool.h/1.4/Fri Apr 4 10:41:12 2003// +/sess.cpp/1.2/Sat Apr 19 19:39:17 2003// +/sess.h/1.2/Sat Apr 19 19:39:17 2003// +/sman.cpp/1.1/Sat Apr 19 16:16:15 2003// +/sman.h/1.2/Sat Apr 19 19:39:17 2003// +/sock.cpp/1.16/Sat Apr 19 19:39:17 2003// +/sock.h/1.6/Fri Apr 4 15:19:11 2003// +/thrd.cpp/1.5/Wed Mar 26 14:57:04 2003// +/thrd.h/1.1.1.1/Fri Mar 21 15:54:56 2003// +/todo.txt/1.4/Sun Mar 30 01:48:46 2003// +/user.cpp/1.7/Fri Apr 4 22:14:35 2003// +/user.h/1.8/Sat Apr 19 19:39:17 2003// D diff --git a/CVS/Entries.Log b/CVS/Entries.Log index ebf29e1..89d073a 100644 --- a/CVS/Entries.Log +++ b/CVS/Entries.Log @@ -1,7 +1,4 @@ -A D/bin//// -A D/docs//// -A D/etc//// +A D/cmnd//// +A D/gfx//// A D/html//// -A D/log//// -A D/scripts//// -A D/src//// +A D/lang//// diff --git a/CVS/Root b/CVS/Root index 745de68..2818c02 100644 --- a/CVS/Root +++ b/CVS/Root @@ -1 +1 @@ -:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot +:pserver:rover@cvs.ychat.berlios.de:/cvsroot/ychat diff --git a/README b/README index 3775f8b..fd72da4 100755 --- a/README +++ b/README @@ -1,8 +1,7 @@ -yChat; Homepage: www.yChat.org; Version 0.7.9.2-PRERELEASE - +yChat++; Homepage: www.yChat.org; Version CVS Copyright (C) 2003 Paul C. Buetow, Volker Richter -Copyright (C) 2004, 2005 Paul C. Buetow ----------------------------------------------------------------- + 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 @@ -16,522 +15,165 @@ 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. ------------------------------------------------------------------ - -YCHAT TABLE OF CONTENTS: - -0.0.0 ABOUT RELEASES -0.0.1 YCHAT FEATURES //<< -1.0.0 REQUIREMENTS -1.1.0 TESTED PLATFORMS -1.2.0 IMPORTANT NOTICES -1.3.0 HOW TO OBTAIN YCHAT -1.3.1 INSTALLATION -1.3.2 INSTALLATION QUICK-START -1.3.3 MYSQL SETUP //<< -1.4.0 HOW TO USE SCREEN WITH YCHAT -1.4.1 HOW TO USE SIGNALS WITH YCHAT -1.5.0 CUSTOMIZATION -1.6.0 FILES -1.7.0 WRITING BUG REPORTS -1.8.0 CONTACT -1.9.0 YHTTPD CODE BASE GENERATION //<< - -0.0.0 ABOUT RELEASES - -There are several projects involved: - -- The chat - -Its a HTTP based chat server written in C++. Clients are normal web browsers -such as MSIE or Gecko based browsers using only CSS, HTML and JavaScript. - -- The httpd - -Its a small http server based on the chat's socket and threading engine. -yhttpd does not have as much features but is easy to use and faster than -apache. yhttpd is a subset of the chat. It can be generated using the -srcipts/yhttpdbase.pl script in the chat's source tree. - -- The ycurses - -ycurses is a easy to use and small C++ wrapper of the C ncurses API. - -There are different branches: - -- CURRENT - -The CURRENT branch is unstable, this is the bleeding developing edge with -all the new experimental features. - -A RELEASE of CURRENT can be referred as CURRENTRELEASE. - -- STABLE - -The STABLE branch is more stable than CURRENT. This branch may get new -features as well. But those will be more conservative compared to -CURRENT. - -A RELEASE of STABLE can be referred as STABLERELEASE. - -- LEGACY - -The LEGACY branch has no real support. This branch may get bugfixes and -updates and might get minor improvements. But there is no garuantee to -be bug free and stable at all. LEGACY versions are of historic meaning. - -- DEVEL - -DEVEL is only a meta name. If a version is labeled with DEVEL, then its -currently undefined if this is a CURRENT, STABLE or LEGACY branch. It -can be everything. Commonly DEVEL versions are CURRENT. - -There are also releases made: - -- RELEASE - -There can be RELEASEs made out of each branch. While a branch can get -new features, a RELEASE can not. A RELEASE of a branch is just like -a snapshot. RELEASEs are complete versions to test and use. But keep -in mind, that a RELEASE of the STABLE branch is recommended over a -RELEASE of a CURRENT or a LEGACY branch in a production environment. -RELEASEs of CURRENT are still the bleeding edge and RELEASEs of LEGACY -may be out of date. - -//<<* -0.0.1 YCHAT FEATURES - -- Its free & portable - -yChat is developed under the GNU general public license and is based on GNU -tools (gcc, gmake), other open source library stuff (such as libncurses etc.) -and should run on any POSIX capable operating system (such as all Linux based -systems, FreeBSD, NetBSD, OpenBSD and other BSD-Systems and on UNICES like -IRIX, HP-UX, Solaris etc.). - -- There is no need for special chat clients - -yChat is web based, that means clients may only connect to the chat server -with an normal web browser such as Microsoft Internet Explorer or any Gecko- -Engine powerd browsers like Mozilla, Firefox, Camino etc. - -- It has features of a real HTTP webserver - -yChat runs completely stand alone and does not need another webserver to build -on like Apache and does not need to be run via any kind of CGI. yChat creates -its own socket on a customized port (standard port: 2000) and seems to be a full -featured HTTP web server to the clients (web browsers). - -The yChat code base can be converted to an yhttpd code base automaticaly. yhttpd -is the webserver subset of yChat which runs completely stand alone and provides -normal websites to the net. It also supports Common Gateway Interface (CGI) -scripting. - -- Its fast and secure - -yChat is written in C++ which is faster than any Java based Chat-Server or any -server written in a scripting language like PHP, Python or Perl. As the -internal data structures hash maps are used to garuantee searching certain -values in O(1) amount of time. If a hash maps gets full, it will be rehashed. -Currently, yChat has been measured providing over 1000 hits/requests per second -on a FreeBSD based server box while using less than 2% of CPU usage -on a Athlon XP 1900+. Performance seems to be limited by your bandwith only. -Also, each user gets its own session id (random string) with a standard length -of 50 chars to authenticate each logged in user. The length of the session id -can be redefined as well. Also, the session id will get md5-hashed optionally -so thats even harder to reverse engineering the session ids of other users. - -- Its HTML template based and easy to customize via XML based configuration - -All HTML sites are predefined as HTML-Template files and can be easily modified -to use with an customized web design. Also, a lot of yChat preferences can be -set in the main configuration file (ychat.conf). ychat.conf is completely written -in XML 1.0 which makes it easier to use the configuration options in programs of -3rd persons which may want to write some usefull tools for yChat. -yChat caches all HTML and web images to improve overall performance. If needed, the -cache can be cleared to recache new versions of the template files. - -- Its language template based - -The administrator can easily create a new language in which all system messages -appear to the Chat-User. The predefined languages is english but others can be -added easily. The language can be edited in the XML based configuration file. - -- MySQL based database - -Registered users are stored in a MySQL database. C++ Programmers may feel free -to replace the database wrapper class (data.h) with another database routines -to use other databases such as PostgreSQL, SQLite or a text based database etc. -If wished, you can disable database support in the pre-compile options. - -- It has an administration interface - -yChat includes an ncurses based administration interface which tracks some -interesting statistics and system messages and enables you to do certain -administrative tasks. In addition, you can switch to the CLI (command line -interface) mode of the administration interface in order to be provided with -more available functions (like keeping track of the current system usage etc.). -If you dont like ncurses and/or the CLI you can disable both options in the pre- -compile options. - -- It has logging capabilities - -The logging manager keeps track to all yChat system messages (such as users -wich log in and out, modules which are loaded, MySQL queries etc.). Also, an -Apache-Style combined log file format is created by yChat (you can parse this -logfile with any Apache logfile parser like awstats etc.). And last but not -least, all public messages of all available rooms will be logged to disk as -well . To improve performance, you can define the logging puffer (standardly -new logs will be written to disk after each 20 lines). If you want to log -everything immediately, you can reset this option to 1 in ychat.conf. - -- Its modular through own command and dynamic HTML engine - -All chat commands are realized through dynamic loadable module files which can -be recompiled and reloaded without restarting the whole yChat server. Also -HTML-Sites with certain tasks can be compiled as a module like -mods/html/yc_register.so, mods/html/yc_options.so and mods/html/yc_colors.so -etc. so you can also program your dynamic yChat websites in C++. - -- Its multi threaded (POSIX threads) - -There is only one main process which spawns several threads, each for its own -unique task. For example one thread is used to handle the socket manager which -waits for incoming TCP/IP requests, another thread schedules the system timer -which proves if clients are still active or frees not needed memory in certain -time intervals (see also "Garbage collector"). Also, each Chat-User gets it own -thread. There is no need of memory wastage by creating for each task a new -process. All User-Threads are managed by a thread pool to avoid CPU wastage -creating every time a new thread by reusing thread objects which have done its -jobs already and have been readded into the queue of the thread pool. The -standard sizes of the queue and the total pool size can be set in ychat.conf. - -- Its using a smart garbage collection engine - -All users and rooms which dont have to be kept in the main memory (because the -user has logged out or the room has been destroyed because it was empty) will -not be deleted immediately but be placed for about 10 minutes in the yChat -garbage collector. Each time a new room is created the systems checks the -garbage to reuse an inactive room object. If a certain user wants to log in, the -system checks if he is already present in the garbage collector. If yes, he will -be reactivated without wasting expensive database queries to fetch the user's -options. This improves overall performance on heavily loaded yChat servers if a -lot of user and room objects are created and destroyed frequently. -//*>> - -1.0.0 REQUIREMENTS: - -- GNU GCC G++ - The GNU C++ compiler version 3.1 or up. - -- GNU make 3.80 (gmake) or higher - If you dont have a gmake executable but make is gnu make then you need - to add a symlink or alias from gmake to make. - yChat Makefiles only have been tested with GNU make and may not work with - other make versions. - -- SGI STL extension - Includes ext/hash_map which may be already default on every Linux distro. - On *BSD you have to install it first before compiling. On FreeBSD - /usr/ports/devel/stlport is your friend. - -//<<* -- mysql-client 4.x (3.x may do too but is not supported) - Includes libmysqlclient and the mysql.h header files. - -//*>> -- ncurses 5.x - Includes libncurses and the ncurses.h header files. - -- Screen - Only needed if yChat should run in background with - ncurses or CLI enabled. - -- Perl 5.x - Is needed for some scripts. Is not needed if you use precompiled binaries. - -1.1.0 TESTED PLATFORMS: - -The following platforms have been tested with success. If you find out that -a listed platform did not work at all please contact me: - - Operating system (arch) GNU G++ GNU make -- FreeBSD 5.3-RELEASE (i386) 3.4.2 3.80 - - Tested longer time before: -- FreeBSD 5.2.1-RELEASE (i386) 3.3.3 3.80 -- FreeBSD 4.10-RELEASE (i386) 3.4.1 3.80 -- FreeBSD 4.9-RELEASE (i386) 3.3.4 3.80 -- Gentoo Linux 2004 (i386) 3.3.2 3.80 -- OpenBSD 3.6 SMP (i386) 3.3.2 3.80 -- Red Hat Linux 8.0 SMP (i386) 3.2-7 3.79 -- Slackware Linux 10.0 (i386) 3.4.0 3.80 -- SUSE Linux 9.0 (i386) 3.3.1 3.80 -- SUSE Linux 8.1 (i386) 3.2 3.79.1 - -Other platforms like Linux based systems, other BSD-Systems or UNICES -are very likely to work too. - -1.2.0 IMPORTANT NOTICES: - -Before you compile the source you have to be sure to use at least GCC -version 3.1 with pthreads enabled. ( Type gcc -v to check it ). -GCC 2.95 and 3.0 did not work while testing and WON'T BE SUPPORTED! -If you like to support yChat, please write us an email and tell what -you can/like/would help ;-]. Please also take a look at the yChat -homepage which is located at http://www.yChat.org. - -1.3.0 HOW TO OBTAIN YCHAT: - -yChat can be downloaded as a source package or through CVS. - -The packages are located at http://www.yChat.org -> Sourcecode -> -Packages or go to http://pub.buetow.org/yChat/CPP-yChat . - -For CVS download type: -cvs -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot login -( You will be asked for a password. Use "just enter" ). - -vs -z3 -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot co BRANCH -( The sources will be copied into your local folder ) - -cvs -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot logout -( Logs your CVS session out ). - -Now you may continue with the installation. - -here are different branches in the CVS: - -ychat: This is the latest CURRENT branch of yChat. -ychat-stable: This is the latest STABLE branch of yChat. -ychat-X.Y: This is the branch with the specified version prefix. -yhttpd: This is the latest CURRENT snapshot of yhttpd. - -The CURRENT branch of ychat is mostly untested and unstable, so don't -cry if you get errors. - -1.3.1 INSTALLATION: - -Invoke "./configure". Afterwards you will get prompted with the before-compile -options of yChat. After choosing those options you are ready to type "gmake" -afterwards. See below what gmake is doing. +----------------------------------------------------------------- -//<<* -If you have choosen MySQL database support, then take a look at section 1.3.2 -how to setup a valid database table. Be also sure to enter the valid MySQL -accessing data in the yChat configuration file which is normally located in -the etc/ychat.conf file if not changed by you with the yChat configurator. -//*>> +Notes: I programmed this on FreeBSD but should also compile without +big problems on Linux or other UNIX-like systems. +If you have tested one of those then pleace write me the name of the OS, +kernel version, make version and compiler & version. I will list it +right here: -You may also invoke gmake with the following options (the PREFIX can be set -in the yChat configurator which will be launched by the top configure script -or gmake config): +The following platforms have been tested with success: - gmake or gmake all (compiles everything, also modules and runs "gmake mail") - gmake base (only compiles the base) - gmake base_start (only compiles the base and starts the server) - gmake clean (cleans everything) - gmake clean_base (only cleans the base obj and rpo files) - gmake clean_modules (only cleans the modules .so files) - gmake confdebug (runs ./configure with enabling debugging) - gmake config (runs yChat configurator) - gmake debug (runs gdb on ./ychat.core) - gmake dist (creates a .tar.bz2 ball) - gmake gpl (shows the GNU General Public License) - gmake help (shows all available ychat gmake targets) - gmake mail (sends a mail to the yChat developers containing build opts.) - gmake modules (only compiles modules) - gmake mrproper (same as gmake clean plus removing all temp files) - gmake setup (runs all configure scripts and afterwards gmake all) - gmake stats (generates ychat statistics) - gmake version (shows the current version of yChat) -//<<* - gmake yhttpdbase (generates an yhttpd code base) -//*>> (See section 1.9 to read about this marks) +- FreeBSD 5.0-RELEASE, GCC 3.2.1, FreeBSD 5.0 make and GNU make 3.80 -Example: "gmake all install clean" compiles everything, installs it to PREFIX -and cleans the source directories. +- Linux Kernel 2.4.19, GCC 3.2.0, GNU make 3.79.1 -Now its time to run the server with ./bin/ychat. +Before you compile the source you have to be sure to use at least GCC +version 3.x with pthreads enabled. ( Type gcc -v to check it ). +GCC 2.95 did not work while testing on linux and won't be supported! -Aferwards point your webbrowser to http://yourip:port ! +If you like to support yChat++, please write me an email and tell me +what you can/like/would help ;-]. Please also take a look at the +yChat++ homepage ( www.yChat.org ). +Installation: Just invoke "./configure" and afterwards "make", edit the +conf.txt and run the server with ./ychat. Then point your webbrowser +to http://yourip:port/index.html +( ignoring the index.html on the end of the url will not work! ). ... have fun :-). -1.3.2 INSTALLATION QUICK START: - -If you in hury, then you may just type gmake setup. In the yChat configurator -you may just choose all the default values. If done, yChat will get compiled -and is ready to run with ./bin/ychat! - - -//<<* -1.3.3 MYSQL SETUP - -If you chose to use MySQL database support you have to create a valid database -to use with yChat. - -Create a new MySQL database called 'ychat' and type the following command into -a MySQL command line client of your choice: - -USE ychat -CREATE TABLE `user` ( - `uid` int(10) NOT NULL auto_increment, - `nick` varchar(30) NOT NULL default '', - `password` varchar(30) NOT NULL default '', - `color1` varchar(30), - `color2` varchar(30), - `email` varchar(50) default '-', - `registerdate` varchar(30) default '-', - `logincounter` varchar(10) default '0', - `status` char(1) default '3', - PRIMARY KEY (`uid`), - KEY `uid` (`uid`) -) TYPE=MyISAM; -GRANT ALL PRIVILEGES ON ychat.* to ychat@localhost IDENTIFIED BY "yctest"; - -This database uses the default MySQL access informations which are stored in the -ychat.conf file. -//*>> - -1.4.0 HOW TO USE SCREEN WITH YCHAT: - -If you are running yChat in ncurses mode you might want to install -the tool which is called "screen". This will enable you putting the -ncurses interface into the background, closing the terminal session -and reusing the interface later through another terminal. - -Just do: - - screen -S ychat ./bin/ychat ( creates a new session and starts yChat in it ) - ctrl+d+a ( will detach the yChat session ) - ( closing the terminal ) - ( opening a new terminal ) - screen -r ychat ( will return you to the yChat process ) - -Screen will terminate automaticaly if all processes in its sessions are -terminated. - -For a closer look read the screen manual page ( man screen ). - -1.4.1 HOW TO USE SIGNALS WITH YCHAT: - -You can send UNIX signals to yChat. This becomes very interesting if you -don't use the command line interface or the ncurses interface and you -don't have access to the options below. - -Run one of the following commands to send the signal you want: -($PID is here the process id of the current yChat process) - -kill -USR1 $PID # yChat clears the HTML template cache -kill -USR2 $PID # yChat reloads all dynamic loadable modules //<< -kill -HUP $PID # yChat will shutdown savely - -1.5.0 CUSTOMIZATION: +If you like customizing the design/layout/language of yChat, you will have +to edit msgs.h and glob.h before you compile the sources. Afterwards you can +change the html-template files which are placed in the html/ subdirectory. -If you like to customize the design/layout/language of yChat, you will have -to edit src/msgs.h and src/glob.h before you compile the sources. Afterwards -you can change the html-template files which are placed in the html/ -subdirectory and the language-templates which are placed in the XML config -file (etc/ychat.conf). +Files: -Notice, that you dont have to edit the src/glob.h file by hand any more, its -already done by the top ./configure script for you. +conf.txt - The yChat configuration file. ( read by conf.cpp ). -You can edit the etc/ychat.conf to fit your needs. If you dont want to change -the config file, then you also can use ychat start parameters. +base.cpp - Encapsulates vector fields of room's or user ( may be later + hash_maps ) and provides methods for manipulating data + objects. -Exmpl: ./bin/ychat -o chat.database.password secretpassword +hmap.cpp - The hash map implementation which is a very fast data + structure. is needed for saving users, rooms and so on. -You can also use multiple words for a specific option. +main.cpp - This includes the required manager headers for starting + the server and finally regulates the correct starting. -Exmpl: ./bin/ychat -o ychat.version "word1 word2 word3" +modl.cpp - The module loader. Stores pointers of all dynamic loaded + yChat modules in a hash map object and loads new modules + if desired or returns their pointers. -will overwrite the default database password value of the ychat.conf. You can -do this with every configuration element by adding several -o option value -arguments to the start command. +pool.cpp - The implementation of the thread pool. all threads are stored + in a queue. Each thread will be reused if the assigned job is + finished. -Dynamic loadable modules can be found in the mods/ subdirectory. (chat -commands are realized through modules too). Sources of modules can be found -in src/mods instead. If you want to create a new module just create a new -.cpp file and run in src/mods the ./configure script again. Next time -you run gmake your new module gets compiled. +reqp.cpp - This class implements the http request parser. If a client + starts a request to the server the reqp class will be + invoked. -All messages defined in the msgs.h file contain server messages only ( a chat -user never wont read them, only the administrator will get to see them ). +room.cpp - Specifies a chat room. For each chat room an instance of + this class exists. -1.6.0 FILES: +thrd.cpp - This class is needed by sock.cpp while creating a POSIX thread. + All data which a thread needs to do its tasks are stored in a + thrd object and then a pointer to it will be passed to the + POSIX thread function. -etc/ychat.conf - The yChat configuration file -html/* - The html template files -src/* - The yChat base sources -src/mods/* - The dynamic loadable modules sources -scripts/* - Some nice scripts needed for building & co. +user.cpp - Specifies a chat user. For each chat user an instance of + this class exists. -The following is created by building yChat: -obj/* - The object files of the compiled yChat base -mods/* - The compiled dynamic loadable modules -bin/ychat - The yChat binary (linked by the object files) +Abstract classes: -Customizable source files (if changed you need to run gmake clean all) -src/glob.h - Contains some global building options -src/msgs.h - Defines some server side messages +cont.cpp - All classes which need to store "key - value" data sets + inherit from this class. ( cont for content ). +name.cpp - All classes which own a private member string name inherit + from this class. It also provides public get_name and + set_name methods. -1.7 WRITING BUG REPORTS +As described ( main.cpp ), there are so called managers. Managers are +accessible through their assigned wrapper classes and may be +instanciated only once. -How to submit a good bug report? +chat.cpp - The chat manager. Is responsible for managing the internal + data structure of the system and also covers a lot of + important methods of the system. -Send them to Bug@yChat.org. +conf.cpp - The config manager. Parses the config file specified in + glob.h and stores all the values of it in a map. -First you should give the following information: -- yChat version, if CVS (or devel. tarball) then which day? -- operating system / distribution and it's version -- when did it crash? did you do something? can you reproduce the crash? +html.cpp - The html-template manager. Reads the requested html-template + files, stores them in an internal cache ( averts reading + template-files from hd twice or more ) and parses the + partivular template in order to substituate dynamic values + of it. -Getting backtrace of the crash also helps a lot, especially if yChat crashes -randomly. If after crash you see text: +mutx.cpp - The mutex manager. Contains all global mutex handlers for + synchronizing POSIX thread shared data. until now only the + stdout is synchronized by mutx.cpp because most of objects + use their own mutex'. - "segmentation fault (core dumped)" +sock.cpp - The socket manager. Manages the socket connections. There + are multiplexed sockets. For each requests a new POSIX thread + will be created. -It writes a file named "core" or "ychat.core" depending on your OS to directory -where you started yChat. If it doesn't print the "(core dumped)" or you can't -find the core file, you'll have to raise the limit for max. core file size -before running yChat. To do this, say: +Files written in capital letters contain static C++ classes - ulimit -c unlimited +s_chat.cpp - Static wrapper for the dynamic chat class. holds one global + reachable instance of chat until the program shuts down. -So, if you have the core file and GNU debugger (gdb), you can get the -backtrace with: +s_conf.cpp - Static wrapper for the dynamic conf class. holds one global + reachable instance of conf until the program shuts down. - gdb ./bin/ychat ychat.core - bt +s_html.cpp - Static wrapper for the dynamic html class. holds one global + reachable instance of conf until the program shuts down. -Paste all the lines starting from line having #0 at the beginning. +s_mutx.cpp - Static wrapper for the dynamic mutx class. holds one global + reachable instance of conf until the program shuts down. -Here's an example session: +s_sock.cpp - Static wrapper for the dynamic sock class. holds one global + reachable instance of conf until the program shuts down. - in reqp::parse(thrd*, std::string, std::map, std::allocator > >&) () - (gdb) bt - #0 0x0805c287 in reqp::parse(thrd*, std::string, std::map, std::allocator > >&) () - #1 0x0806060f in sock::read_write(thrd*, int) () - #2 0x080612ba in thrd::run() () - #3 0x0805a3b8 in pool::run_func(void*) () - #4 0x0805a375 in pool::tpool_thread(void*) () - #5 0x281d44ae in _thread_start () from /usr/lib/libc_r.so.5 - (gdb) +s_tool.cpp - Static class which includes some usefull global reachable + methods which are not integraded in independent classes. -If you dont get such a gdb output, you need to recompile the yChat using -debuggig symbols. You can do it this way: +Special header files ( all other header files which are not listed here +belong to their respective .cpp files ): -cd ychat -gmake confdebug all run +glob.h - Defines global variables which are known by compilation + time. -1.8 CONTACT: +incl.h - This file is included from every other header file and + includes a set of headers which every class should be able + to use. -You may contact us through the following addresses: +msgs.h - Defines console output messages for verbosity level 0 ( see + glob.h for setting up verbosity levels ). and also defines + all the system messages. you may edit this file for translating + the system user language. -- Homepage - The yChat homepage is located at http://www.yChat.org -- E-Mail - Paul C. Buetow: Snooper at yChat point org ( core developer ) - Volker Richter: Rover at yChat dot org ( core developer ) - Mail at yChat dot org ( reaches everybody of yChat ) - -- ICQ - Paul C. Buetow: 11655527 +The basic class structure: -- IRC - #Ychat and #Coding at irc.german-elite.net + base base + | | name + | | / \ + | | / \ + chat room user -//<<* -1.9.0 YHTTPD CODE BASE GENERATION + cont + / \ + / \ +conf html -See docs/yhttpd.txt -//*>> +Version Lines of code + 0.1 2402 + 0.2 2377 +New in 0.2: + - POST request now work. + - Thread pool ( pool.cpp ). + - Bugfixes diff --git a/base.cpp b/base.cpp index 691d15a..ce585ea 100755 --- a/base.cpp +++ b/base.cpp @@ -1,10 +1,10 @@ /* This file is part of yChat - - $Author: buetow $ - $Date: 2005/02/27 00:34:59 $ + + $Author: snooper $ + $Date: 2003/04/02 10:50:18 $ - $Header: /usr/home/cvs/cvsroot/ychat-0.5-legacy/base.cpp,v 1.3 2005/02/27 00:34:59 buetow Exp $ + $Header: /cvsroot/ychat/ychat/base.cpp,v 1.8 2003/04/02 10:50:18 snooper Exp $ */ // template class data implementation; @@ -16,54 +16,50 @@ template base::base() { - map_elem = new hmap(80); - pthread_mutex_init (&mut_map_elem, NULL ); + map_elem = new hmap(80); + pthread_mutex_init (&mut_map_elem, NULL ); } template base::~base( ) { - pthread_mutex_destroy( &mut_map_elem ); + pthread_mutex_destroy( &mut_map_elem ); } -template -void +template void base::add_elem( type* p_type ) { - pthread_mutex_lock ( &mut_map_elem ); - map_elem->add_elem ( p_type, p_type->get_name()); - pthread_mutex_unlock( &mut_map_elem ); + pthread_mutex_lock ( &mut_map_elem ); + map_elem->add_elem ( p_type, p_type->get_name()); + pthread_mutex_unlock( &mut_map_elem ); } -template -void +template void base::del_elem( string &s_name ) { - pthread_mutex_lock ( &mut_map_elem ); - map_elem->del_elem ( s_name ); - pthread_mutex_unlock( &mut_map_elem ); + pthread_mutex_lock ( &mut_map_elem ); + map_elem->del_elem ( s_name ); + pthread_mutex_unlock( &mut_map_elem ); } -template -type* +template type* base::get_elem( string &s_name, bool &b_found ) { - pthread_mutex_lock ( &mut_map_elem ); - type* p_type = map_elem->get_elem( s_name ); - pthread_mutex_unlock( &mut_map_elem ); + pthread_mutex_lock ( &mut_map_elem ); + type* p_type = map_elem->get_elem( s_name ); + pthread_mutex_unlock( &mut_map_elem ); - b_found = p_type == NULL ? false : true; + b_found = p_type == NULL ? false : true; - return p_type; + return p_type; } -template -void +template void base::run_func( void (*func)(type*, void*), void* v_arg ) { - pthread_mutex_lock ( &mut_map_elem ); - map_elem->run_func( func, v_arg ); - pthread_mutex_unlock( &mut_map_elem ); + pthread_mutex_lock ( &mut_map_elem ); + map_elem->run_func( func, v_arg ); + pthread_mutex_unlock( &mut_map_elem ); } #endif diff --git a/base.h b/base.h old mode 100644 new mode 100755 index 9ea405d..6f06e4b --- a/base.h +++ b/base.h @@ -10,60 +10,60 @@ template class base { private: - hmap* map_elem; - pthread_mutex_t mut_map_elem; + hmap* map_elem; + pthread_mutex_t mut_map_elem; public: base(); - ~base(); + ~base(); - virtual void add_elem( type* p_type ); // add a element. - virtual void del_elem( string &s_name ); // delete a alement. - virtual type* get_elem( string &s_name, bool &b_found ); // get a element. + virtual void add_elem( type* p_type ); // add a element. + virtual void del_elem( string &s_name ); // delete a alement. + virtual type* get_elem( string &s_name, bool &b_found ); // get a element. - // execute func on all elements of map_elem. v_pointer is the argument. - virtual void run_func( void (*func)(type*, void*), void* v_arg ); + // execute func on all elements of map_elem. v_pointer is the argument. + virtual void run_func( void (*func)(type*, void*), void* v_arg ); - // chat::msg_post sends to all users of the system a message. - // room::msg_post sends to all users of the room a message. - // user::msg_post sends to the user a message. - void msg_post( string *s_msg ) - { - run_func( &base::msg_post_ , (void*)s_msg ); - } - static void msg_post_( type* type_obj, void* v_arg ) - { - string *p_msg = (string*) v_arg; - type_obj -> msg_post( p_msg ); - } + // chat::msg_post sends to all users of the system a message. + // room::msg_post sends to all users of the room a message. + // user::msg_post sends to the user a message. + void msg_post( string *s_msg ) + { + run_func( &base::msg_post_ , (void*)s_msg ); + } + static void msg_post_( type* type_obj, void* v_arg ) + { + string *p_msg = (string*) v_arg; + type_obj -> msg_post( p_msg ); + } - void get_data( map_string *p_map_string ) - { - run_func( &base::get_data_ , (void*)p_map_string ); - } - static void get_data_( type* type_obj, void* v_arg ) - { - map_string *map_params = (map_string*) v_arg; - type_obj -> get_data ( map_params ); - } + void get_data( map_string *p_map_string ) + { + run_func( &base::get_data_ , (void*)p_map_string ); + } + static void get_data_( type* type_obj, void* v_arg ) + { + map_string *map_params = (map_string*) v_arg; + type_obj -> get_data ( map_params ); + } - // chat::get_user_list gets a list of all users of the system. - // room::get_user_list gets a list of all users of the room. - // user::get_user_list gets a "list" of a user usernameseperator - void get_user_list( string &s_list, string &s_seperator ) - { + // chat::get_user_list gets a list of all users of the system. + // room::get_user_list gets a list of all users of the room. + // user::get_user_list gets a "list" of a user usernameseperator + void get_user_list( string &s_list, string &s_seperator ) + { - container c; - c.elem[0] = (void*) &s_list; - c.elem[1] = (void*) &s_seperator; + container c; + c.elem[0] = (void*) &s_list; + c.elem[1] = (void*) &s_seperator; - run_func( &base::get_user_list_, (void*)&c ); - } - static void get_user_list_( type* type_obj, void* v_arg ) - { - container *c = (container*) v_arg; - type_obj -> get_user_list( *((string*)c->elem[0]), *((string*)c->elem[1]) ); - } + run_func( &base::get_user_list_, (void*)&c ); + } + static void get_user_list_( type* type_obj, void* v_arg ) + { + container *c = (container*) v_arg; + type_obj -> get_user_list( *((string*)c->elem[0]), *((string*)c->elem[1]) ); + } }; #include "base.cpp" diff --git a/chat.cpp b/chat.cpp old mode 100644 new mode 100755 index da574c7..b845ec3 --- a/chat.cpp +++ b/chat.cpp @@ -12,147 +12,136 @@ using namespace std; chat::chat( ) { - if ( s_conf::get - ().get_val( "HTML" ) == "OFF" ) - b_strip_html = true; - else - b_strip_html = false; + if ( s_conf::get().get_val( "HTML" ) == "OFF" ) + b_strip_html = true; + else + b_strip_html = false; } chat::~chat( ) -{} +{ +} user* chat::get_user( string &s_user ) { - bool b_flag; - return get_user( s_user, b_flag ); + bool b_flag; + return get_user( s_user, b_flag ); } user* chat::get_user( string &s_user, bool &b_found ) { - container param; + container param; - param.elem[0] = (void*) &s_user ; - param.elem[1] = (void*) &b_found; + param.elem[0] = (void*) &s_user ; + param.elem[1] = (void*) &b_found; - b_found = false; + b_found = false; - run_func( get_user_, (void*)¶m ); + run_func( get_user_, (void*)¶m ); - if ( *( (bool*)param.elem[1] ) ) - return (user*)param.elem[2]; + if ( *( (bool*)param.elem[1] ) ) + return (user*)param.elem[2]; } void chat::get_user_( room *room_obj, void *v_arg ) { - container* param = (container*) v_arg; - param->elem[2] = (void*)room_obj->get_elem( *((string*)param->elem[0]), *((bool*)param->elem[1]) ); + container* param = (container*) v_arg; + param->elem[2] = (void*)room_obj->get_elem( *((string*)param->elem[0]), *((bool*)param->elem[1]) ); } void chat::login( map_string &map_params ) { - string s_user = map_params["nick"]; - - // prove if nick is empty: - if ( s_user.empty() ) - { - map_params["INFO"] = E_NONICK; - map_params["request"] = s_conf::get - ().get_val( "STARTMPL" ); // redirect to the startpage. - return; - } - - // prove if the nick ist alphanumeric: - else if ( ! s_tool::is_alpha_numeric( s_user ) ) - { - map_params["INFO"] = E_ALPNUM; - map_params["request"] = s_conf::get - ().get_val( "STARTMPL" ); // redirect to the startpage. - return; - } - - bool b_flag; - - // prove if nick is already online / logged in. - get_user( s_user, b_flag ); - if ( b_flag ) - { - map_params["INFO"] = E_ONLINE; - map_params["request"] = s_conf::get - ().get_val( "STARTMPL" ); - return; - } - - string s_room = map_params["room"]; - room* p_room = get_room( s_room , b_flag ); - - // if room does not exist add room to list! - if ( ! b_flag ) - { - p_room = new room( s_room ); + string s_user = map_params["nick"]; + + // prove if nick is empty: + if ( s_user.empty() ) + { + map_params["INFO"] = E_NONICK; + map_params["request"] = s_conf::get().get_val( "STARTMPL" ); // redirect to the startpage. + return; + } + + // prove if the nick ist alphanumeric: + else if ( ! s_tool::is_alpha_numeric( s_user ) ) + { + map_params["INFO"] = E_ALPNUM; + map_params["request"] = s_conf::get().get_val( "STARTMPL" ); // redirect to the startpage. + return; + } + + bool b_flag; + + // prove if nick is already online / logged in. + get_user( s_user, b_flag ); + if ( b_flag ) + { + map_params["INFO"] = E_ONLINE; + map_params["request"] = s_conf::get().get_val( "STARTMPL" ); + return; + } + + string s_room = map_params["room"]; + room* p_room = get_room( s_room , b_flag ); + + // if room does not exist add room to list! + if ( ! b_flag ) + { + p_room = new room( s_room ); #ifdef VERBOSE - - pthread_mutex_lock ( &s_mutx::get - ().mut_stdout ); - cout << NEWROOM << s_room << endl; - pthread_mutex_unlock( &s_mutx::get - ().mut_stdout ); + pthread_mutex_lock ( &s_mutx::get().mut_stdout ); + cout << NEWROOM << s_room << endl; + pthread_mutex_unlock( &s_mutx::get().mut_stdout ); #endif + + add_elem( p_room ); + } - add_elem( p_room ); - } + user *p_user = new user( s_user ); - user *p_user = new user( s_user ); - - // add user to the room. - p_room->add_user( p_user ); - sess *ns =s_sman::get - ().createSession(); - ns->setValue(string("nick"), (void *)new string(s_user) ); - map_params["tmpid"]=ns->getId(); - // post "username enters the chat" into the room. - p_room->msg_post( new string( s_user.append( s_lang::get - ().get_val( "USERENTR" ) ) ) ); + // add user to the room. + p_room->add_user( p_user ); + sess *ns =s_sman::get().createSession(); + ns->setValue(string("nick"), (void *)new string(s_user) ); + map_params["tmpid"]=ns->getId(); + // post "username enters the chat" into the room. + p_room->msg_post( new string( s_user.append( s_lang::get().get_val( "USERENTR" ) ) ) ); #ifdef VERBOSE - - pthread_mutex_lock ( &s_mutx::get - ().mut_stdout ); - cout << LOGINPR << s_user << endl; - pthread_mutex_unlock( &s_mutx::get - ().mut_stdout ); + pthread_mutex_lock ( &s_mutx::get().mut_stdout ); + cout << LOGINPR << s_user << endl; + pthread_mutex_unlock( &s_mutx::get().mut_stdout ); #endif } -void +void chat::post( user* p_user, map_string &map_params ) { - string s_msg( map_params["message"] ); + string s_msg( map_params["message"] ); - auto unsigned i_pos = s_msg.find( "/" ); - if ( i_pos == 0 ) - return p_user->command( s_msg ); + auto unsigned i_pos = s_msg.find( "/" ); + if ( i_pos == 0 ) + return p_user->command( s_msg ); - if ( b_strip_html ) - s_tool::strip_html( &s_msg ); + if ( b_strip_html ) + s_tool::strip_html( &s_msg ); - string s_post( "get_col1() ) - .append( "\">" ) - .append( p_user->get_name() ) - .append( ": " ) - .append( s_msg ) - .append( "
\n" ); + s_post.append( p_user->get_col1() ) + .append( "\">" ) + .append( p_user->get_name() ) + .append( ": " ) + .append( s_msg ) + .append( "
\n" ); - p_user->get_p_room()->msg_post( &s_post ); + p_user->get_p_room()->msg_post( &s_post ); } #endif diff --git a/chat.h b/chat.h old mode 100644 new mode 100755 index f8a6523..60bcf9d --- a/chat.h +++ b/chat.h @@ -17,30 +17,30 @@ using namespace std; class chat : public base { private: - bool b_strip_html; + bool b_strip_html; public: + + room* get_room( string &s_name, bool &b_found ) + { + return static_cast( get_elem( s_name, b_found ) ); + } - room* get_room( string &s_name, bool &b_found ) - { - return static_cast( get_elem( s_name, b_found ) ); - } + // public methods: + explicit chat(); // a standard constructor. + ~chat(); // destructor. - // public methods: - explicit chat(); // a standard constructor. - ~chat(); // destructor. + // get the object of a specific user. + virtual user* get_user( string &s_nick ); + virtual user* get_user( string &s_nick, bool &b_found ); + static void get_user_( room* room_obj, void *v_arg ); - // get the object of a specific user. - virtual user* get_user( string &s_nick ); - virtual user* get_user( string &s_nick, bool &b_found ); - static void get_user_( room* room_obj, void *v_arg ); + // will be called every time a user tries to login. + virtual void login( map_string &map_params ); - // will be called every time a user tries to login. - virtual void login( map_string &map_params ); - - // will be called if a user posts a message. - virtual void post ( user* u_user, map_string &map_params ); + // will be called if a user posts a message. + virtual void post ( user* u_user, map_string &map_params ); }; #endif diff --git a/cmnd.cpp b/cmnd.cpp old mode 100644 new mode 100755 index f305f35..28e73a7 --- a/cmnd.cpp +++ b/cmnd.cpp @@ -9,9 +9,11 @@ using namespace std; cmnd::cmnd( ) -{} +{ +} cmnd::~cmnd() -{} +{ +} #endif diff --git a/cmnd.h b/cmnd.h old mode 100644 new mode 100755 index b5a1d4d..2eb1db2 --- a/cmnd.h +++ b/cmnd.h @@ -7,12 +7,12 @@ using namespace std; -class cmnd +class cmnd { public: - // public methods: - explicit cmnd( ); // a standard constructor. - ~cmnd( ); + // public methods: + explicit cmnd( ); // a standard constructor. + ~cmnd( ); }; #endif diff --git a/cmnd/CVS/Entries b/cmnd/CVS/Entries index 1784810..5f48d3a 100644 --- a/cmnd/CVS/Entries +++ b/cmnd/CVS/Entries @@ -1 +1,3 @@ +/yc_q.cpp/1.2/Wed Apr 2 21:57:34 2003// +/yc_test.cpp/1.1/Wed Apr 2 10:52:16 2003// D diff --git a/cmnd/CVS/Root b/cmnd/CVS/Root index 4ab853d..2818c02 100644 --- a/cmnd/CVS/Root +++ b/cmnd/CVS/Root @@ -1 +1 @@ -:pserver:volker@cvs.exa-ds.com:/home/cvsroot +:pserver:rover@cvs.ychat.berlios.de:/cvsroot/ychat diff --git a/cmnd/yc_q.cpp b/cmnd/yc_q.cpp index 8e48748..acc8596 100644 --- a/cmnd/yc_q.cpp +++ b/cmnd/yc_q.cpp @@ -8,15 +8,14 @@ using namespace std; -extern "C" -{ - export int extern_function(void *v_arg); +extern "C" { + export int extern_function(void *v_arg); - int extern_function(void *v_arg) - { - user *p_user = (user*) v_arg; - p_user->msg_post( new string( "\n " ) ); - p_user->set_online( false ); - } + int extern_function(void *v_arg) + { + user *p_user = (user*) v_arg; + p_user->msg_post( new string( "\n " ) ); + p_user->set_online( false ); + } } diff --git a/cmnd/yc_test.cpp b/cmnd/yc_test.cpp index c96e889..deb3e54 100644 --- a/cmnd/yc_test.cpp +++ b/cmnd/yc_test.cpp @@ -2,12 +2,11 @@ using namespace std; -extern "C" -{ - export int function(void *v_arg); +extern "C" { + export int function(void *v_arg); - int function(void *v_arg) - { - cout << "Hallo " << (char*)v_arg << endl; - } + int function(void *v_arg) + { + cout << "Hallo " << (char*)v_arg << endl; + } } diff --git a/conf.cpp b/conf.cpp old mode 100644 new mode 100755 index 14dc199..3ff71b8 --- a/conf.cpp +++ b/conf.cpp @@ -10,67 +10,66 @@ using namespace std; conf::conf( string s_conf = CONFILE ) : name( s_conf ) { - parse( ); // parse the config file. + parse( ); // parse the config file. } conf::~conf() -{} +{ +} void conf::parse() { #ifdef VERBOSE - cout << CFILEOK << get_name() << endl; + cout << CFILEOK << get_name() << endl; #endif - ifstream fs_conf( get_name().c_str() ); + ifstream fs_conf( get_name().c_str() ); - if ( ! fs_conf ) - { + if ( ! fs_conf ) + { #ifdef VERBOSE - cout << CFILENO << get_name() << endl; + cout << CFILENO << get_name() << endl; #endif + return; + } - return; - } - - char c_buf[READBUF]; + char c_buf[READBUF]; - while( fs_conf.getline( c_buf, READBUF ) ) - { - string s_token( c_buf ); - unsigned int ui_pos = s_token.find( "#", 0 ); + while( fs_conf.getline( c_buf, READBUF ) ) + { + string s_token( c_buf ); + unsigned int ui_pos = s_token.find( "#", 0 ); + + // if line is commented out: + if ( ui_pos == 0 ) + continue; - // if line is commented out: - if ( ui_pos == 0 ) - continue; + ui_pos = s_token.find( ";", 0 ); - ui_pos = s_token.find( ";", 0 ); + // if token has not been found. + if ( ui_pos == string::npos ) + continue; - // if token has not been found. - if ( ui_pos == string::npos ) - continue; + s_token = s_token.substr( 0 , --ui_pos ); + ui_pos = s_token.find ( "\"", 0 ); - s_token = s_token.substr( 0 , --ui_pos ); - ui_pos = s_token.find ( "\"", 0 ); + if ( ui_pos == string::npos ) + continue; - if ( ui_pos == string::npos ) - continue; - - string s_val = s_token.substr( ui_pos+1, s_token.length() ); - string s_key = s_token.substr( 0 , --ui_pos ); + string s_val = s_token.substr( ui_pos+1, s_token.length() ); + string s_key = s_token.substr( 0 , --ui_pos ); #ifdef VERBOSE2 - - cout << s_key << "=" << s_val << endl; + cout << s_key << "=" << s_val << endl; #endif - // fill the map. - map_vals[s_key] = s_val; - } + // fill the map. + map_vals[s_key] = s_val; + } - fs_conf.close(); - fs_conf.~ifstream(); + fs_conf.close(); + fs_conf.~ifstream(); } #endif diff --git a/conf.h b/conf.h old mode 100644 new mode 100755 index 7d0b807..6e2a890 --- a/conf.h +++ b/conf.h @@ -14,11 +14,11 @@ class conf : public cont, name private: public: - // public methods: - conf ( string s_conf ); // standard constructor. - ~conf(); // standard destructor. + // public methods: + conf ( string s_conf ); // standard constructor. + ~conf(); // standard destructor. - virtual void parse( ); // parses the config file. + virtual void parse( ); // parses the config file. }; #endif diff --git a/conf.txt b/conf.txt index 1857295..78c8a1e 100755 --- a/conf.txt +++ b/conf.txt @@ -11,15 +11,15 @@ # all lines which do not contain a semicolon and at least two quotes # or start with a # will be ignored. # -# greets, paul c. buetow ( snooper at ychat dot org ); +# greets, paul c. buetow ( snooper@ychat.org ); # # server specific configurations ( not allowed to be removed ): HTMLTEMP="html/"; # directory of the html-template files. -THRDPOOL="1"; # Initial pool size. -THRDPMAX="52"; # Max thread pool size -SRVRPORT="3000"; # local port on which the server listens. +THRDPOOL="50"; # thread pool size. +THRDQUEU="50"; # length of the thread pool queue. +SRVRPORT="2000"; # local port on which the server listens. STRDROOM="Lounge"; # the name of the standard room. LANGUAGE="en"; # language of the chat outputs ( CONSOLE OUTPUT IS NOT AFFECTED ) @@ -30,8 +30,18 @@ STARTMPL="index.html"; # user's standard nick color. USERCOL1="#FFFFFF"; +# superuser level names. level 0 has the most provileges. +SULEVEL0="Coder"; # programmer. +SULEVEL1="Admin"; # administrator. +SULEVEL2="Magic"; # super user with special privileges. +SULEVEL3="Super"; # temporary super user. +SULEVEL4="Basic"; # normal user without special privileges. +SULEVEL5="Guest"; # guest user, has almost no privileges. +SULEVEL6="Restr"; # a very restricted user. +SULEVEL7="Outbn"; # banned out of the system. + # length of the generated session id -SESSION_LENGTH="32"; +SESSION_LENGTH="64"; # html = "OFF" strips all html tags from incoming messages HTML="OFF"; @@ -39,8 +49,7 @@ HTML="OFF"; # Logging # relative or absolute path to logfile -ACCESS_LOG="log/access_log"; - +ACCESS_LOG="access_log"; # we're using buffered logging for performance # LOG_LINES specifies after how many lines the log is flushed into a file # if you don't want buffered logging set LOG_LINES to 1 @@ -48,7 +57,7 @@ LOG_LINES="10"; # values which are used by the html-templates and are not sticked within the yC++ core source! GRAPHICS="http://paul.buetow.info/yChat"; # url for graphic files etc. -PGETITLE="yChat 0.5.2-LEGACY - Fast Simple Extensible"; +PGETITLE="yChat++ Basic - Fast Simple Extensible"; # do not edit beyond this line diff --git a/configure b/configure index 9aab971..8c5f0a7 100755 --- a/configure +++ b/configure @@ -1,77 +1,1555 @@ -#!/bin/sh +#! /bin/sh -if ! ./scripts/checkperl.sh +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir |