From 520f54d6219b7c625b4e07463ac393e6982ddab6 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Apr 2013 13:14:41 +0200 Subject: tagging ychat-0.7.1 --- CHANGES | 46 +------ Makefile | 31 +---- NEWS | 9 +- README | 29 ++-- TODO | 36 ++--- configure | 7 +- etc/ychat.conf | 77 +++-------- html/admin.html | 4 +- html/colors.html | 8 +- html/demo.html | 4 +- html/frameset.html | 2 +- html/help.html | 4 +- html/images/y_black.png | Bin 0 -> 10663 bytes html/index.html | 19 ++- html/input.html | 47 +++---- html/online.html | 2 +- html/options.html | 12 +- html/register.html | 21 ++- html/stream.html | 24 ++-- html/style.css | 49 +------ scripts/buildnr.pl | 2 +- scripts/makeyhttpd.pl | 10 +- scripts/mergeconf.pl | 104 +++++++++++++++ scripts/stats.pl | 24 ++-- src/chat/base.h | 4 +- src/chat/chat.cpp | 50 +++---- src/chat/chat.h | 7 +- src/chat/room.cpp | 21 +-- src/chat/room.h | 11 +- src/chat/sess.cpp | 40 +----- src/chat/sess.h | 17 +-- src/chat/sman.cpp | 11 +- src/chat/sman.h | 6 +- src/chat/user.cpp | 4 +- src/chat/user.h | 6 +- src/cli/cli.cpp | 53 +------- src/cli/cli.h | 11 +- src/conf/conf.cpp | 18 +-- src/conf/conf.h | 10 +- src/conf/lang.cpp | 67 ++++++++++ src/conf/lang.h | 23 ++++ src/configure | 10 +- src/data/con.cpp | 48 +++---- src/data/con.h | 14 +- src/data/con_base.cpp | 5 +- src/data/con_base.h | 6 +- src/data/data.cpp | 263 ++++++++++++++++++------------------- src/data/data.h | 24 ++-- src/data/data_base.cpp | 240 ++++++++++++++++----------------- src/data/data_base.h | 49 ++++--- src/glob.h | 14 +- src/html.cpp | 34 +++-- src/html.h | 15 ++- src/incl.h | 5 +- src/logd.cpp | 21 +-- src/logd.h | 7 +- src/main.cpp | 27 ++-- src/maps/hmap.tmpl | 4 + src/maps/mtools.h | 4 + src/maps/nmap.h | 3 + src/maps/smap.h | 2 + src/maps/smap.tmpl | 4 + src/modl.cpp | 16 +-- src/modl.h | 2 +- src/mods/Makefile | 9 +- src/mods/commands/yc_away.cpp | 18 +-- src/mods/commands/yc_col.cpp | 2 - src/mods/commands/yc_exec.cpp | 2 - src/mods/commands/yc_fake.cpp | 2 - src/mods/commands/yc_getroom.cpp | 2 - src/mods/commands/yc_getrusage.cpp | 2 - src/mods/commands/yc_getstatus.cpp | 57 ++++++++ src/mods/commands/yc_help.cpp | 2 - src/mods/commands/yc_invisible.cpp | 6 +- src/mods/commands/yc_j.cpp | 2 - src/mods/commands/yc_ko.cpp | 4 +- src/mods/commands/yc_m.cpp | 1 - src/mods/commands/yc_md5.cpp | 2 - src/mods/commands/yc_me.cpp | 2 - src/mods/commands/yc_msg.cpp | 35 ++--- src/mods/commands/yc_q.cpp | 2 - src/mods/commands/yc_reload.cpp | 2 - src/mods/commands/yc_ren.cpp | 2 - src/mods/commands/yc_s.cpp | 13 +- src/mods/commands/yc_set.cpp | 2 - src/mods/commands/yc_template.cpp | 2 - src/mods/commands/yc_time.cpp | 2 - src/mods/commands/yc_topic.cpp | 14 +- src/mods/commands/yc_uptime.cpp | 2 - src/mods/commands/yc_version.cpp | 4 +- src/mods/html/yc_admin.cpp | 4 +- src/mods/html/yc_colors.cpp | 10 +- src/mods/html/yc_help.cpp | 4 +- src/mods/html/yc_options.cpp | 14 +- src/mods/html/yc_register.cpp | 18 ++- src/msgs.h | 31 +---- src/name.cpp | 4 +- src/name.h | 8 +- src/ncur/menu.cpp | 11 +- src/ncur/menu.h | 7 +- src/ncur/ncur.cpp | 34 ++--- src/ncur/ncur.h | 18 +-- src/reqp.cpp | 120 +++++++++-------- src/reqp.h | 35 +++-- src/sock/Makefile | 23 ++++ src/sock/README | 1 + src/sock/sock.cpp | 133 ++++++++++--------- src/sock/sock.h | 39 +++--- src/stats.cpp | 1 - src/stats.h | 2 +- src/thrd/pool.cpp | 162 ++++++++++------------- src/thrd/pool.h | 37 ++++-- src/thrd/thrd.cpp | 26 ++++ src/thrd/thrd.h | 28 ++++ src/thrd/thro.cpp | 3 +- src/thrd/thro.h | 12 +- src/time/timo.cpp | 4 +- src/time/timr.cpp | 31 ++--- src/time/timr.h | 8 +- src/tool/dir.cpp | 18 +-- src/tool/dir.h | 8 +- src/tool/tool.cpp | 145 ++++---------------- src/tool/tool.h | 84 ++++++++++-- src/wrap.cpp | 6 +- src/wrap.h | 14 +- 125 files changed, 1457 insertions(+), 1586 deletions(-) create mode 100755 html/images/y_black.png create mode 100755 scripts/mergeconf.pl create mode 100755 src/conf/lang.cpp create mode 100755 src/conf/lang.h create mode 100644 src/mods/commands/yc_getstatus.cpp create mode 100644 src/sock/Makefile create mode 100644 src/sock/README create mode 100755 src/thrd/thrd.cpp create mode 100755 src/thrd/thrd.h diff --git a/CHANGES b/CHANGES index 12f9ea6..e4573cd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,46 +1,4 @@ -Changes from 0.7.4-RELEASE to 0.7.4.1-RELEASE: -- Thread pool bugfix. - -Changes from 0.7.3-RELEASE to 0.7.4-RELEASE: -- Code cleanup. -- Made the thread pool increasing dynamic. -- Added some thread pool optimazions. -- Added some more ${MAKE} vars to the Makefiles. -- Added Content-length to the HTTPD header. -- Added the !command to the command line interface. -- Added Content-type text/plain. -- Added scrolling checkbox to input.html -- Removed modl from yhttpd. Dynamic modules are not needed in yhttpd yet. -- Improved session engine. -- Fixed auto logout bug. -- Fixed newline bug (one \n too much for each html template) -- Logging can now be completely disabled. - -Changes from 0.7.2 to 0.7.3-RELEASE: -- Added FreeBSD 5.3-RELEASE support. -- Added chat.enableguest option. -- Added the /all command (Global system message) -- Renamed the /getstatus command into /about. -- Fixed the &-bug (& should be allowed in messages). \AND is now a - synonym for & too. -- Fixed the /msg bug (In /msg the string replacer should be activated). -- Fixed logging bug (do not log any timestamps if there are no messages). - -Changes from 0.7.1 to 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. - -Changes from 0.7.0 to 0.7.1-RELEASE: +Changes from 0.7.0 to 0.7.1 RELEASE - Added ${MAKE} to the config 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. @@ -51,7 +9,7 @@ Changes from 0.7.0 to 0.7.1-RELEASE: need MySQL at all. - Added the chat.maxlength.word option. -Changes from 0.6 to 0.7.0-RELEASE: +Changes from 0.6 to 0.7.0 RELEASE - Better stability - Better performance (using more hmaps) - HTML color switcher menu diff --git a/Makefile b/Makefile index 805ddab..716f83a 100755 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -MAKE=`tail -n 1 make.version` +MAKE=`tail -1 make.version` PREFIX=`grep "define PREFIX" src/glob.h | cut -d'"' -f2` -all: version base modules version +all: 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 " @@ -8,24 +8,7 @@ all: version base modules version @echo " ./etc/ychat.conf " @echo " /etc/ychat.conf " @echo " $(PREFIX)/etc/ychat.conf " - @echo If you want to help the yChat project please run gmake mail - @echo so that the developers receive an email about the platform - @echo being used. -mail: - @echo "VERSION:" > mail.tmp - @${MAKE} version >> mail.tmp - @echo >> mail.tmp - @echo "UNAME:" >> mail.tmp - @uname -a >> mail.tmp - @echo >> mail.tmp - @echo "DATE:" >> mail.tmp - @date >> mail.tmp - @echo >> mail.tmp - @echo "COMPILER AND MAKE:" >> mail.tmp - @cat g++.version make.version >> mail.tmp - @cat mail.tmp | mail -s "Successfull build of yChat" successfullbuild@yhttpd.org - @rm -f mail.tmp -install: deinstall +install: deinstall @echo "Instaling ychat to $(PREFIX)" @cp bin/ychat $(PREFIX)/bin @if ! test -d $(PREFIX)/lib/ychat; then mkdir -p $(PREFIX)/lib/ychat; fi @@ -33,10 +16,13 @@ install: deinstall @if ! test -d $(PREFIX)/etc; then mkdir $(PREFIX)/etc; fi @if test -d mods; then cp -Rp mods $(PREFIX)/lib/ychat/mods; fi @cp -Rp html $(PREFIX)/share/ychat/html + @cp -Rp lang $(PREFIX)/share/ychat/lang @if test -f $(PREFIX)/etc/ychat.conf; then mv $(PREFIX)/etc/ychat.conf $(PREFIX)/etc/ychat.conf.bak; fi @cp etc/ychat.conf etc/ychat.conf.tmp @sed "s#mods/#$(PREFIX)/lib/ychat/mods/#" etc/ychat.conf.tmp > etc/ychat.conf.tmp.2 && mv etc/ychat.conf.tmp.2 etc/ychat.conf.tmp @sed "s#\"log/#\"$(PREFIX)/share/ychat/log/#" etc/ychat.conf.tmp > etc/ychat.conf.tmp.2 && mv etc/ychat.conf.tmp.2 etc/ychat.conf.tmp + @sed "s#LANGUAGE_DIR=\"lang/#LANGUAGE_DIR=\"$(PREFIX)/share/ychat/lang/#" etc/ychat.conf.tmp > etc/ychat.conf.tmp.2 && mv etc/ychat.conf.tmp.2 etc/ychat.conf.tmp + @sed "s#HTML_TEMPLATE_DIR=\"html/#HTML_TEMPLATE_DIR=\"$(PREFIX)/share/ychat/html/#" etc/ychat.conf.tmp > etc/ychat.conf.tmp.2 && mv etc/ychat.conf.tmp.2 etc/ychat.conf.tmp @mv etc/ychat.conf.tmp $(PREFIX)/etc/ychat.conf @echo "yChat configuration file can be found under" @echo " $(PREFIX)/etc/ychat.conf" @@ -46,9 +32,6 @@ install: deinstall @echo "The most secure would be an additional user 'ychat'!" uninstall: deinstall deinstall: - @echo Install/deinstall is currently not working! - @echo Start yChat with ./bin/ychat instead! - @exit 1 @echo "Deinstalling ychat from $(PREFIX)" @if test -f $(PREFIX)/bin/ychat; then rm -f $(PREFIX)/bin/ychat; fi @if test -d $(PREFIX)/lib/ychat; then rm -Rf $(PREFIX)/lib/ychat; fi @@ -102,6 +85,6 @@ mrproper: clean @find . -name "*.add" | xargs rm -f @ls | grep core | xargs rm -f version: - @./scripts/version.sh + @echo "`grep VERSION src/msgs.h | cut -d'"' -f2`-`grep BRANCH src/msgs.h| cut -d'"' -f2` Build `grep BUILD src/msgs.h| cut -d' ' -f3`" debug: @gdb bin/ychat ychat.core diff --git a/NEWS b/NEWS index 95d8087..36459e3 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,4 @@ -::(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. +::(06.11.04)::Released yChat and yhttpd 0.7.1-RELEASE. Added ${MAKE} to the config 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. diff --git a/README b/README index b7bf61e..67d60f4 100755 --- a/README +++ b/README @@ -1,7 +1,7 @@ -yChat; Homepage: www.yChat.org; Version 0.7.4.1-RELEASE +yChat; Homepage: www.yChat.org; Version 0.7.1-RELEASE Copyright (C) 2003 Paul C. Buetow, Volker Richter -Copyright (C) 2004, 2005 Paul C. Buetow +Copyright (C) 2004 Paul C. Buetow ----------------------------------------------------------------- This program is free software; you can redistribute it and/or @@ -55,7 +55,7 @@ Engine powerd browsers like Mozilla, Firefox, Camino etc. yChat runs completely stand alone and does not need another webserver to build on like Apache and does not need to be run via any kind of CGI. yChat creates its own socket on a customized port (standard port: 2000) and seems to be a full -featured HTTP web server to the clients (web browsers). +features HTTP web server to the clients (web browsers). The yChat code base can be converted to an yhttpd code base automaticaly. yhttpd is the webserver subset of yChat which runs completely stand alone and provides @@ -178,16 +178,13 @@ The following platforms have been tested with success. If you find out that a listed platform did not work at all please contact me: Operating system (arch) GNU G++ GNU make -- FreeBSD 5.3-RELEASE (i386) 3.4.2 3.80 - FreeBSD 5.2.1-RELEASE (i386) 3.3.3 3.80 -- FreeBSD 4.10-RELEASE (i386) 3.4.1 3.80 - FreeBSD 4.9-RELEASE (i386) 3.3.4 3.80 -- Gentoo Linux 2004 (i386) 3.3.2 3.80 -- OpenBSD 3.6 SMP (i386) 3.3.2 3.80 -- Red Hat Linux 8.0 SMP (i386) 3.2-7 3.79 +- FreeBSD 4.10-RELEASE (i386) 3.4.1 3.80 +- Gentoo Linux 2004.2 (i386) 3.3.2 3.80 +- OpenBSD 3.6 MP (i386) 3.3.2 3.80 - Slackware Linux 10.0 (i386) 3.4.0 3.80 -- SUSE Linux 9.0 (i386) 3.3.1 3.80 -- SUSE Linux 8.1 (i386) 3.2 3.79.1 +- SUSE Linux 8.0, G (i386) 3.3.1 3.80 Other platforms like Linux based systems, other BSD-Systems or UNICES are very likely to work too. @@ -197,11 +194,11 @@ are very likely to work too. Before you compile the source you have to be sure to use at least GCC version 3.1 with pthreads enabled. ( Type gcc -v to check it ). GCC 2.95 and 3.0 did not work while testing and WON'T BE SUPPORTED! -If you like to support yChat, please write us an email and tell what -you can/like/would help ;-]. Please also take a look at the yChat +If you like to support yChat++, please write us an email and tell what +you can/like/would help ;-]. Please also take a look at the yChat++ homepage which is located at http://www.yChat.org. -1.3.0 HOW TO OBTAIN YCHAT: +1.3.0 HOW TO OBTAIN YCHAT++: yChat can be downloaded as a source package or through CVS. @@ -225,7 +222,7 @@ Now you may continue with the installation. Invoke "./configure". Afterwards you will get prompted with the before-compile options of yChat. After choosing those options you are ready to type "gmake" -afterwards. See below what gmake is doing. +afterwards. //<<* If you have choosen MySQL database support, then take a look at section 1.3.2 @@ -238,7 +235,7 @@ You may also invoke gmake with the following options (the PREFIX can be set in the yChat configurator which will be launched by the top configure script or gmake config): - gmake or gmake all (compiles everything, also modules and runs "gmake mail") + gmake or gmake all (compiles everything, also modules) gmake base (only compiles the base) gmake base_start (only compiles the base and starts the server) gmake clean (cleans everything) @@ -249,7 +246,6 @@ or gmake config): gmake gpl (shows the GNU General Public License) gmake help (shows all available ychat gmake targets) gmake install (installs ychat to PREFIX) - gmake mail (sends a mail to the yChat developers containing build opts.) gmake modules (only compiles modules) gmake mrproper (same as gmake clean plus removing all temp files) gmake setup (runs all configure scripts and afterwards gmake all) @@ -276,7 +272,6 @@ If you in hury, then you may just type gmake setup. In the yChat configurator you may just choose all the default values. If done, yChat will get compiled and is ready to run with ./bin/ychat! - //<<* 1.3.3 MYSQL SETUP diff --git a/TODO b/TODO index 278c450..5c3176a 100644 --- a/TODO +++ b/TODO @@ -1,28 +1,10 @@ -Might do's for next RELEASE: -- dir : public vector -- Remove modl from yhttpd base (keep only in yChat base). -- Disable /help command for commands wich are not accessible for the - specific user. +To do for next RELEASE: - Flood protection -- Add /nick, /beam, /su -- Improve /ko, /msg, so they can used on several users at once with /ko (user1,user2) -- Improve /ko, so that there can be a reason specified as well. -- Add / to whisper to the last person to whom the user has been whispered the last time. -- Room maxuser limit. - -Known Bugs: -- Not found sites should get a 404 error site! - -To do in general for some later RELEASE: -- Implement login counter. -- Implement msg post counter. -- Implement online time counter. -- Implement hall of fame rankings of the counters above. Also add a msg/minute hall of fame. -- Make the thread pool size dynamic - Make CLI accessible through a chat command /cli -- Disable http-refresh of the online frame. Reload it only if there has been s.t. changed. -- Implement a http:// url detection and make a link out of it! -- Add scroll pause button to input.html +- Fixing logging bug (do not log any timestamps if there are no messages) +- Remove sess.cpp, use sman.cpp only. + +To do in general: - Remove user.cpp member variables as possible and replace them with hash maps for (integer,mutex) and (string,mutex) pairs. Maybe use s.t. like this: p_user->val("name"); to get the users name and p_user->val("name","val"); to @@ -32,10 +14,15 @@ To do in general for some later RELEASE: - Improve some HTTPD-Stuff - Add traffic stats - Write changes of the configuration back into XML if wished. +- Add scroll pause button to input.html - Add some chat commands - Make more values of the conf object dynamic (on the fly changable by the CLI) +- Make the thread pool size dynamic +- Remove inline methods - New dynamic command permission method The admin should allow/deny commands for each user seperately +- Add PostgreSQL support +- Add SQLite support - Add SSL sockets with OpenSSL - Add user profiles - Add action form to input.html @@ -44,10 +31,11 @@ To do in general for some later RELEASE: - Chat moderator option - Possibility sending Mails through external SMTP server (for password reminder etc) +- Advanced chat statistics - Add IRC support +- Add ICQ support - Add MPI support (load balancing) - Forum - Compatibility to Opera, Links, Konqueror and Safari - Add browser side caching for gfx files support -- Add own tiny ncursed XML editor diff --git a/configure b/configure index 20e84d0..b1d4746 100755 --- a/configure +++ b/configure @@ -70,9 +70,4 @@ perl -e ' exit(0); ' `echo "$*" | sed "s/-//g"` -if test -f err -then - rm -f err -else - echo You are ready to type gmake now! -fi +echo You are ready to type gmake now! diff --git a/etc/ychat.conf b/etc/ychat.conf index 391cf6b..66ad66a 100644 --- a/etc/ychat.conf +++ b/etc/ychat.conf @@ -1,13 +1,9 @@ - + - - @@ -61,9 +54,6 @@ - @@ -94,7 +84,7 @@ Seconds of idling after a database connection will be closed. Will be checked once each minute - - @@ -215,25 +199,25 @@ sets command status - @@ -296,9 +277,6 @@ - @@ -314,9 +292,6 @@ - @@ -329,9 +304,6 @@ - @@ -385,18 +357,12 @@ - - @@ -425,7 +391,7 @@ Your room name too long!<br><br> - @@ -583,16 +545,12 @@ - - @@ -666,9 +624,6 @@ - diff --git a/html/admin.html b/html/admin.html index 3dee7a2..2811219 100755 --- a/html/admin.html +++ b/html/admin.html @@ -7,7 +7,7 @@ - + @@ -407,7 +407,7 @@
- yChat is OpenSource - get it at http://www.yChat.org + yChat is OpenSource - get it at http://www.yChat.org

