summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:48 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:48 +0200
commit4ecbf33fae730bc79c4a47e6efda615b104754ad (patch)
treedd59412b6d8bea88995211f60b786728ac30acc4
parentbf5fc4cc4a15e8e57db58c2e065e0f5adbd8e800 (diff)
tagging ychat-0.7.8ychat-0.7.8
-rw-r--r--CHANGES29
-rw-r--r--CVS/Entries13
-rwxr-xr-xMakefile6
-rw-r--r--NEWS17
-rwxr-xr-xREADME31
-rw-r--r--RELEASES64
-rw-r--r--SNAPSHOT2
-rw-r--r--TODO7
-rw-r--r--VERSION2
-rw-r--r--etc/CVS/Entries2
-rw-r--r--etc/ychat.conf18
-rw-r--r--html/CVS/Entries6
-rw-r--r--scripts/CVS/Entries7
-rw-r--r--scripts/makeyhttpd.pl3
-rwxr-xr-xscripts/stats.pl4
-rw-r--r--src/CVS/Entries40
-rw-r--r--src/CVS/Entries.Log1
-rw-r--r--src/chat/CVS/Entries32
-rwxr-xr-xsrc/chat/base.h4
-rwxr-xr-xsrc/chat/base.tmpl30
-rwxr-xr-xsrc/chat/chat.cpp8
-rwxr-xr-xsrc/chat/chat.h1
-rwxr-xr-xsrc/chat/gcol.cpp2
-rwxr-xr-xsrc/chat/room.cpp10
-rwxr-xr-xsrc/chat/room.h2
-rwxr-xr-xsrc/chat/sman.cpp20
-rwxr-xr-xsrc/chat/sman.h3
-rwxr-xr-xsrc/chat/user.cpp43
-rwxr-xr-xsrc/chat/user.h8
-rw-r--r--src/cli/CVS/Entries4
-rwxr-xr-xsrc/cli/cli.cpp29
-rwxr-xr-xsrc/cli/cli.h8
-rw-r--r--src/conf/CVS/Entries4
-rwxr-xr-xsrc/conf/conf.cpp9
-rwxr-xr-xsrc/configure16
-rw-r--r--src/contrib/crypt/CVS/Entries6
-rw-r--r--src/contrib/xml/CVS/Entries8
-rw-r--r--src/data/CVS/Entries14
-rw-r--r--src/data/data_base.cpp2
-rw-r--r--src/data/data_base.h2
-rwxr-xr-xsrc/glob.h72
-rwxr-xr-xsrc/html.cpp3
-rwxr-xr-xsrc/main.cpp89
-rw-r--r--src/maps/CVS/Entries16
-rw-r--r--src/maps/shashmap.h9
-rw-r--r--src/maps/shashmap.tmpl14
-rw-r--r--src/memb/memb.h50
-rw-r--r--src/memb/memb.tmpl67
-rw-r--r--src/memb/tupel.h2
-rw-r--r--src/memb/tupel.tmpl14
-rwxr-xr-xsrc/modl.cpp8
-rwxr-xr-xsrc/modl.h3
-rw-r--r--src/mods/commands/CVS/Entries60
-rwxr-xr-xsrc/mods/commands/Makefile.in2
-rw-r--r--src/mods/html/CVS/Entries14
-rwxr-xr-xsrc/mods/html/Makefile.in4
-rwxr-xr-xsrc/msgs.h14
-rw-r--r--src/ncur/CVS/Entries8
-rwxr-xr-xsrc/ncur/ncur.cpp5
-rwxr-xr-xsrc/ncur/ncur.h4
-rwxr-xr-xsrc/reqp.cpp52
-rwxr-xr-xsrc/reqp.h7
-rw-r--r--src/sign.cpp9
-rw-r--r--src/sock/CVS/Entries4
-rwxr-xr-xsrc/sock/sock.cpp323
-rwxr-xr-xsrc/sock/sock.h38
-rw-r--r--src/stats.cpp167
-rw-r--r--src/stats.h23
-rw-r--r--src/thrd/CVS/Entries8
-rwxr-xr-xsrc/thrd/pool.cpp9
-rwxr-xr-xsrc/thrd/pool.h9
-rw-r--r--src/thrd/thro.cpp1
-rw-r--r--src/thrd/thro.h2
-rw-r--r--src/time/CVS/Entries8
-rwxr-xr-xsrc/time/timr.cpp4
-rw-r--r--src/tool/CVS/Entries8
-rwxr-xr-xsrc/wrap.cpp132
-rwxr-xr-xsrc/wrap.h21
78 files changed, 624 insertions, 1176 deletions
diff --git a/CHANGES b/CHANGES
index a1f06a9..abec250 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,32 +1,3 @@
--Changes from 0.7.9.2-RELEASE to 0.7.9.3-STABLERELEASE -
-$ The 0.7 branch is now STABLE.
-$ Modified the Makefiles, so that they produce valid output while using
-$ the -j flag of gmake.
-$ Fixed a mini bug in the src/configure script.
-$ Backported some security related HTTP patches from the 0.8-CURRENT branch.
-
--Changes from 0.7.9.1-RELEASE to 0.7.9.2-RELEASE -
-$ Added monitor/dump, and the dump command to the CLI.
-$ Fixed a bug in the session manager.
-$ Added gmake dist do the README.
-$ Added the charset to the HTTP-header.
-
--Changes from 0.7.9-RELEASE to 0.7.9.1-RELEASE -
-$ Fixed etc/ychat.conf (Its now valid XML)
-$ Fixed some typos.
-$ Added the scripts/makedist.sh script, which can be invoked by gmake dist.
-$ yhttpd.org has been renamed to yChat.org. The yhttpd.org SLD will be
-$ canceled! The yhttpd.org Homepage will remain on yChat.org!
-
--Changes from 0.7.8-RELEASE to 0.7.9-RELEASE -
-$ In the system messages will be the user printed which has requested the
- specified module.
-$ Removed the cursor from the ncurses interface.
-$ Added wrap::init_wrappers -> The main.cpp is now shorter.
-$ Added some Makefile modifications
-$ Bugfix: cleanipcache shouldn run every minute but every 10!
-$ Bugfix: scripts/stats.pl now counts all text-files properly.
-
-Changes from 0.7.7.1-RELEASE to 0.7.8-RELEASE -
$ Updated the yhttpd generation script due new sources in src/memb.
$ Changd some hashmaps back into simple std::map objects, this might
diff --git a/CVS/Entries b/CVS/Entries
index b7262f8..6e0ccd2 100644
--- a/CVS/Entries
+++ b/CVS/Entries
@@ -1,9 +1,10 @@
-/CHANGES/1.17/Mon Feb 14 20:09:50 2005//
+/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.31/Sun Feb 13 07:56:58 2005//
-/NEWS/1.33/Mon Feb 14 20:09:50 2005//
-/README/1.98/Mon Feb 14 20:09:50 2005//
-/TODO/1.68/Mon Feb 14 17:33:09 2005//
-/configure/1.31/Wed Feb 9 22:42:58 2005//
+/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//
D
diff --git a/Makefile b/Makefile
index b3c5ca8..070817f 100755
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
MAKE=`tail -n 1 make.version`
PREFIX=`grep "define PREFIX" src/glob.h | cut -d'"' -f2`
-all: version base modules
+all: version base modules version
@echo "Now edit the ychat.conf and run ychat!"
@echo "The config file is searched in the following order:"
@echo " ./ychat.conf "
@@ -74,7 +74,7 @@ mrproper: clean
@if test -f g++.version; then rm -f g++.version; fi
@if test -f make.version; then rm -f make.version; fi
@if test -f src/Makefile; then rm -f src/Makefile; fi
- @if test -f bin/ychat; then find bin/ -name "*ychat*" | xargs rm -f; fi
+ @if test -f bin/ychat; then find bin/ -name "*ychat" | xargs rm -f; fi
@if test -d src/mods; then find src/mods/*/ -name Makefile | xargs rm -f; fi
@find . -name "*.add" | xargs rm -f
@ls | grep core | xargs rm -f
@@ -84,5 +84,3 @@ debug:
@gdb bin/ychat ychat.core
confdebug:
./configure -g3 -ggdb
-dist:
- @./scripts/makedist.sh
diff --git a/NEWS b/NEWS
index 310dde8..76d6ab6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,20 @@
+::(05.03.05)::Released yChat 0.7.8. This release includes an IP cache for more speed. An UNIX signal catcher class has been added. SIGUSR1 and SIGUSR2 now clean the template cache or reload all dynamic modules. Added "Allow" to the HTTPD header. Also, lots of Bugfixes and minor improvements were made. Changed the 0.5 branch into STABLE. The 0.5.4-STABLERELEASE will follow next week. The ychat-stable CVS branch has been opened, which now points to ychat-0.5.
+::(02.03.05)::Released yChat 0.5.3. This is a LEGACYRELEASE. It includes a stats generation script located in the scripts/ directory which can be called by gmake stats. Also all the sources have been moved to ./src. Some minor bugfixes are included also.
+::(27.02.05)::Released yChat 0.5.2. This is a LEGACYRELEASE. That means, that this version is not official supported. The 0.5.2 version might be interesting by developers who want to have a clean base structure of an existing C++ based chat system. The 0.5.2 version does not have any features besides logging in and single room chatting. Multi rooms can be added easily.
+::(24.02.05)::Released yChat 0.7.7.1. This release only includes a yChat startup bugfix.
+::(17.02.05)::Released yChat 0.7.6. This release now uses the hash_map class from the SGI STL extension which is more stable then the old Hash Map used by yChat.
+::(14.02.05)::Released yChat 0.7.5. The garbage collector will now run once a hour. The dynamic thread pool has been improved. Removed thre equiv-http-refresh meta tag from the online list. Added a minor bugfix in the /topic command. Implemented an HTML based list of all logged in users and the /users command which does the same.
+::(13.02.05)::Released yChat 0.7.4.1 This new version includes a major bugfix made in the new dynamic thread pool which has been introdouced in 0.7.4. The bug resulted in a thread pool dead lock.. Tagged yChat 0.7.5-CURRENT into CVS.
+::(12.02.05)::Released yChat 0.7.4. This release includes a code cleanup and a dynamic increasing thread pool. Also, some other thread pool and session engine improvements were made. The Makefiles got more organized and the HTTPD header has got a Content-length line. The Content-type text/plain is now also supported. The command line interface has got the ! (bang) operator. So you can run programs of your shell through yChat. The HTML interface has got a scrolling checkbox to de/activate the scrolling of the chat stream. Last but not least some bugfixes were made.
+::(09.02.05)::Tagged yChat 0.7.4-PRERELEASE into CVS. The RELEASE will follow this week.
+::(08.01.05)::We passed the build number 3000! 3000 times yChat has been compiled during the developing process since there are build numbers! Also the first steps have been made porting yChat/yhttpd to the Windows platform using Cygwin (yChat 0.7.4-CURRENT Build 3040 CYGWIN_NT-5.1 1.5.12 (0.116/4/2) i686). It runs without having installed Cygwin and having an 1MB cygwin1.dll file instead. There are still some issues (like dynamic modules [which means, that there are no chat commands and no color choser etc], command line interface, ncurses interface, database support) which do not yet run on Cygwin. But those issues will be resolved the next weeks. An alpha (experimental) binary yChat/Win32 release might be done also.
+::(04.01.05)::First we wish all of you a happy new year. Second we have to announce that yhttpd 0.7-CURRENT now also has tested on an OpenBSD/i386 MP 3.6 box with success. Also yChat 0.7.4-CURRENT is now available from CVS.
+::(29.12.04)::Released yChat 0.7.3-RELEASE. New features: Added the /all command (Global system message), added FreeBSD 5.3-RELEASE support, added chat.enableguest option. Renamed the /getstatus command into /about. Fixed some bugs.
+::(09.11.04)::Released yChat 0.7.2-RELEASE. New features: /morph. Added the new standard html template design. Bugfixes: /away prints a . instead of a : if no away reason is given. /ko message was wrong. Displayed not room name of the user to be kicked out. /invisible command displayed wrong private messages. /getstatus had no help text. /msg and /s should now print the system time if printalwaystime == true. Added a blank to the /uptime message. /topic now prints the topic in the user's color.
+- Fixed some typos.
+::(06.11.04)::Released yChat and yhttpd 0.7.1-RELEASE. Added ${MAKE} to the Make file because some Linux distros dont use the "gmake" command for GNU make but just "make"! Modified the configure script to generate a make.version file. Removed some typos from the ychat.conf. Fixed the auto away message. This one will be posted in the room as public rather than only private to the auto-away-user. Fixed some documentation stuff for yhttpd because yhttpd does not need MySQL at all. Added the chat.maxlength.word option.
+::(02.11.04)::We now provided a yhttpd-0.7.tar.bz2 file for download which is a source code package of the HTTP kernel of yChat. This one can be used as a stand alone web server. Also a yhttpd branch will be created for yhttpd as well. :) We also started to work on the 0.7.x-CURRENT versions which will become some day 0.8-RELEASE.
+::(01.11.04)::We now provided a ychat-0.7.tar.bz2 file for download which is a source code package of the release we made yesterday. It also contains some fixes since then. You can download it on this site under Sourcecode -> Source packages -> CPP-yChat. :)
::(31.10.04)::After a long yChat 0.7-CURRENT developing phase we are proud to anounce yChat 0.7-RELEASE. By now, there may not any 0.7 release source packages for download available but you can fetch the release from the current cvs instead until source packages are available. This release has the biggest change log ever in yChat history. Here are some highlights: Included color switcher user interface, smart garbage collection engine, real MySQL support, nick registration + password protection, completly rewritten configure and Makefile scripts, perl script for source code stats, system_log and room_log, logout button, string replace for smileys e.g., additional CLI mode in parallel to the ncurses mode for the admin interface, memory watching, HTTP POST request handling in addition to POST request handling, CGI support, md5-summing of session ids to make reverse engineering of sessions harder, yhttpd generation script out of the yChat source tree, XML based configuration file, and lots of new configuration options which we can't list all here. yChat 0.7-RELEASE is known to compile and work correctly with GNU G++ 3.1, 3.2, 3.3 and 3.4. This announcement will be as well on Freshmeat.net on monday.
::(30.10.04)::yChat now has been tested on an OpenBSD 3.6 MP box with success. It has been compiled with GNU make 3.80 and GNU G++ 3.3.2. OpenBSD is now the 3rd operating system which is know to work with yChat. The other two tested OSes are still FreeBSD and Linux. All other UNIX and UNIX like operating systems should also work. But if you have tested it please write us an email to tell us about. ;)
::(26.09.04)::Renamed yChat Advanced 0.5 into yChat 0.6-RELEASE and yChat 0.6-CURRENT into yChat 0.7-CURRENT.
diff --git a/README b/README
index cf2f810..185df99 100755
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-yChat; Homepage: www.yChat.org; Version 0.7.9.3-RELEASES
+yChat; Homepage: www.yChat.org; Version 0.7.8-RELEASE
Copyright (C) 2003 Paul C. Buetow, Volker Richter
Copyright (C) 2004, 2005 Paul C. Buetow
@@ -36,7 +36,6 @@ YCHAT TABLE OF CONTENTS:
1.7.0 WRITING BUG REPORTS
1.8.0 CONTACT
1.9.0 YHTTPD CODE BASE GENERATION //<<
-2.0.0 CREDITS
0.0.0 ABOUT RELEASES
@@ -52,9 +51,6 @@ 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 -
@@ -202,8 +198,8 @@ 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 GCC G++ 3.4
+ The GNU C++ compiler.
- GNU make 3.80 (gmake) or higher
If you dont have a gmake executable but make is gnu make then you need
@@ -267,7 +263,7 @@ homepage which is located at http://www.yChat.org.
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/yChat .
+Packages or go to http://pub.buetow.org/yChat/CPP-yChat .
For CVS download type:
@@ -318,7 +314,6 @@ or gmake config):
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.)
@@ -464,7 +459,7 @@ src/msgs.h - Defines some server side messages
How to submit a good bug report?
-Send them to mail at yChat dot org.
+Send them to Bug@yChat.org.
First you should give the following information:
- yChat version, if CVS (or devel. tarball) then which day?
@@ -520,7 +515,8 @@ You may contact us through the following addresses:
The yChat homepage is located at http://www.yChat.org
- E-Mail
- Paul C. Buetow: Buetow at yChat point org ( core developer )
+ 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
@@ -530,18 +526,7 @@ You may contact us through the following addresses:
#Ychat and #Coding at irc.german-elite.net
//<<*
-1.9.0 YHTTPD CODE BASE GENERATION
+1.9 YHTTPD CODE BASE GENERATION
See docs/yhttpd.txt
//*>>
-
-2.0.0 CREDITS
-
-Thanks to the following persons. Without them yChat would not be like today:
-
-- Volker Richter <volker at exa-ds dot de> of EXA Digital Solutions GbR
- (http://www.exa-ds.com) for adding initial MySQL support and lots of more
- code.
-
-- Joshia Teitelbaum <joshuat at cryptomail.org> of CryptpMail.org for adding
- lots of security patches in the HTTP header handling.
diff --git a/RELEASES b/RELEASES
index 1d62ebc..24e4afa 100644
--- a/RELEASES
+++ b/RELEASES
@@ -1,40 +1,32 @@
Release table
-Release date Release name and version Release focus
+Release date Branch Release focus
-Planing: yChat 0.7.9.4-STABLERELEASE Maintenance
-Planing: ycurses 0.1-RELEASE________ Initial release
-Planing: yhttpd 0.8-RELEASE_________ Features
-Planing: yChat 0.8.2-RELEASE________ Features
+Planing: yXML 0.1-RELEASE_________ Initial release
+Planung: yChat 0.5.4-STABLERELEASE N/A
+Planung: yhttpd 0.7.2-RELEASE_____ Features
-Jun 21st 05: yChat 0.8.1-RELEASE Major features
-May 25th 05: yChat 0.8.0-RELEASE Major features
-May 08th 05: yChat 0.7.9.3-STABLERELEASE Security bugfixes
-Apr 11th 05: yChat 0.5.5-STABLERELEASE__ Minor security fixes
-Apr 10th 05: yChat 0.7.9.2-RELEASE______ Major security fixes
-Apr 07th 05: yChat 0.7.9.1-RELEASE______ Minor bugfixes
-Mar 11th 05: yChat 0.7.9-RELEASE________
-Mar 08th 05: yChat 0.5.4-STABLERELEASE__
-Mar 05th 05 yChat 0.7.8-RELEASE________
-Mar 02th 05 yChat 0.5.3-LEGACYRELEASE__
-Feb 27th 05 yChat 0.5.2-LEGACYRELEASE__
-Feb 24th 05 yChat 0.7.7.1-RELEASE______ Major bugfixes
-Feb 21th 05 yChat 0.7.7-RELEASE________
-Feb 18th 05 yChat 0.7.6-RELEASE________
-Feb 15th 05 yChat 0.7.5-RELEASE________
-Feb 14th 05 yChat 0.7.4.1-RELEASE______ Major bugfixes
-Feb 12th 05 yChat 0.7.4-RELEASE________
-Feb 10th 05 yChat 0.7.4-PRERELEASE_____
-Dec 29th 04 yChat 0.7.3-RELEASE________
-Nov 09th 04 yChat 0.7.2-RELEASE________
-Nov 06th 04 yhttpd 0.7.1-RELEASE_______
-Nov 06th 04 yChat 0.7.1-RELEASE________
-Nov 01st 04 yhttpd 0.7-RELEASE_________ Initial release
-Oct 31st 04 yChat 0.7-RELEASE__________
-Jan 03rd 04 yChat 0.5.1-RELEASE________
-Sep 15th 03 yChat 0.6-RELEASE__________
-Sep 15th 03 yChat 0.5.0-RELEASE________
-Apr 26th 03 yChat 0.4-RELEASE__________
-Mar 30th 03 yChat 0.3-RELEASE__________
-Mar 24th 03 yChat 0.2-RELEASE__________
-Mar 20th 03 yChat 0.1-RELEASE__________ Initial release
+Mar 05th 05 yChat 0.7.8-RELEASE______ Features
+Mar 02th 05 yChat 0.5.3-LEGACYRELEASE Minor improvements
+Feb 27th 05 yChat 0.5.2-LEGACYRELEASE Bugfixes, code cleanup
+Feb 24th 05 yChat 0.7.7.1-RELEASE____ Bugfix
+Feb 21th 05 yChat 0.7.7-RELEASE______ Code cleanup
+Feb 18th 05 yChat 0.7.6-RELEASE______ Improvements
+Feb 15th 05 yChat 0.7.5-RELEASE______ Features, bugfixes
+Feb 14th 05 yChat 0.7.4.1-RELEASE____ Bugfix
+Feb 12th 05 yChat 0.7.4-RELEASE______ Bugfixes, improvements, feat.
+Feb 10th 05 yChat 0.7.4-PRERELEASE___ Bugfixes, improvements, feat.
+Dec 29th 04 yChat 0.7.3-RELEASE______ Bugfixes, features
+Nov 09th 04 yChat 0.7.2-RELEASE______ Bugfixes, features
+Nov 06th 04 yhttpd 0.7.1-RELEASE_____ Bugfixes
+Nov 06th 04 yChat 0.7.1-RELEASE______ Bugfixes
+Nov 01st 04 yhttpd 0.7-RELEASE_______ Initial release
+Oct 31st 04 yChat 0.7-RELEASE________ Cleanup, features
+Jan 03rd 04 yChat 0.5.1-RELEASE______ Cleanup, bugfixes
+Sep 15th 03 yChat 0.6-RELEASE________ Cleanup, features
+Sep 15th 03 yChat 0.5.0-RELEASE______ Features
+Apr 26th 03 yChat 0.4-RELEASE________ Features
+Mar 30th 03 yChat 0.3-RELEASE________ Features
+Mar 24th 03 yChat 0.2-RELEASE________ Bugfixes
+Mar 20th 03 yChat 0.1-RELEASE________ Initial release
+
diff --git a/SNAPSHOT b/SNAPSHOT
index 6f8684e..4872beb 100644
--- a/SNAPSHOT
+++ b/SNAPSHOT
@@ -1 +1 @@
-Thu Feb 17 23:59:05 CET 2005
+Sat Mar 5 12:36:58 CET 2005
diff --git a/TODO b/TODO
index 404cee2..009aa00 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,7 @@
- Must do's for next RELEASE -
-$ None specific
+$ Add thread pool decreasing
- Might do's for next RELEASE -
-$ Add thread pool decreasing
$ dir : public vector<string>
$ Disable /help command for commands wich are not accessible for the
$ specific user.
@@ -10,10 +9,6 @@ $ Flood protection
$ Add /nick, /beam, /su
$ Add / to whisper to the last person to whom the user has been whispered the last time.
-- Known bugs -
-$ Using yChat via proxy sometimes causes a white chat stream.
-$ yhttpd cant serve very large html files.
-
- To do in general for some later RELEASE -
$ Use libevent
$ Not found sites should get a 404 error site!
diff --git a/VERSION b/VERSION
index ab96f12..c240510 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-yChat 0.7.5-RELEASE Build 3213
+yChat 0.7.8-RELEASE Build 3592
diff --git a/etc/CVS/Entries b/etc/CVS/Entries
index 5d7edfa..7822364 100644
--- a/etc/CVS/Entries
+++ b/etc/CVS/Entries
@@ -1,2 +1,2 @@
-/ychat.conf/1.41/Mon Feb 14 20:09:50 2005//
+/ychat.conf/1.46/Sun Feb 27 06:28:53 2005//
D
diff --git a/etc/ychat.conf b/etc/ychat.conf
index 0bdb3c1..e875420 100644
--- a/etc/ychat.conf
+++ b/etc/ychat.conf
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
-<config>
+<?xml version="5.0" encoding="ISO-8859-1" standalone="yes" ?>
<category name="chat">
<option name="defaultop">
<value>Snoop</value>
@@ -462,15 +461,15 @@
<category name="session">
<option name="md5hash">
<value>true</value>
- <descr>If set to true, then MD5 hash of the session id will be appended to the generated session to make the temp IDs even more secure.</descr>
+ <descr>If set to true, then the session id will be hashed by MD5 to make the id even more random</descr>
</option>
<option name="md5salt">
<value>tASDlkjadSD</value>
<descr>Some random string which will affect the md5-hash. Change this to another random string!</descr>
</option>
<option name="length">
- <value>32</value>
- <descr>Length of the generated session id. The length will be longer if md5hash is activated</descr>
+ <value>64</value>
+ <descr>Length of the generated session id. The length will be shorter if md5hash is activated</descr>
</option>
<option name="validchars">
<value>.abcdefghijklmnopqrstuvwxyz0123456789-_</value>
@@ -567,7 +566,7 @@
<descr>Specifies the relative or absolute path to the directory of the room log files</descr>
</option>
<option name="roomloglines">
- <value>0</value>
+ <value>20</value>
<descr>Number of room log lines which will be buffered in the main memory until they will be written into the file</descr>
</option>
</category>
@@ -590,7 +589,7 @@
<descr>If set to false, yChat strips all html tags from incoming messages</descr>
</option>
<option name="ipcachesize">
- <value>50</value>
+ <value>0</value>
<descr>Specifies the IP cache size. If set to 0, the IP cache will be cleared every 10 minutes. Otherwise, the IP cache will be cleared every 10 minutes only if there are more IPs in the cache than the specified amount.</descr>
</option>
<category name="html">
@@ -649,11 +648,11 @@
<descr>Specifies the relative or absolute path to the system messsage log file</descr>
</option>
<option name="accesslines">
- <value>0</value>
+ <value>20</value>
<descr>Number of access log lines which will be buffered in the main memory until they will be written into the file</descr>
</option>
<option name="systemlines">
- <value>0</value>
+ <value>20</value>
<descr>Number of system log lines which will be buffered in the main memory until they will be written into the file</descr>
</option>
</category>
@@ -687,4 +686,3 @@
</option>
</category>
</category>
-</config>
diff --git a/html/CVS/Entries b/html/CVS/Entries
index b9ef70c..19aa725 100644
--- a/html/CVS/Entries
+++ b/html/CVS/Entries
@@ -9,12 +9,12 @@
/input.html/1.12/Mon Feb 14 18:01:22 2005//
/loggedin.html/1.1/Mon Feb 14 18:01:22 2005//
/notfound.html/1.2/Sat Mar 20 21:58:14 2004//
-/online.html/1.6/Mon Feb 14 18:01:22 2005//
+/online.html/1.7/Wed Feb 23 05:08:04 2005//
/options.html/1.6/Sun Nov 7 02:24:57 2004//
/register.html/1.10/Sun Nov 7 02:37:57 2004//
/robots.txt/1.1.1.1/Fri Jan 2 03:15:10 2004//
-/stream.html/1.5/Sat Feb 12 16:15:30 2005//
-/style.css/1.3/Sun Nov 7 02:24:57 2004//
+/stream.html/1.6/Sat Feb 19 11:08:50 2005//
+/style.css/1.4/Sat Feb 19 11:08:50 2005//
/test.cgi/1.2/Sat Sep 25 04:12:43 2004//
/urlredirect.html/1.1/Sun Nov 7 00:33:14 2004//
D
diff --git a/scripts/CVS/Entries b/scripts/CVS/Entries
index d18751c..4fb49c8 100644
--- a/scripts/CVS/Entries
+++ b/scripts/CVS/Entries
@@ -1,8 +1,9 @@
/README/1.1/Tue Jun 29 23:38:15 2004//
-/astyle.sh/1.1/Sat Nov 13 19:16:39 2004//
+/astyle.sh/1.2/Mon Feb 21 01:55:49 2005//
/buildnr.pl/1.4/Sun Feb 6 16:38:36 2005//
-/config.sh/1.3/Sun Oct 31 18:04:18 2004//
-/makeyhttpd.pl/1.11/Wed Feb 9 22:42:58 2005//
+/checkperl.sh/1.1/Sat Feb 26 23:09:19 2005//
+/config.pl/1.1/Sat Feb 26 21:14:55 2005//
+/makeyhttpd.pl/1.15/Tue Mar 1 14:10:39 2005//
/screen.sh/1.1/Fri Mar 5 05:53:12 2004//
/setglobvals.pl/1.1.1.1/Fri Jan 2 03:15:10 2004//
/stats.pl/1.7/Fri Jan 14 17:33:02 2005//
diff --git a/scripts/makeyhttpd.pl b/scripts/makeyhttpd.pl
index 7dd0345..6adcc96 100644
--- a/scripts/makeyhttpd.pl
+++ b/scripts/makeyhttpd.pl
@@ -40,7 +40,6 @@ my %substituate = (
'yChat' => 'yhttpd',
'YCHAT' => 'YHTTPD',
'CHAT' => 'HTTPD',
- 'yhttpd.org' => 'yChat.org',
'//>>' => ''
);
@@ -157,7 +156,7 @@ sub remove_marked_lines {
sub edit_yhttpd_conf
{
my @old = fopen("etc/yhttpd.conf");
- my @new = @old[0..1];
+ my @new = shift @old;
my $flag = 0;
for (@old)
diff --git a/scripts/stats.pl b/scripts/stats.pl
index 96fbdf1..e5cc2b3 100755
--- a/scripts/stats.pl
+++ b/scripts/stats.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# The yhttpd Project (2003 - 2004)
+# The yChat Project (2003 - 2004)
#
# This script generates source code and project statistics
@@ -76,7 +76,7 @@ sub filestats
$stats{"Number of script files"}++;
$stats{"Lines of scripts"} += countlines($shift);
}
- elsif ( $shift =~ /(\.txt|[A-Z]+)$/ )
+ elsif ( $shift =~ /(\.txt|README|INSTALL|COPYING|NEWS|SNAPSHOT|ChangeLog)$/ )
{
$stats{"Number of text files"}++;
$stats{"Lines of text"} += countlines($shift);
diff --git a/src/CVS/Entries b/src/CVS/Entries
index 7009aff..4472904 100644
--- a/src/CVS/Entries
+++ b/src/CVS/Entries
@@ -1,21 +1,23 @@
/Makefile.in/1.22/Tue Sep 7 17:14:39 2004//
-/configure/1.28/Fri Jan 7 21:00:19 2005//
-/glob.h/1.51/Sun Feb 13 03:53:35 2005//
-/html.cpp/1.18/Thu Feb 10 16:07:18 2005//
-/html.h/1.8/Fri Jan 7 21:00:19 2005//
-/incl.h/1.4/Fri Jan 7 21:00:19 2005//
-/logd.cpp/1.9/Sun Feb 6 16:38:36 2005//
-/logd.h/1.7/Sun Feb 6 16:38:36 2005//
-/main.cpp/1.30/Thu Feb 10 19:55:24 2005//
-/modl.cpp/1.16/Fri Jan 7 21:00:19 2005//
-/modl.h/1.8/Thu Nov 18 13:41:47 2004//
-/msgs.h/1.161/Mon Feb 14 20:09:50 2005//
-/name.cpp/1.7/Fri Jan 7 21:00:19 2005//
-/name.h/1.5/Fri Jan 7 21:00:19 2005//
-/reqp.cpp/1.34/Thu Feb 10 16:07:18 2005//
-/reqp.h/1.12/Sun Feb 6 16:38:36 2005//
-/stats.cpp/1.9/Fri Jan 7 21:00:19 2005//
-/stats.h/1.6/Fri Jan 7 21:00:19 2005//
-/wrap.cpp/1.15/Wed Feb 9 22:42:58 2005//
-/wrap.h/1.22/Wed Feb 9 22:42:58 2005//
+/configure/1.38/Sun Feb 27 06:28:53 2005//
+/glob.h/1.70/Fri Mar 4 21:09:34 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.37/Fri Mar 4 02:41:30 2005//
+/modl.cpp/1.18/Mon Feb 21 01:55:49 2005//
+/modl.h/1.10/Mon Feb 21 01:55:49 2005//
+/msgs.h/1.200/Sat Mar 5 11:35:09 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.41/Tue Mar 1 16:11:03 2005//
+/reqp.h/1.15/Wed Feb 23 03:12:05 2005//
+/sign.cpp/1.2/Fri Mar 4 21:09:34 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.17/Fri Feb 25 00:15:38 2005//
+/wrap.h/1.24/Fri Feb 25 00:15:38 2005//
D
diff --git a/src/CVS/Entries.Log b/src/CVS/Entries.Log
index fd574a4..7d9d881 100644
--- a/src/CVS/Entries.Log
+++ b/src/CVS/Entries.Log
@@ -5,6 +5,7 @@ A D/contrib////
A D/data////
A D/irc////
A D/maps////
+A D/memb////
A D/mods////
A D/ncur////
A D/sock////
diff --git a/src/chat/CVS/Entries b/src/chat/CVS/Entries
index 8d2fcbd..26360be 100644
--- a/src/chat/CVS/Entries
+++ b/src/chat/CVS/Entries
@@ -1,17 +1,17 @@
-/base.h/1.5/Fri Jan 7 21:00:19 2005//
-/base.tmpl/1.4/Thu Nov 18 13:41:47 2004//
-/chat.cpp/1.14/Fri Jan 7 21:00:19 2005//
-/chat.h/1.8/Fri Jan 7 21:00:19 2005//
-/gcol.cpp/1.4/Thu Nov 18 13:41:47 2004//
-/gcol.h/1.3/Thu Nov 18 13:41:47 2004//
-/perm.cpp/1.7/Thu Nov 18 13:41:47 2004//
-/perm.h/1.5/Thu Nov 18 13:41:47 2004//
-/room.cpp/1.9/Sun Feb 6 16:38:36 2005//
-/room.h/1.5/Sun Feb 6 16:38:36 2005//
-/sess.cpp/1.5/Tue Jan 4 18:31:35 2005//
-/sess.h/1.5/Tue Jan 4 18:31:35 2005//
-/sman.cpp/1.9/Tue Jan 4 18:31:35 2005//
-/sman.h/1.4/Tue Jan 4 18:31:35 2005//
-/user.cpp/1.13/Mon Feb 14 20:09:50 2005//
-/user.h/1.6/Fri Jan 7 21:00:19 2005//
+/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.17/Wed Feb 23 20:23:31 2005//
+/user.h/1.11/Mon Feb 21 01:55:49 2005//
D
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..4f1646b 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
@@ -415,7 +411,7 @@ user::command( string &s_command )
string s_command2 = s_command.substr(0, pos2-1);
s_mod.append( s_command2 ).append( ".so" );
- dynmod *mod = wrap::MODL->get_module( s_mod, get_name() );
+ dynmod *mod = wrap::MODL->get_module( s_mod );
if ( mod == NULL ||
wrap::CHAT->get_command_disabled( s_command2 ) ||
@@ -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
index 7d01982..10c9656 100644
--- a/src/cli/CVS/Entries
+++ b/src/cli/CVS/Entries
@@ -1,3 +1,3 @@
-/cli.cpp/1.25/Wed Feb 9 22:42:58 2005//
-/cli.h/1.11/Fri Jan 7 21:00:19 2005//
+/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/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
index 68ec4ab..cfb51ed 100644
--- a/src/conf/CVS/Entries
+++ b/src/conf/CVS/Entries
@@ -1,3 +1,3 @@
-/conf.cpp/1.11/Fri Jan 7 21:00:19 2005//
-/conf.h/1.7/Fri Jan 7 21:00:19 2005//
+/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/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..eb54cce 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);
@@ -156,23 +156,19 @@ perl -e '
$ofile =~ s/\.cpp/\.o/;
print Fout "../obj/$ofile: $cppfile\n";
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\/.+/ )
+ if ( $ofile =~ /contrib\/.+/ )
{
- my $dirname = `dirname $class`;
- $text = "\t\@echo -n \"Contributed class $class \"\n";
+ my $dirname = `dirname $ofile`;
+ print Fout "\t\@echo -n \"Compiling contributed class $ofile \"\n";
}
else
{
- $text = "\t\@echo -n \"Base class $class \"\n";
+ print Fout "\t\@echo -n \"Compiling base class $ofile \"\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/crypt/CVS/Entries b/src/contrib/crypt/CVS/Entries
index 0548c58..78ab490 100644
--- a/src/contrib/crypt/CVS/Entries
+++ b/src/contrib/crypt/CVS/Entries
@@ -1,5 +1,5 @@
/how/1.1/Tue Aug 31 17:50:55 2004//
-/md5.cpp/1.3/Thu Nov 18 13:41:47 2004//
-/md5.h/1.3/Thu Nov 18 13:41:47 2004//
-/md5crypt.cpp/1.3/Thu Nov 18 13:41:47 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/xml/CVS/Entries b/src/contrib/xml/CVS/Entries
index fa52de9..baf8483 100644
--- a/src/contrib/xml/CVS/Entries
+++ b/src/contrib/xml/CVS/Entries
@@ -1,6 +1,6 @@
/README/1.1/Tue Sep 7 17:28:34 2004//
-/tinyxml.cpp/1.3/Thu Nov 18 13:41:47 2004//
-/tinyxml.h/1.4/Thu Nov 18 13:41:47 2004//
-/tinyxmlerror.cpp/1.3/Thu Nov 18 13:41:47 2004//
-/tinyxmlparser.cpp/1.3/Thu Nov 18 13:41:47 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/data/CVS/Entries b/src/data/CVS/Entries
index 848bb28..eb4056f 100644
--- a/src/data/CVS/Entries
+++ b/src/data/CVS/Entries
@@ -1,10 +1,10 @@
/README/1.1/Sun Apr 11 05:17:03 2004//
-/con.cpp/1.8/Fri Jan 7 21:17:53 2005//
-/con.h/1.6/Fri Jan 7 21:17:53 2005//
+/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.7/Fri Jan 7 21:17:53 2005//
-/data.cpp/1.10/Fri Jan 7 21:17:53 2005//
-/data.h/1.7/Fri Jan 7 21:17:53 2005//
-/data_base.cpp/1.12/Fri Jan 7 21:17:53 2005//
-/data_base.h/1.9/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.14/Mon Feb 21 01:55:49 2005//
+/data_base.h/1.11/Mon Feb 21 01:55:49 2005//
D
diff --git a/src/data/data_base.cpp b/src/data/data_base.cpp
index 8150608..05f4e0a 100644
--- a/src/data/data_base.cpp
+++ b/src/data/data_base.cpp
@@ -47,7 +47,7 @@ data_base::data_base( )
}
}
-void data_base::init_connections()
+void data_base::initialize_connections()
{
int i_min_con = tool::string2int( wrap::CONF->get_elem("chat.database.mincon") ),
i_max_con = tool::string2int( wrap::CONF->get_elem("chat.database.maxcon") );
diff --git a/src/data/data_base.h b/src/data/data_base.h
index 79f5630..1da5ce7 100644
--- a/src/data/data_base.h
+++ b/src/data/data_base.h
@@ -36,7 +36,7 @@ public:
data_base();
~data_base();
- void init_connections();
+ void initialize_connections();
virtual hashmap<string> select_user_data( string s_user, string s_query );
virtual void insert_user_data( string s_user, string s_query, hashmap<string> insert_map );
virtual void update_user_data( string s_user, string s_query, hashmap<string> update_map );
diff --git a/src/glob.h b/src/glob.h
index a0d980a..3fe9b7f 100755
--- a/src/glob.h
+++ b/src/glob.h
@@ -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
+*/
+//#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 )
*/
@@ -131,9 +121,9 @@
will print a warning message into the system messages and will
not core dump if an error occurs.
*/
-//#define CTCSEGV
+#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/main.cpp b/src/main.cpp
index c0adb5e..ffe5484 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -23,6 +23,11 @@
#include "incl.h"
#include "sign.h"
+#ifndef NCURSES
+#ifdef CLI
+#include "cli/cli.h"
+#endif
+#endif
#include "maps/hashmap.h"
@@ -80,18 +85,98 @@ parse_argc( int argc, char* argv[] )
int
main(int argc, char* argv[])
{
+ map<string,string>* p_start_params = parse_argc( argc, argv );
+
cout << tool::ychat_version() << endl
<< DESCRIP << endl
<< DESCRI2 << endl
<< CONTACT << endl
<< SEPERAT << endl;
- wrap::init_wrapper(parse_argc(argc, argv));
+
+ // All the static data classes have to be initialized once. otherwise they will
+ // contain only empty pointers and the chat server won't work correctly.
+ // the order of the initializations is very importand. for example the s_html::init()
+ // invokations assumes an initialized conf class.
+
+ // Init the dynamic wrapper (is needed to pass all wrapped objects through a single pointer).
+ wrap::WRAP = new dynamic_wrap;
+
+ // Init the config manager.
+ wrap::WRAP->CONF = wrap::CONF = new conf( CONFILE, p_start_params );
+ delete p_start_params,
+
+ // Init the statistic manager.
+ wrap::WRAP->STAT = wrap::STAT = new stats;
+
+ // Init the html-template manager.
+ wrap::WRAP->HTML = wrap::HTML = new html;
+
+#ifdef LOGGING
+ // Init the system message logd
+ wrap::WRAP->LOGD = wrap::LOGD = new logd( wrap::CONF->get_elem("httpd.logging.systemfile"),
+ wrap::CONF->get_elem("httpd.logging.systemlines") );
+#endif
+ //<<*
+ // Init the session manager.
+ wrap::WRAP->SMAN = wrap::SMAN = new sman;
+ //*>>
+
+
+#ifdef NCURSES
+
+ wrap::WRAP->NCUR = wrap::NCUR = new ncur; // init the ncurses admin interface.
+ wrap::NCUR->run(); // run the thread
+
+ // Wait until ncurses interface has been initialized.
+ do {
+ usleep(1000);
+ } while ( ! wrap::NCUR->is_ready() );
+
+ wrap::HTML->print_cached(0);
+#endif
+
+ // Init the thread pool
+ wrap::WRAP->POOL = wrap::POOL = new pool;
+ // Init the socket manager.
+ wrap::WRAP->SOCK = wrap::SOCK = new sock;
+
+ //<<*
+ // Init the chat manager.
+ wrap::WRAP->CHAT = wrap::CHAT = new chat;
+ //*>>
+
+ // Init the system timer.
+ wrap::WRAP->TIMR = wrap::TIMR = new timr;
+ wrap::TIMR->run(); // run the thread
+
+ //<<*
+ // Init the module-loader manager.
+ wrap::WRAP->MODL = wrap::MODL = new modl;
+
+ // Init the garbage collector
+ wrap::WRAP->GCOL = wrap::GCOL = new gcol;
+
+ // Init the data manager.
+#ifdef DATABASE
+
+ wrap::WRAP->DATA = wrap::DATA = new data;
+#endif
+ //*>>
+
+#ifndef NCURSES
+#ifdef CLI
+
+ cli* p_cli = new cli;
+ p_cli->run();
+#endif
+#endif
//<<*
// Initialize database connection queue
#ifdef DATABASE
- wrap::DATA->init_connections();
+
+ wrap::DATA->initialize_connections();
#endif
//*>>
diff --git a/src/maps/CVS/Entries b/src/maps/CVS/Entries
index b0587e6..991bf8b 100644
--- a/src/maps/CVS/Entries
+++ b/src/maps/CVS/Entries
@@ -1,9 +1,9 @@
-/hmap.h/1.7/Thu Nov 18 13:41:47 2004//
-/hmap.tmpl/1.7/Fri Jan 7 21:00:19 2005//
-/mtools.h/1.4/Fri Jan 7 21:00:19 2005//
-/mtools.tmpl/1.3/Thu Nov 18 13:41:47 2004//
-/nmap.h/1.4/Fri Jan 7 21:00:19 2005//
-/nmap.tmpl/1.3/Thu Nov 18 13:41:47 2004//
-/smap.h/1.9/Fri Jan 7 21:00:19 2005//
-/smap.tmpl/1.8/Fri Jan 7 21:00:19 2005//
+/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/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/memb.h b/src/memb/memb.h
index f0df6ed..9c398ec 100644
--- a/src/memb/memb.h
+++ b/src/memb/memb.h
@@ -2,8 +2,7 @@
#define MEMB_H
#include "../incl.h"
-#include "../wrap.h"
-#include "../maps/hashmap.h"
+#include "../maps/nhashmap.h"
#include "tupel.h"
using namespace std;
@@ -12,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 5c745cc..0b4da0e 100644
--- a/src/memb/memb.tmpl
+++ b/src/memb/memb.tmpl
@@ -1,20 +1,3 @@
-
-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)
@@ -23,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+")"));
-}
-
-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);
+ // mutexed_tupel<obj_type> *p_tupel = map_elems
}
-
-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 864a092..bb1939e 100644
--- a/src/memb/tupel.h
+++ b/src/memb/tupel.h
@@ -13,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 ab42748..bdde516 100644
--- a/src/memb/tupel.tmpl
+++ b/src/memb/tupel.tmpl
@@ -1,29 +1,29 @@
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;
}
@@ -31,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 );
}
diff --git a/src/modl.cpp b/src/modl.cpp
index 32fe33a..6668109 100755
--- a/src/modl.cpp
+++ b/src/modl.cpp
@@ -113,14 +113,6 @@ modl::cache_module( string s_name, bool b_print_sys_msg )
}
dynmod*
-modl::get_module( string s_name, string s_user )
-{
- wrap::system_message( MODULER + s_name.substr( s_name.find_last_of("/")+1 ) + " (" + s_user + ")");
- dynmod* mod = get_elem( s_name );
- return ! mod ? cache_module( s_name, true ) : mod;
-}
-
-dynmod*
modl::get_module( string s_name )
{
wrap::system_message( MODULER + s_name.substr( s_name.find_last_of("/")+1 ) );
diff --git a/src/modl.h b/src/modl.h
index 73abd58..983bdda 100755
--- a/src/modl.h
+++ b/src/modl.h
@@ -7,7 +7,7 @@
using namespace std;
-class modl : public shashmap<dynmod*>
+class modl : private shashmap<dynmod*>
{
private:
static void dlclose_( dynmod* mod );
@@ -24,7 +24,6 @@ public:
~modl();
dynmod* get_module( string s_name );
- dynmod* get_module( string s_name, string s_user );
vector<string>* get_mod_vector()
{
diff --git a/src/mods/commands/CVS/Entries b/src/mods/commands/CVS/Entries
index f719ced..0d8d93b 100644
--- a/src/mods/commands/CVS/Entries
+++ b/src/mods/commands/CVS/Entries
@@ -1,32 +1,32 @@
-/Makefile/1.26/Mon Feb 14 20:09:50 2005//
+/Makefile/1.30/Wed Feb 23 05:08:04 2005//
/Makefile.in/1.7/Thu Jul 8 14:39:03 2004//
-/yc_about.cpp/1.1/Thu Dec 30 18:36:03 2004//
-/yc_all.cpp/1.1/Thu Dec 30 19:14:52 2004//
-/yc_away.cpp/1.8/Thu Nov 18 13:41:47 2004//
-/yc_col.cpp/1.8/Thu Nov 18 13:41:47 2004//
-/yc_compopt.cpp/1.3/Thu Nov 18 13:41:47 2004//
-/yc_exec.cpp/1.9/Thu Nov 18 13:41:47 2004//
-/yc_fake.cpp/1.11/Thu Nov 18 13:41:47 2004//
-/yc_getroom.cpp/1.6/Thu Nov 18 13:41:47 2004//
-/yc_getrusage.cpp/1.8/Thu Nov 18 13:41:47 2004//
-/yc_help.cpp/1.4/Thu Nov 18 13:41:47 2004//
-/yc_invisible.cpp/1.9/Thu Nov 18 13:41:47 2004//
-/yc_j.cpp/1.9/Thu Nov 18 13:41:47 2004//
-/yc_ko.cpp/1.7/Thu Nov 18 13:41:47 2004//
-/yc_m.cpp/1.7/Thu Nov 18 13:41:47 2004//
-/yc_md5.cpp/1.7/Thu Nov 18 13:41:47 2004//
-/yc_me.cpp/1.7/Thu Nov 18 13:41:47 2004//
-/yc_morph.cpp/1.3/Thu Nov 18 13:41:47 2004//
-/yc_msg.cpp/1.9/Thu Dec 30 17:44:05 2004//
-/yc_q.cpp/1.8/Thu Nov 18 13:41:47 2004//
-/yc_reload.cpp/1.7/Thu Nov 18 13:41:47 2004//
-/yc_ren.cpp/1.7/Thu Nov 18 13:41:47 2004//
-/yc_s.cpp/1.8/Thu Nov 18 13:41:47 2004//
-/yc_set.cpp/1.7/Thu Nov 18 13:41:47 2004//
-/yc_template.cpp/1.7/Thu Nov 18 13:41:47 2004//
-/yc_time.cpp/1.6/Thu Nov 18 13:41:47 2004//
-/yc_topic.cpp/1.10/Mon Feb 14 17:33:09 2005//
-/yc_uptime.cpp/1.6/Thu Nov 18 13:41:47 2004//
-/yc_users.cpp/1.1/Mon Feb 14 20:09:50 2005//
-/yc_version.cpp/1.9/Thu Nov 18 13:41:47 2004//
+/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/Makefile.in b/src/mods/commands/Makefile.in
index 42884b6..ce8c00f 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 $@` "
@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
index 7b982b6..0d230ef 100644
--- a/src/mods/html/CVS/Entries
+++ b/src/mods/html/CVS/Entries
@@ -1,9 +1,9 @@
-/Makefile/1.22/Mon Feb 14 18:01:22 2005//
+/Makefile/1.26/Wed Feb 23 05:08:04 2005//
/Makefile.in/1.8/Thu Jul 8 14:39:03 2004//
-/yc_admin.cpp/1.5/Fri Jan 7 21:00:19 2005//
-/yc_colors.cpp/1.7/Fri Jan 7 21:00:19 2005//
-/yc_help.cpp/1.10/Fri Jan 7 21:00:19 2005//
-/yc_loggedin.cpp/1.1/Mon Feb 14 18:01:22 2005//
-/yc_options.cpp/1.7/Fri Jan 7 21:00:19 2005//
-/yc_register.cpp/1.10/Fri Jan 7 21:00:19 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/Makefile.in b/src/mods/html/Makefile.in
index 4b7c728..30f1782 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 $@` "
@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/msgs.h b/src/msgs.h
index 293f90f..46bd57c 100755
--- a/src/msgs.h
+++ b/src/msgs.h
@@ -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.3"
+#define VERSION "0.7.8"
#define BRANCH "RELEASE"
-#define BUILDNR 3807
-#define UNAME "FreeBSD 5.4-RELEASE i386"
+#define BUILDNR 3592
+#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
index 9f83c6c..62769f5 100644
--- a/src/ncur/CVS/Entries
+++ b/src/ncur/CVS/Entries
@@ -1,5 +1,5 @@
-/menu.cpp/1.7/Fri Jan 7 21:00:19 2005//
-/menu.h/1.5/Fri Jan 7 21:00:19 2005//
-/ncur.cpp/1.21/Mon Feb 14 17:33:09 2005//
-/ncur.h/1.8/Fri Jan 7 21:00:19 2005//
+/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.23/Fri Mar 4 02:41:30 2005//
+/ncur.h/1.10/Fri Mar 4 02:41:30 2005//
D
diff --git a/src/ncur/ncur.cpp b/src/ncur/ncur.cpp
index 9b0996c..9196111 100755
--- a/src/ncur/ncur.cpp
+++ b/src/ncur/ncur.cpp
@@ -212,7 +212,7 @@ ncur::switch_main_menu_( int i_choice )
def_prog_mode(); /* Save the tty modes */
endwin(); /* End curses mode temporarily */
- delete new cli(); /* Start CLI mode */
+ new cli(); /* Start CLI mode */
reset_prog_mode(); /* Return to the previous tty mode*/
/* stored by def_prog_mode() */
refresh(); /* Do refresh() to restore the */
@@ -253,9 +253,8 @@ ncur::init_ncurses()
clear();
noecho();
cbreak(); // Line buffering disabled. pass on everything
- init_pair(1, COLOR_BLACK, COLOR_CYAN);
+ init_pair(1, COLOR_WHITE, COLOR_BLUE);
mvprintw( 0,2, (char*)(tool::ychat_version()).c_str());
- curs_set(0);
refresh();
}
diff --git a/src/ncur/ncur.h b/src/ncur/ncur.h
index 1830cdf..e5627c8 100755
--- a/src/ncur/ncur.h
+++ b/src/ncur/ncur.h
@@ -29,8 +29,8 @@ private:
pthread_mutex_t mut_is_ready;
public:
- ncur();
- ~ncur();
+ ncur( ); // a standard constructor.
+ ~ncur( );
void start( void *p_void );
void print( char* c_print );
diff --git a/src/reqp.cpp b/src/reqp.cpp
index 9b5da0b..905f1a4 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);
@@ -352,7 +360,7 @@ reqp::run_html_mod( string s_event, map<string,string> &map_params, user* p_user
string s_mod = wrap::CONF->get_elem("httpd.modules.htmldir") + "yc_" + s_event + ".so";
- dynmod* p_module = wrap::MODL->get_module( s_mod, p_user->get_name() );
+ dynmod* p_module = wrap::MODL->get_module( s_mod );
if ( p_module != NULL )
( *( p_module->the_func ) ) ( static_cast<void*>(c) );
@@ -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;
}
diff --git a/src/reqp.h b/src/reqp.h
index 5a378fa..4c322cd 100755
--- a/src/reqp.h
+++ b/src/reqp.h
@@ -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/sign.cpp b/src/sign.cpp
index 6f4edee..db97d19 100644
--- a/src/sign.cpp
+++ b/src/sign.cpp
@@ -30,18 +30,13 @@ sign::terminate_received(int i_param)
{
#ifdef NCURSES
- //<<*
- if ( ! wrap::GCOL->remove_garbage() )
- wrap::NCUR->print( GAROFFNE );
- //*>>
+ if ( ! wrap::GCOL->remove_garbage() ) //<<
+ wrap::NCUR->print( GAROFFNE ); //<<
mvprintw( 21,2, "Good bye !");
wrap::NCUR->close_ncurses();
-
- //<<*
#else
wrap::GCOL->remove_garbage();
- //*>>
#endif
exit(0);
diff --git a/src/sock/CVS/Entries b/src/sock/CVS/Entries
index 4cdca42..0d7b592 100644
--- a/src/sock/CVS/Entries
+++ b/src/sock/CVS/Entries
@@ -1,3 +1,3 @@
-/sock.cpp/1.20/Mon Feb 14 17:33:09 2005//
-/sock.h/1.8/Thu Feb 10 19:55:24 2005//
+/sock.cpp/1.28/Tue Mar 1 09:54:29 2005//
+/sock.h/1.14/Sun Feb 27 06:28:53 2005//
D
diff --git a/src/sock/sock.cpp b/src/sock/sock.cpp
index 8f66268..5f6ede3 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 );
}
@@ -489,22 +306,16 @@ sock::clean_ipcache()
int i_ipcachesize = wrap::CONF->get_int("httpd.ipcachesize");
int i_currentsize = size();
- if ( i_currentsize > 0 && (i_ipcachesize == 0 || i_ipcachesize <= i_currentsize) )
+ 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
index 00f4a55..f9507bd 100644
--- a/src/thrd/CVS/Entries
+++ b/src/thrd/CVS/Entries
@@ -1,5 +1,5 @@
-/pool.cpp/1.12/Sun Feb 13 03:53:35 2005//
-/pool.h/1.9/Sun Feb 13 00:49:29 2005//
-/thro.cpp/1.5/Fri Jan 7 21:00:19 2005//
-/thro.h/1.4/Fri Jan 7 21:00:19 2005//
+/pool.cpp/1.17/Fri Feb 25 01:22:35 2005//
+/pool.h/1.11/Fri Feb 25 00:15:38 2005//
+/thro.cpp/1.6/Mon Feb 21 01:55:50 2005//
+/thro.h/1.5/Mon Feb 21 01:55:50 2005//
D
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..78c4163 100755
--- a/src/thrd/pool.h
+++ b/src/thrd/pool.h
@@ -7,11 +7,9 @@
using namespace std;
-class pool
+class pool
{
private:
- friend class thro;
-
struct task
{
void(*p_func)(void*);
@@ -22,7 +20,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 +41,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/thrd/thro.cpp b/src/thrd/thro.cpp
index 8b3f1ba..e35520c 100644
--- a/src/thrd/thro.cpp
+++ b/src/thrd/thro.cpp
@@ -23,7 +23,6 @@ thro::run( void *p_void )
{
elem.p_thro = this;
elem.p_void = p_void;
- //wrap::POOL->add_task(start_, &elem);
pthread_create( &pthread, NULL, start_, &elem );
}
diff --git a/src/thrd/thro.h b/src/thrd/thro.h
index 8e7e0cf..783cd0d 100644
--- a/src/thrd/thro.h
+++ b/src/thrd/thro.h
@@ -17,7 +17,7 @@ private:
}
elem;
- static void *start_( void *p_void );
+ static void* start_( void *p_void );
public:
thro( );
diff --git a/src/time/CVS/Entries b/src/time/CVS/Entries
index 1320336..a469506 100644
--- a/src/time/CVS/Entries
+++ b/src/time/CVS/Entries
@@ -1,5 +1,5 @@
-/timo.cpp/1.4/Fri Jan 7 21:00:19 2005//
-/timo.h/1.3/Thu Nov 18 13:41:47 2004//
-/timr.cpp/1.11/Mon Feb 14 17:33:09 2005//
-/timr.h/1.4/Fri Jan 7 21:00:19 2005//
+/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.15/Tue Mar 1 09:57:00 2005//
+/timr.h/1.5/Mon Feb 21 01:55:50 2005//
D
diff --git a/src/time/timr.cpp b/src/time/timr.cpp
index 1473a16..b04dc6b 100755
--- a/src/time/timr.cpp
+++ b/src/time/timr.cpp
@@ -103,11 +103,11 @@ timr::start( void *v_ptr )
wrap::DATA->check_data_con_timeout();
#endif
//*>>
+ wrap::SOCK->clean_ipcache();
+
// Run every ten minutes:
if ( time_now.tm_min % 10 == 0 )
{
-
- wrap::SOCK->clean_ipcache();
// Run every hour
if ( time_now.tm_min % 60 == 0 )
{
diff --git a/src/tool/CVS/Entries b/src/tool/CVS/Entries
index 8e29732..0f8f81b 100644
--- a/src/tool/CVS/Entries
+++ b/src/tool/CVS/Entries
@@ -1,5 +1,5 @@
-/dir.cpp/1.5/Fri Jan 7 21:00:19 2005//
-/dir.h/1.4/Fri Jan 7 21:00:19 2005//
-/tool.cpp/1.8/Fri Jan 7 21:00:19 2005//
-/tool.h/1.8/Fri Jan 7 21:00:19 2005//
+/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/wrap.cpp b/src/wrap.cpp
index d7e0dba..f675c1a 100755
--- a/src/wrap.cpp
+++ b/src/wrap.cpp
@@ -6,140 +6,42 @@
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;
- }
+ wrap::NCUR->print( s_message );
#endif
-
#ifdef SERVMSG
- cout << s_message << endl;
-#endif
-#ifdef LOGGING
-
- LOGD->log_simple_line( s_message + "\n" );
+ cout << s_message << endl;
#endif
-}
-
-void
-wrap::init_wrapper(map<string,string>* p_main_loop_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,
-
- // Init the statistic manager.
- WRAP->STAT = STAT = new stats;
-
- // Init the html-template manager.
- WRAP->HTML = HTML = new html;
-
#ifdef LOGGING
- // Init the system message logd
- WRAP->LOGD = LOGD = new logd( CONF->get_elem("httpd.logging.systemfile"),
- CONF->get_elem("httpd.logging.systemlines") );
-#endif
-
- //<<*
- // Init the session manager.
- WRAP->SMAN = SMAN = new sman;
- //*>>
- // 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
-
- WRAP->NCUR = NCUR = new ncur; // init the ncurses admin interface.
- NCUR->run(); // run the thread
-
- // Wait until ncurses interface has been initialized.
- do
- {
- usleep(1000);
- }
- while ( ! NCUR->is_ready() );
-
- HTML->print_cached(0);
-#else
-#ifdef CLI
-
- cli* p_cli = new cli;
- p_cli->run();
-#endif
-#endif
-
- // Init the thread pool
- WRAP->POOL = POOL = new pool;
-
- //<<*
- // Init the chat manager.
- WRAP->CHAT = CHAT = new chat;
- //*>>
-
- // Init the system timer.
- WRAP->TIMR = TIMR = new timr;
-
- //<<*
- // Init the module-loader manager.
- WRAP->MODL = MODL = new modl;
-
- // Init the garbage collector
- WRAP->GCOL = GCOL = new gcol;
-
- // Init the data manager.
-#ifdef DATABASE
-
- WRAP->DATA = DATA = new data;
+ wrap::LOGD->log_simple_line( s_message + "\n" );
#endif
- //*>>
-
- // Run threads
- TIMR->run();
}
-
#endif
diff --git a/src/wrap.h b/src/wrap.h
index f5c47dd..51eb9dd 100755
--- a/src/wrap.h
+++ b/src/wrap.h
@@ -2,13 +2,6 @@
#define WRAP_H
#include "incl.h"
-
-
-struct socketcontainer
-{
- int i_sock;
-};
-
#ifdef DATABASE
#include "data/data.h"
#endif
@@ -22,26 +15,17 @@ struct socketcontainer
//<<*
#include "modl.h"
//*>>
-
#ifdef NCURSES
#include "ncur/ncur.h"
-#else
-#ifdef CLI
-#include "cli/cli.h"
-#endif
#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,8 +73,6 @@ public:
static void system_message( string s_message );
- static void init_wrapper(map<string,string>* p_main_loop_params);
-
//<<*
static chat* CHAT;
#ifdef DATABASE
@@ -126,5 +108,4 @@ public:
static dynamic_wrap* WRAP;
};
-
#endif