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
commit5a019f435eb0068b524566d9babf172d58d0e96e (patch)
treeb083dccdfbec4335a5967d50c4294f7501c77345
parent4ecbf33fae730bc79c4a47e6efda615b104754ad (diff)
tagging ychat-0.7.9.2ychat-0.7.9.2
-rw-r--r--CHANGES22
-rwxr-xr-xMakefile6
-rw-r--r--NEWS5
-rwxr-xr-xREADME13
-rw-r--r--RELEASES55
-rw-r--r--TODO8
-rw-r--r--etc/ychat.conf12
-rw-r--r--scripts/makeyhttpd.pl3
-rwxr-xr-xscripts/stats.pl4
-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.h7
-rwxr-xr-xsrc/cli/cli.cpp29
-rwxr-xr-xsrc/cli/cli.h8
-rwxr-xr-xsrc/conf/conf.cpp9
-rwxr-xr-xsrc/configure10
-rw-r--r--src/data/data_base.cpp2
-rw-r--r--src/data/data_base.h2
-rwxr-xr-xsrc/glob.h4
-rwxr-xr-xsrc/html.cpp3
-rwxr-xr-xsrc/main.cpp89
-rw-r--r--src/maps/shashmap.h9
-rw-r--r--src/maps/shashmap.tmpl14
-rwxr-xr-xsrc/modl.cpp8
-rwxr-xr-xsrc/modl.h3
-rw-r--r--src/mods/commands/Makefile4
-rwxr-xr-xsrc/mods/commands/Makefile.in2
-rw-r--r--src/mods/html/Makefile4
-rwxr-xr-xsrc/mods/html/Makefile.in2
-rwxr-xr-xsrc/msgs.h14
-rwxr-xr-xsrc/ncur/ncur.cpp5
-rwxr-xr-xsrc/ncur/ncur.h4
-rwxr-xr-xsrc/reqp.cpp8
-rwxr-xr-xsrc/reqp.h1
-rw-r--r--src/sign.cpp9
-rwxr-xr-xsrc/sock/sock.cpp2
-rwxr-xr-xsrc/sock/sock.h2
-rwxr-xr-xsrc/thrd/pool.h2
-rw-r--r--src/thrd/thro.cpp1
-rw-r--r--src/thrd/thro.h2
-rwxr-xr-xsrc/time/timr.cpp4
-rwxr-xr-xsrc/wrap.cpp84
-rwxr-xr-xsrc/wrap.h11
51 files changed, 413 insertions, 196 deletions
diff --git a/CHANGES b/CHANGES
index abec250..24c9843 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,25 @@
+-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/Makefile b/Makefile
index 070817f..b3c5ca8 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 version
+all: version base modules
@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,3 +84,5 @@ debug:
@gdb bin/ychat ychat.core
confdebug:
./configure -g3 -ggdb
+dist:
+ @./scripts/makedist.sh
diff --git a/NEWS b/NEWS
index 76d6ab6..35b5854 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+::(10.04.05)::Released yChat 0.7.9.1. This release adds the dump command for the command line interface which prints out the internal yChat data structure. This feature makes it easier to track bugs. Also, a big bug of the session manager has been wiped out.
+::(08.04.05)::C++ yChat is now about 2 years old. Happy birthday yChat! The next few releases of the CURRENT branch will mostly contain bugfixes and stability improvements. We want to get ready to change 0.7-CURRENT into 0.7-STABLE in order to work on newer 0.8-CURRENT versions.
+::(07.04.05)::Released yChat 0.7.9.1. This release includes some minor bugfixes. The ychat.conf file is now valid XML. Also some typos have been fixed. Also a scripts/makedist.sh script has been added which creates a .tar.bz2 ball of the current source tree.
+::(10.03.05)::Released yChat 0.7.9. The logging capability has been improved. All chat command requests will be logged. The ncurses interface has been improved. Some code has been cleaned up.
+::(07.03.05)::Released yChat 0.5.4. This is a STABLERELEASE. The HTTP parsing methods have been backported from yChat 0.7.8. Also some minor bugfixes were made.This is the first STABLERELEASE of yChat ever.
::(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.
diff --git a/README b/README
index 185df99..3775f8b 100755
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-yChat; Homepage: www.yChat.org; Version 0.7.8-RELEASE
+yChat; Homepage: www.yChat.org; Version 0.7.9.2-PRERELEASE
Copyright (C) 2003 Paul C. Buetow, Volker Richter
Copyright (C) 2004, 2005 Paul C. Buetow
@@ -51,6 +51,9 @@ 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 -
@@ -198,8 +201,8 @@ lot of user and room objects are created and destroyed frequently.
1.0.0 REQUIREMENTS:
-- GNU GCC G++ 3.4
- The GNU C++ compiler.
+- GNU GCC G++
+ The GNU C++ compiler version 3.1 or up.
- GNU make 3.80 (gmake) or higher
If you dont have a gmake executable but make is gnu make then you need
@@ -314,6 +317,7 @@ 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.)
@@ -526,7 +530,8 @@ You may contact us through the following addresses:
#Ychat and #Coding at irc.german-elite.net
//<<*
-1.9 YHTTPD CODE BASE GENERATION
+1.9.0 YHTTPD CODE BASE GENERATION
See docs/yhttpd.txt
//*>>
+
diff --git a/RELEASES b/RELEASES
index 24e4afa..f0a0260 100644
--- a/RELEASES
+++ b/RELEASES
@@ -1,32 +1,37 @@
Release table
-Release date Branch Release focus
+Release date Release name and version Release focus
-Planing: yXML 0.1-RELEASE_________ Initial release
-Planung: yChat 0.5.4-STABLERELEASE N/A
-Planung: yhttpd 0.7.2-RELEASE_____ Features
+Planing: yhttpd 0.8-RELEASE_______ Features
+Planing: yChat 0.8-RELEASE________ Features
+Planing: ycurses 0.1-RELEASE______ Initial release
+Planing: yChat 5.5-RELEASE________ Minor bugfixes
-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
+Apr 10th 05: yChat 0.7.9.2-RELEASE____ Major bugfixes
+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________ 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
+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
diff --git a/TODO b/TODO
index 009aa00..47b2168 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,9 @@
- Must do's for next RELEASE -
-$ Add thread pool decreasing
+$ None specific
- Might do's for next RELEASE -
+$ Add CLI dump command (writes internal data structure into file, for debugging)
+$ Add thread pool decreasing
$ dir : public vector<string>
$ Disable /help command for commands wich are not accessible for the
$ specific user.
@@ -9,6 +11,10 @@ $ 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 -
+$ The session manager sometimes does not free a session. The user object might hang.
+$ Using yChat via proxy sometimes causes a white chat stream.
+
- To do in general for some later RELEASE -
$ Use libevent
$ Not found sites should get a 404 error site!
diff --git a/etc/ychat.conf b/etc/ychat.conf
index e875420..d17ace3 100644
--- a/etc/ychat.conf
+++ b/etc/ychat.conf
@@ -1,4 +1,5 @@
-<?xml version="5.0" encoding="ISO-8859-1" standalone="yes" ?>
+<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
+<config>
<category name="chat">
<option name="defaultop">
<value>Snoop</value>
@@ -461,15 +462,15 @@
<category name="session">
<option name="md5hash">
<value>true</value>
- <descr>If set to true, then the session id will be hashed by MD5 to make the id even more random</descr>
+ <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>
</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>64</value>
- <descr>Length of the generated session id. The length will be shorter if md5hash is activated</descr>
+ <value>32</value>
+ <descr>Length of the generated session id. The length will be longer if md5hash is activated</descr>
</option>
<option name="validchars">
<value>.abcdefghijklmnopqrstuvwxyz0123456789-_</value>
@@ -589,7 +590,7 @@
<descr>If set to false, yChat strips all html tags from incoming messages</descr>
</option>
<option name="ipcachesize">
- <value>0</value>
+ <value>50</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">
@@ -686,3 +687,4 @@
</option>
</category>
</category>
+</config>
diff --git a/scripts/makeyhttpd.pl b/scripts/makeyhttpd.pl
index 6adcc96..7dd0345 100644
--- a/scripts/makeyhttpd.pl
+++ b/scripts/makeyhttpd.pl
@@ -40,6 +40,7 @@ my %substituate = (
'yChat' => 'yhttpd',
'YCHAT' => 'YHTTPD',
'CHAT' => 'HTTPD',
+ 'yhttpd.org' => 'yChat.org',
'//>>' => ''
);
@@ -156,7 +157,7 @@ sub remove_marked_lines {
sub edit_yhttpd_conf
{
my @old = fopen("etc/yhttpd.conf");
- my @new = shift @old;
+ my @new = @old[0..1];
my $flag = 0;
for (@old)
diff --git a/scripts/stats.pl b/scripts/stats.pl
index e5cc2b3..96fbdf1 100755
--- a/scripts/stats.pl
+++ b/scripts/stats.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# The yChat Project (2003 - 2004)
+# The yhttpd 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|README|INSTALL|COPYING|NEWS|SNAPSHOT|ChangeLog)$/ )
+ elsif ( $shift =~ /(\.txt|[A-Z]+)$/ )
{
$stats{"Number of text files"}++;
$stats{"Lines of text"} += countlines($shift);
diff --git a/src/chat/base.h b/src/chat/base.h
index 9da4304..b995c5c 100755
--- a/src/chat/base.h
+++ b/src/chat/base.h
@@ -9,6 +9,9 @@
template<class type>
class base : public nhashmap<type*>
{
+protected:
+ void dumpit();
+
public:
base();
~base();
@@ -22,6 +25,7 @@ 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 0be21aa..5b0fceb 100755
--- a/src/chat/base.tmpl
+++ b/src/chat/base.tmpl
@@ -22,10 +22,40 @@ 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 0839261..e4cbaac 100755
--- a/src/chat/chat.cpp
+++ b/src/chat/chat.cpp
@@ -165,7 +165,6 @@ 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"] );
@@ -361,4 +360,11 @@ 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 47645c3..bb087d5 100755
--- a/src/chat/chat.h
+++ b/src/chat/chat.h
@@ -23,6 +23,7 @@ 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 7df111d..d4c9416 100755
--- a/src/chat/gcol.cpp
+++ b/src/chat/gcol.cpp
@@ -44,6 +44,8 @@ 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 b927d40..0e28c84 100755
--- a/src/chat/room.cpp
+++ b/src/chat/room.cpp
@@ -101,4 +101,14 @@ 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 06b0a9a..4c5fac6 100755
--- a/src/chat/room.h
+++ b/src/chat/room.h
@@ -23,6 +23,8 @@ 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 d80d421..530aa17 100755
--- a/src/chat/sman.cpp
+++ b/src/chat/sman.cpp
@@ -21,23 +21,33 @@ sman::~sman()
string sman::generate_id( int i_len )
{
- string valid_chars = wrap::CONF->get_elem("chat.session.validchars");
+ string s_valid = 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() % 64;
- s_ret += valid_chars[i_char];
+ i_char = rand() % s_valid.length();
+ s_ret += s_valid[i_char];
}
if ( wrap::CONF->get_elem("chat.session.md5hash") == "true" )
{
string s_salt = wrap::CONF->get_elem("chat.session.md5salt");
- 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);
+ 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);
}
return s_ret;
diff --git a/src/chat/sman.h b/src/chat/sman.h
index 992fc64..13fc45a 100755
--- a/src/chat/sman.h
+++ b/src/chat/sman.h
@@ -7,10 +7,11 @@
#include "sess.h"
#include "../maps/shashmap.h"
+#include "../monitor/dump.h"
using namespace std;
-class sman : private shashmap<sess*>
+class sman : public shashmap<sess*>
{
private:
string generate_id( int i_len );
diff --git a/src/chat/user.cpp b/src/chat/user.cpp
index 4f1646b..bac8b7e 100755
--- a/src/chat/user.cpp
+++ b/src/chat/user.cpp
@@ -73,23 +73,27 @@ 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
- 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, "" );
+ set_has_sess(false);
+ wrap::SMAN->destroy_session(get_tmpid());
+ set_tmpid("");
}
string
@@ -411,7 +415,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 );
+ dynmod *mod = wrap::MODL->get_module( s_mod, get_name() );
if ( mod == NULL ||
wrap::CHAT->get_command_disabled( s_command2 ) ||
@@ -577,4 +581,15 @@ 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 443eef6..1d16695 100755
--- a/src/chat/user.h
+++ b/src/chat/user.h
@@ -5,13 +5,14 @@
#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 memb<string>
+class user : public name, public timo, public dumpable //, public memb<string>
{
private:
@@ -56,7 +57,8 @@ private:
pthread_mutex_t mut_map_changed_data;
void initialize();
- void set_changed_data( string s_varname, string s_value );
+ void set_changed_data( string s_varname, string s_value );
+ void dumpit();
public:
pthread_cond_t cond_message;
@@ -67,6 +69,7 @@ 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/cli.cpp b/src/cli/cli.cpp
index 96a0010..cc0f5e5 100755
--- a/src/cli/cli.cpp
+++ b/src/cli/cli.cpp
@@ -37,6 +37,8 @@ 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
@@ -78,6 +80,11 @@ 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;
@@ -134,6 +141,7 @@ cli::parse_input( string s_input )
{
cout << CLIPRMO;
wrap::MODL->reload_modules();
+ cout << MODRELO << endl;
cout << CLIPRMI;
}
//*>>
@@ -207,6 +215,7 @@ cli::parse_input( string s_input )
{
cout << CLIPRMO;
wrap::MODL->unload_modules();
+ cout << MODUNLO << endl;
cout << CLIPRMI;
}
//*>>
@@ -285,6 +294,26 @@ 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 23e1d1c..7d51e3f 100755
--- a/