diff --git a/html/demo.html b/html/demo.html index b04ee15..819ae27 100755 --- a/html/demo.html +++ b/html/demo.html @@ -7,7 +7,7 @@ - +
Hello %%nick%%, all chat configuration options available are summarized below. @@ -26,7 +26,7 @@

- yChat is OpenSource - get it at http://www.yChat.org + yChat is OpenSource - get it at http://www.yChat.org
diff --git a/html/colors.html b/html/colors.html index 8b23014..a881280 100755 --- a/html/colors.html +++ b/html/colors.html @@ -26,7 +26,7 @@ } //--> - +
%%msgs%%
@@ -39,7 +39,7 @@
(color of your nickname):
- +
@@ -51,7 +51,7 @@
(color of your text messages):
- +
@@ -22,6 +22,6 @@ This is the demo website provided by yChat :-)
%%ychat.version%%

%%INFO%%


-
yChat is OpenSource - get it at http://www.yChat.org
+
yChat is OpenSource - get it at http://www.yChat.org
diff --git a/html/frameset.html b/html/frameset.html index 672f8fa..51c58ee 100755 --- a/html/frameset.html +++ b/html/frameset.html @@ -6,7 +6,7 @@ %%ychat.version%% - + Your browser does not support frames, diff --git a/html/help.html b/html/help.html index 57ae511..29ac849 100755 --- a/html/help.html +++ b/html/help.html @@ -7,7 +7,7 @@ - +
Hello %%nick%%, all chat commands available are summarized below (Please notice that only currently @@ -21,7 +21,7 @@

- yChat is OpenSource - get it at http://www.yChat.org + yChat is OpenSource - get it at http://www.yChat.org
diff --git a/html/images/y_black.png b/html/images/y_black.png new file mode 100755 index 0000000..49d2645 Binary files /dev/null and b/html/images/y_black.png differ diff --git a/html/index.html b/html/index.html index 983e7ef..7337772 100755 --- a/html/index.html +++ b/html/index.html @@ -7,14 +7,11 @@ - + - + + @@ -24,22 +21,22 @@ Enter your nick:
- +

Enter your password:
- +

Enter your room:
- +


-Register a new nick +Register a new nick

If you don't want to register you may login @@ -49,6 +46,6 @@ without a password using an unregistered nick.
-
-%%ychat.version%%

%%INFO%% -
-
yChat%%ychat.version%%

%%INFO%%
 


-
yChat is OpenSource - get it at http://www.yChat.org
+
yChat is OpenSource - get it at http://www.yChat.org
diff --git a/html/input.html b/html/input.html index 93e04d2..b5e4cd2 100755 --- a/html/input.html +++ b/html/input.html @@ -10,7 +10,6 @@ - + + + + + + + + + +
-
- - - -
-
- Colors - Options - Help - Admin - Logout - Scrolling: - -
+ + +
+
+ Colors + + Options + + Help + + Admin + + Logout +
diff --git a/html/online.html b/html/online.html index fc1fd84..29b606d 100755 --- a/html/online.html +++ b/html/online.html @@ -4,7 +4,7 @@ - + %%ROOMNAME%%

diff --git a/html/options.html b/html/options.html index 4dd5b35..6573441 100755 --- a/html/options.html +++ b/html/options.html @@ -6,7 +6,7 @@ Options menu - %%ychat.version%% - +
%%msgs%% @@ -16,19 +16,19 @@
Your E-Mail address:
- +

Your old password (needed if you want to enter a new password):
- +

Your new password:
- +

Your new password again:
- +

@@ -41,7 +41,7 @@ Your new password again:


- yChat is OpenSource - get it at http://www.yChat.org + yChat is OpenSource - get it at http://www.yChat.org

diff --git a/html/register.html b/html/register.html index 082e805..2caf27d 100755 --- a/html/register.html +++ b/html/register.html @@ -7,14 +7,11 @@ - + - + + @@ -24,30 +21,30 @@ Nick registration

%%INFO%% Enter your desired nick:
- +

Enter your E-Mail address:
- +

Enter your password:
- +

Enter your password again:
- +


-If you don't want to register go back +If you don't want to register go back
-
-Nick registration

%%INFO%% -
-
yChatNick registration

%%INFO%%
 


-
yChat is OpenSource - get it at http://www.yChat.org
+
yChat is OpenSource - get it at http://www.yChat.org
diff --git a/html/stream.html b/html/stream.html index 5bbdb43..493e9d3 100755 --- a/html/stream.html +++ b/html/stream.html @@ -8,27 +8,29 @@ - - Welcome to yChat %%nick%%! diff --git a/html/style.css b/html/style.css index ade4a1a..e31bd7e 100755 --- a/html/style.css +++ b/html/style.css @@ -1,52 +1,11 @@ -body, div { +BODY, TD { font-family: Verdana, Helvetica, sans-serif; - background-color: #000000; - color: #FFFFEF; font-size: 11pt; } - -input { - color: #000000; - font-family: Verdana, Helvetica, sans-serif; - text-decoration: none; - color: #FFFFEF; - background-color: #000000; - border: solid #555555 1px; - font-size: 9pt; - padding: 2px; -} - -input.text { - background-color: #AA5100; -} - -.fancy { - font-family: Verdana, Helvetica, sans-serif; - text-decoration: none; - color: #FFFFEF; - background-color: #000000; - border: solid #555555 1px; - font-size: 9pt; - padding: 2px; -} - -a:hover.fancy { - text-decoration: none; - color: #FFFFEF; - background-color: #323232; - border: solid #FFFFEF 1px; -} - -b { - background-color: #323232; - border: solid #555555 1px; -} - -body.stream { - background-color: #323232; +A { + color: #dddddd; } - .signature { - color: #AAAAAA; + color: #dddddd; font-size: 9pt; } diff --git a/scripts/buildnr.pl b/scripts/buildnr.pl index ee3d3e2..e691a11 100755 --- a/scripts/buildnr.pl +++ b/scripts/buildnr.pl @@ -13,7 +13,7 @@ close MSGS; foreach (@msgs) { - if ( /define BUILDNR/ ) + if ( /BUILDNR/ ) { s/(BUILDNR )(.+)$/$1.($2+1)/e; print; diff --git a/scripts/makeyhttpd.pl b/scripts/makeyhttpd.pl index 101343a..2805360 100644 --- a/scripts/makeyhttpd.pl +++ b/scripts/makeyhttpd.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# The yChat & yhttpd Project (2004, 2005) +# The yChat & yhttpd Project (2004) # # This scripts modifies the yChat sources to yhttpd sources. @@ -17,8 +17,6 @@ my @delete = ( 'src/data', 'src/irc', 'src/contrib/crypt', - 'src/modl.h', - 'src/modl.cpp', 'src/mods', 'src/mods/commands', 'src/mods/irc', @@ -77,7 +75,7 @@ foreach (@delete) { system("rm -Rf $_"); } -print "\nDeleting CVS directories\n"; +print "Deleting CVS directories\n"; system("find . -name CVS | xargs rm -Rf"); print "Creating new dirs\n->"; @@ -86,14 +84,14 @@ foreach (@createdir) { system("mkdir $_"); } -print "\nRenaming config file\n"; +print "Renaming config file\n"; system("mv etc/ychat.conf etc/yhttpd.conf"); print "Moving html templates\n"; system("mv demo.html html/index.html"); system("mv test.cgi notfound.html style.css html"); -print "Removing marked lines of code\n->"; +print "Removing marked lines of code\n ->"; &remove_marked_lines('.'); sub remove_marked_lines { diff --git a/scripts/mergeconf.pl b/scripts/mergeconf.pl new file mode 100755 index 0000000..85e76cb --- /dev/null +++ b/scripts/mergeconf.pl @@ -0,0 +1,104 @@ +#!/usr/bin/perl + +# The yChat Project (2003) +# +# This script merges configuration files + +use strict; + +use scripts::modules::file; + +my @files = ('conf.txt','lang/en.txt','lang/de.txt'); + +foreach my $filename ( @files ) +{ + next if ( ! -f $filename || ! -f "$filename.old" ); + + print "=> Merge $filename\n"; + my @newoptions = &merge("$filename.old",$filename ); + if (defined $newoptions[0]) + { + print " => Modified $filename. Edit to set the new values [or leave standard]\n => New options are:"; + foreach (@newoptions) + { + print " $_"; + } + print "\n"; + } +} + +sub merge +{ + my ($oldfile,$newfile) = @_; + my @oldfile = fopen($oldfile); + my @newfile = fopen($newfile); + my %oldfile = get_options(@oldfile); + my %newfile = get_options(@newfile); + my @newoptions; + + foreach my $option (keys %newfile) + { + unless (defined $oldfile{$option}) + { + push @newoptions, $option; + my $_comment = $newfile{$option}[0]; + my $_value = $newfile{$option}[1]; + my $_comment_b = $newfile{$option}[2]; + my $_behind = $newfile{$option}[3]; + print " => Adding to $newfile\n => New option is $option\n" + ." => Adding it after option $_behind\n"; + + my $added = 0; + my $insert = $_comment . "$option=\"$_value\";$_comment_b\n"; + foreach (@oldfile) + { + if (/^$_behind.+$/) + { + $_ .= $insert; + $added = 1; + last; + } + } + if ( $added == 0 ) + { + print " => Adding new option at EOF\n"; + push @oldfile, $insert; + } + } + } + + &fwrite($newfile,@oldfile); + + return @newoptions; +} + +sub get_options +{ + my @file = @_; + my %options; + my $option_comment; + my $option_before = ''; + + foreach (@file) + { + if (/(^.+)="(.+)";(.*)/) + { + my $option = $1; + my $option_value = $2; + my $option_comment_behind = $3; + my @values = ($option_comment, + $option_value, + $option_comment_behind, + $option_before); + $options{$option} = \@values; + $option_comment = ''; + $option_before = $option; + } + else + { + $option_comment .= $_; + } + } + + return %options; +} diff --git a/scripts/stats.pl b/scripts/stats.pl index e5cc2b3..38cc67c 100755 --- a/scripts/stats.pl +++ b/scripts/stats.pl @@ -9,7 +9,6 @@ use strict; use scripts::modules::file; my %stats; -my $param = shift; &recursive("."); @@ -18,16 +17,19 @@ $stats{"Lines total"} = $stats{"Lines of source"} + $stats{"Lines of text"} + $stats{"Lines of HTML"}; -unless (defined $param) { - - print "$_ = " . $stats{$_} . "\n" - for ( sort keys %stats ); - -} else { - - print $stats{$_} . " " - for sort keys %stats; - +my $bool = 0; +foreach ( sort keys %stats ) +{ + if ($bool == 0) + { + print "$_ = " . $stats{$_} . "\n"; + $bool = 1; + } + else + { + print "$_ = " . $stats{$_} . "\n"; + $bool = 0; + } } print "\n"; diff --git a/src/chat/base.h b/src/chat/base.h index dc44c69..ae2e926 100755 --- a/src/chat/base.h +++ b/src/chat/base.h @@ -57,14 +57,14 @@ public: type_obj -> reconf (); } - void get_data( map *p_map_string ) + void get_data( map_string *p_map_string ) { smap::run_func( &base::get_data_ , (void*)p_map_string ); } static void get_data_( type* type_obj, void* v_arg ) { - type_obj -> get_data ( (map*) v_arg ); + type_obj -> get_data ( (map_string*) v_arg ); } diff --git a/src/chat/chat.cpp b/src/chat/chat.cpp index 493c2a5..86bc140 100755 --- a/src/chat/chat.cpp +++ b/src/chat/chat.cpp @@ -65,15 +65,13 @@ void chat::get_user_( room *room_obj, void *v_arg ) { container* param = (container*) v_arg; - if ( *((bool*)param->elem[1]) ) return; - param->elem[2] = (void*)room_obj->get_elem( *((string*)param->elem[0]), *((bool*)param->elem[1]) ); } void -chat::login( map &map_params ) +chat::login( map_string &map_params ) { string s_user = map_params["nick"]; @@ -156,8 +154,8 @@ chat::login( map &map_params ) { 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_sess->set_name(s_user); + map_params["tmpid"] = p_sess->get_id(); p_user->set_tmpid( map_params["tmpid"] ); p_user->set_has_sess( true ); } @@ -167,9 +165,9 @@ chat::login( map &map_params ) { p_user = new user( s_user ); - // prove if nick is registered, else create a guest chatter. + // prove if nick is registered #ifdef DATABASE - map map_results = wrap::DATA->select_user_data( tool::to_lower(s_user), "selectlogin"); + map_string map_results = wrap::DATA->select_user_data( tool::to_lower(s_user), "selectlogin"); if ( map_results["nick"] == tool::to_lower(s_user) ) { @@ -194,23 +192,15 @@ chat::login( map &map_params ) } else #endif - { // If not registered prove if guest chatting is enabled. - if (wrap::CONF->get_elem("chat.enableguest") != "true") { - map_params["INFO"] = wrap::CONF->get_elem( "chat.msgs.err.noguest" ); - map_params["request"] = wrap::CONF->get_elem( "httpd.startsite" ); // redirect to the startpage. - wrap::system_message( LOGINE4 + s_user ); - return; - } - - // Guest chatter are enabled, use standard font colors + { // If not registered use standard font colors map_params["color1"] = wrap::CONF->get_elem( "chat.html.user.color1" ); map_params["color2"] = wrap::CONF->get_elem( "chat.html.user.color2" ); map_params["status"] = wrap::CONF->get_elem( "chat.defaultrang" ); } sess* p_sess = wrap::SMAN->create_session(); - p_sess->set_user(p_user); - map_params["tmpid"] = p_sess->get_tmpid(); + p_sess->set_name(s_user); + map_params["tmpid"] = p_sess->get_id(); p_user->set_tmpid( map_params["tmpid"] ); p_user->set_col1( map_params["color1"] ); p_user->set_col2( map_params["color2"] ); @@ -267,7 +257,7 @@ chat::login( map &map_params ) } void -chat::post( user* p_user, map &map_params ) +chat::post( user* p_user, map_string &map_params ) { p_user->renew_timeout(); @@ -310,11 +300,18 @@ chat::post( user* p_user, map &map_params ) if ( wrap::CONF->get_elem( "chat.html.tagsallow" ) != "true" ) tool::strip_html( &s_msg ); - unsigned i_pos = s_msg.find( "/" ); + auto unsigned i_pos = s_msg.find( "/" ); if ( i_pos == 0 ) return p_user->command( s_msg ); - string_replacer(&s_msg); + if ( wrap::CONF->get_elem( "chat.html.replace.activate" ) == "true" ) + { + for (vector::iterator iter = vec_replace_keys.end()-1; + iter != vec_replace_keys.begin(); + iter-- ) + s_msg = tool::replace( s_msg, *iter, wrap::CONF->get_elem(map_replace_strings[*iter]) ); + } + string s_post; if ( wrap::CONF->get_elem( "chat.printalwaystime" ) == "true" ) @@ -338,15 +335,4 @@ chat::reconf() { } -void -chat::string_replacer(string *p_msg) { - if ( wrap::CONF->get_elem( "chat.html.replace.activate" ) == "true" ) - { - for (vector::iterator iter = vec_replace_keys.end()-1; - iter != vec_replace_keys.begin(); - iter-- ) - *p_msg = tool::replace( *p_msg, *iter, wrap::CONF->get_elem(map_replace_strings[*iter]) ); - } -} - #endif diff --git a/src/chat/chat.h b/src/chat/chat.h index 86b7c0b..c37bebc 100755 --- a/src/chat/chat.h +++ b/src/chat/chat.h @@ -21,7 +21,7 @@ using namespace std; class chat : public base, public perm { private: - map map_replace_strings; + map_string map_replace_strings; vector vec_replace_keys; public: @@ -46,10 +46,10 @@ public: static void get_user_( room* room_obj, void *v_arg ); // will be called every time a user tries to login. - void login( map &map_params ); + void login( map_string &map_params ); // will be called if a user posts a message. - void post ( user* u_user, map &map_params ); + void post ( user* u_user, map_string &map_params ); void del_elem( string s_name ) { @@ -57,6 +57,5 @@ public: } void reconf(); - void string_replacer(string *p_msg); }; #endif diff --git a/src/chat/room.cpp b/src/chat/room.cpp index c21639a..b2f17f8 100755 --- a/src/chat/room.cpp +++ b/src/chat/room.cpp @@ -9,10 +9,8 @@ using namespace std; room::room( string s_name ) : name( s_name ) { pthread_mutex_init( &mut_s_topic, NULL ); -#ifdef LOGGING p_logd = new logd( wrap::CONF->get_elem("chat.logging.roomlogdir") + get_lowercase_name(), wrap::CONF->get_elem("chat.logging.roomloglines") ); -#endif wrap::STAT->increment_num_rooms(); } @@ -23,9 +21,7 @@ room::~room() // Delete all user objects run_func( mtools::delete_obj ); -#ifdef LOGGING delete p_logd; -#endif pthread_mutex_destroy( &mut_s_topic ); pthread_mutex_destroy( &mut_s_name ); @@ -42,23 +38,14 @@ room::get_topic() } void -room::set_topic( string s_topic ) +room::set_topic( string s_topic) { pthread_mutex_lock ( &mut_s_topic ); - if ( s_topic == "" ) - this->s_topic = ""; - else - this->s_topic = s_topic + "

"; + this->s_topic = s_topic; pthread_mutex_unlock( &mut_s_topic ); reload_onlineframe(); } -void -room::set_topic( string s_topic, string s_color ) -{ - set_topic( "" + s_topic + ""); -} - void room::clean_room() { @@ -85,17 +72,13 @@ room::set_name( string s_name ) return; } -#ifdef LOGGING p_logd->flush_logs(); -#endif if ( s_name == "" ) return; name::set_name( s_name ); -#ifdef LOGGING p_logd->set_logfile( wrap::CONF->get_elem("chat.logging.roomlogdir"), get_lowercase_name() ); -#endif } #endif diff --git a/src/chat/room.h b/src/chat/room.h index 255f90e..cc59424 100755 --- a/src/chat/room.h +++ b/src/chat/room.h @@ -19,9 +19,7 @@ class room : public base, public name private: string s_topic; pthread_mutex_t mut_s_topic; -#ifdef LOGGING logd* p_logd; -#endif public: room( string s_name ); @@ -56,9 +54,7 @@ public: } void msg_post( string *p_msg ) { -#ifdef LOGGING p_logd->log_simple_line( logd::remove_html_tags(*p_msg) ); -#endif base::msg_post( p_msg ); } @@ -68,10 +64,9 @@ public: } virtual void set_name( string s_name ); - string get_topic(); - void set_topic( string s_topic ); - void set_topic( string s_topic, string s_color ); - void clean_room(); + virtual string get_topic(); + virtual void set_topic( string s_topic ); + virtual void clean_room(); diff --git a/src/chat/sess.cpp b/src/chat/sess.cpp index 801a6bf..b41c8ce 100755 --- a/src/chat/sess.cpp +++ b/src/chat/sess.cpp @@ -3,55 +3,27 @@ #include "sess.h" -sess::sess( string s_tmpid ) +sess::sess( string s_id ) { - this->p_user = NULL; - this->s_tmpid = s_tmpid; + this->sess_id=s_id; } sess::~sess() { + } string -sess::get_tmpid() +sess::get_id() { - return s_tmpid; -} - -string -sess::get_name() -{ - if ( p_user = NULL ) - return ""; - - return p_user->get_name(); -} - -void -sess::set_name(string s_name) -{ - if ( p_user != NULL ) - p_user->set_name(s_name); -} - -user* -sess::get_user() -{ - return p_user; -} - -void -sess::set_user(user* p_user) -{ - this->p_user = p_user; + return this->sess_id; } void sess::invalidate() { - this->s_tmpid = "0"; + this->sess_id = "0"; } #endif diff --git a/src/chat/sess.h b/src/chat/sess.h index 033e954..717564a 100755 --- a/src/chat/sess.h +++ b/src/chat/sess.h @@ -3,29 +3,24 @@ #ifndef SESS_H #define SESS_H +#include #include -#include "user.h" class cont; using namespace std; -class sess +class sess : public name { + private: - string s_tmpid; - user *p_user; + string sess_id; public: - sess(string s_tmpid); + sess(string s_id); ~sess(); - string get_tmpid(); - - void set_user(user* p_user); - user* get_user(); - void set_name(string s_name); - string get_name(); + string get_id(); void invalidate(); }; #endif diff --git a/src/chat/sman.cpp b/src/chat/sman.cpp index 6ae665f..464bf24 100755 --- a/src/chat/sman.cpp +++ b/src/chat/sman.cpp @@ -19,7 +19,7 @@ sman::~sman() pthrea