summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/chat/base.h158
-rwxr-xr-xsrc/chat/base.tmpl46
-rwxr-xr-xsrc/chat/chat.cpp481
-rwxr-xr-xsrc/chat/chat.h72
-rwxr-xr-xsrc/chat/gcol.cpp161
-rwxr-xr-xsrc/chat/gcol.h31
-rwxr-xr-xsrc/chat/perm.cpp69
-rwxr-xr-xsrc/chat/perm.h45
-rwxr-xr-xsrc/chat/room.cpp108
-rwxr-xr-xsrc/chat/room.h116
-rwxr-xr-xsrc/chat/sess.cpp39
-rwxr-xr-xsrc/chat/sess.h21
-rwxr-xr-xsrc/chat/sman.cpp127
-rwxr-xr-xsrc/chat/sman.h30
-rwxr-xr-xsrc/chat/user.cpp688
-rwxr-xr-xsrc/chat/user.h237
-rwxr-xr-xsrc/cli/cli.cpp473
-rwxr-xr-xsrc/cli/cli.h39
-rwxr-xr-xsrc/conf/conf.cpp209
-rwxr-xr-xsrc/conf/conf.h24
-rwxr-xr-xsrc/configure314
-rw-r--r--src/contrib/crypt/md5.cpp333
-rw-r--r--src/contrib/crypt/md5.h15
-rw-r--r--src/contrib/crypt/md5crypt.cpp233
-rw-r--r--src/contrib/xml/tinyxml.cpp1679
-rw-r--r--src/contrib/xml/tinyxml.h2242
-rw-r--r--src/contrib/xml/tinyxmlerror.cpp44
-rw-r--r--src/contrib/xml/tinyxmlparser.cpp2684
-rwxr-xr-xsrc/data/con.cpp48
-rwxr-xr-xsrc/data/con.h8
-rwxr-xr-xsrc/data/con_base.cpp5
-rwxr-xr-xsrc/data/con_base.h4
-rw-r--r--src/data/data.cpp262
-rw-r--r--src/data/data.h18
-rw-r--r--src/data/data_base.cpp232
-rw-r--r--src/data/data_base.h23
-rwxr-xr-xsrc/glob.h177
-rwxr-xr-xsrc/html.cpp162
-rwxr-xr-xsrc/html.h45
-rwxr-xr-xsrc/incl.h6
-rwxr-xr-xsrc/logd.cpp192
-rwxr-xr-xsrc/logd.h39
-rwxr-xr-xsrc/main.cpp186
-rw-r--r--src/maps/hashmap.h24
-rw-r--r--src/maps/hashmap.tmpl24
-rw-r--r--src/maps/mtools.h6
-rw-r--r--src/maps/mtools.tmpl5
-rw-r--r--src/maps/nhashmap.h24
-rw-r--r--src/maps/nhashmap.tmpl24
-rw-r--r--src/maps/shashmap.h24
-rw-r--r--src/maps/shashmap.tmpl24
-rwxr-xr-xsrc/modl.cpp166
-rwxr-xr-xsrc/modl.h34
-rwxr-xr-xsrc/mods/Makefile9
-rwxr-xr-xsrc/mods/commands/Makefile.in2
-rw-r--r--src/mods/commands/yc_about.cpp74
-rwxr-xr-xsrc/mods/commands/yc_all.cpp77
-rwxr-xr-xsrc/mods/commands/yc_away.cpp114
-rwxr-xr-xsrc/mods/commands/yc_col.cpp127
-rwxr-xr-xsrc/mods/commands/yc_compopt.cpp21
-rwxr-xr-xsrc/mods/commands/yc_exec.cpp84
-rwxr-xr-xsrc/mods/commands/yc_fake.cpp41
-rwxr-xr-xsrc/mods/commands/yc_getroom.cpp70
-rwxr-xr-xsrc/mods/commands/yc_getrusage.cpp67
-rwxr-xr-xsrc/mods/commands/yc_help.cpp79
-rwxr-xr-xsrc/mods/commands/yc_invisible.cpp43
-rwxr-xr-xsrc/mods/commands/yc_j.cpp181
-rwxr-xr-xsrc/mods/commands/yc_ko.cpp90
-rwxr-xr-xsrc/mods/commands/yc_m.cpp64
-rwxr-xr-xsrc/mods/commands/yc_md5.cpp82
-rwxr-xr-xsrc/mods/commands/yc_me.cpp65
-rwxr-xr-xsrc/mods/commands/yc_morph.cpp77
-rwxr-xr-xsrc/mods/commands/yc_msg.cpp103
-rwxr-xr-xsrc/mods/commands/yc_q.cpp27
-rwxr-xr-xsrc/mods/commands/yc_reload.cpp29
-rwxr-xr-xsrc/mods/commands/yc_ren.cpp108
-rwxr-xr-xsrc/mods/commands/yc_s.cpp76
-rwxr-xr-xsrc/mods/commands/yc_set.cpp175
-rwxr-xr-xsrc/mods/commands/yc_template.cpp25
-rwxr-xr-xsrc/mods/commands/yc_time.cpp27
-rwxr-xr-xsrc/mods/commands/yc_topic.cpp134
-rwxr-xr-xsrc/mods/commands/yc_uptime.cpp27
-rwxr-xr-xsrc/mods/commands/yc_users.cpp31
-rwxr-xr-xsrc/mods/commands/yc_version.cpp21
-rwxr-xr-xsrc/mods/html/Makefile.in4
-rw-r--r--src/mods/html/yc_admin.cpp117
-rwxr-xr-xsrc/mods/html/yc_colors.cpp50
-rwxr-xr-xsrc/mods/html/yc_help.cpp74
-rwxr-xr-xsrc/mods/html/yc_loggedin.cpp31
-rwxr-xr-xsrc/mods/html/yc_options.cpp79
-rwxr-xr-xsrc/mods/html/yc_register.cpp145
-rw-r--r--src/monitor/dump.cpp24
-rw-r--r--src/monitor/dump.h24
-rw-r--r--src/monitor/stats.cpp24
-rw-r--r--src/monitor/stats.h24
-rwxr-xr-x[-rw-r--r--]src/msgs.h57
-rwxr-xr-xsrc/name.cpp34
-rwxr-xr-xsrc/name.h20
-rwxr-xr-xsrc/ncur/menu.cpp149
-rwxr-xr-xsrc/ncur/menu.h27
-rwxr-xr-xsrc/ncur/ncur.cpp372
-rwxr-xr-xsrc/ncur/ncur.h51
-rwxr-xr-xsrc/reqp.cpp546
-rwxr-xr-xsrc/reqp.h62
-rw-r--r--src/sign.cpp24
-rw-r--r--src/sign.h24
-rwxr-xr-xsrc/sock/sock.cpp593
-rwxr-xr-xsrc/sock/sock.h103
-rwxr-xr-xsrc/thrd/pool.cpp257
-rwxr-xr-xsrc/thrd/pool.h82
-rw-r--r--src/thrd/thro.cpp24
-rw-r--r--src/thrd/thro.h26
-rwxr-xr-xsrc/time/timo.cpp24
-rwxr-xr-xsrc/time/timo.h12
-rwxr-xr-xsrc/time/timr.cpp202
-rwxr-xr-xsrc/time/timr.h81
-rw-r--r--src/tool/dir.cpp44
-rw-r--r--src/tool/dir.h26
-rw-r--r--src/tool/tool.cpp251
-rw-r--r--src/tool/tool.h96
-rwxr-xr-xsrc/wrap.cpp137
-rwxr-xr-xsrc/wrap.h126
122 files changed, 9809 insertions, 8867 deletions
diff --git a/src/chat/base.h b/src/chat/base.h
index ae2e926..b995c5c 100755
--- a/src/chat/base.h
+++ b/src/chat/base.h
@@ -1,89 +1,93 @@
-// template class data declaration;
#include "../incl.h"
#ifndef BASE_H
#define BASE_H
-#include "../maps/smap.h"
+#include <map>
+#include "../maps/nhashmap.h"
template<class type>
-class base : public smap<type*,string>
+class base : public nhashmap<type*>
{
+protected:
+ void dumpit();
+
public:
- base();
- ~base();
-
- static string to_lower( string s )
- {
- string s_tmp("");
- for(int i=0;i < s.size() ;i++)
- s_tmp=s_tmp+(char)tolower(s.at(i));
- return s_tmp;
- }
-
- virtual type* get_elem( string s_name, bool &b_found ); // get a element.
- virtual void add_elem( type* p_type ); // add a element.
-
- // chat::msg_post sends to all users of the system a message.
- // room::msg_post sends to all users of the room a message.
- // user::msg_post sends to the user a message.
- virtual void msg_post( string *s_msg )
- {
- smap<type*,string>::run_func( &base<type>::msg_post_ , (void*)s_msg );
- }
-
- static void msg_post_( type* type_obj, void* v_arg )
- {
- type_obj -> msg_post( (string*) v_arg );
- }
-
- virtual void check_timeout( int* i_timeout_settings )
- {
- smap<type*,string>::run_func( &base<type>::check_timeout_ , (void*)i_timeout_settings );
- }
-
- static void check_timeout_( type* type_obj, void* v_arg )
- {
- type_obj -> check_timeout( (int*) v_arg );
- }
-
- virtual void reconf()
- {
- smap<type*,string>::run_func( &base<type>::reconf_ );
- }
-
- static void reconf_ ( type* type_obj )
- {
- type_obj -> reconf ();
- }
-
- void get_data( map_string *p_map_string )
- {
- smap<type*,string>::run_func( &base<type>::get_data_ , (void*)p_map_string );
- }
-
- static void get_data_( type* type_obj, void* v_arg )
- {
- type_obj -> get_data ( (map_string*) v_arg );
- }
-
-
- // chat::get_user_list gets a list of all users of the system.
- // room::get_user_list gets a list of all users of the room.
- // user::get_user_list gets a "list" of a user <font color="usercolor">username</font>seperator
- void get_user_list( string &s_list )
- {
- container c;
- c.elem[0] = (void*) &s_list;
-
- smap<type*,string>::run_func( &base<type>::get_user_list_, (void*)&c );
- }
-
- static void get_user_list_( type* type_obj, void* v_arg )
- {
- container *c = (container*) v_arg;
- type_obj -> get_user_list( *((string*)c->elem[0]) );
- }
+ base();
+ ~base();
+
+ static string to_lower( string s )
+ {
+ string s_tmp("");
+ for(int i=0;i < s.size() ;i++)
+ s_tmp=s_tmp+(char)tolower(s.at(i));
+ return s_tmp;
+ }
+
+ 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.
+ // room::msg_post sends to all users of the room a message.
+ // user::msg_post sends to the user a message.
+ virtual void msg_post( string *s_msg )
+ {
+ nhashmap<type*>::run_func( &base<type>::msg_post_ , (void*)s_msg );
+ }
+
+ static void msg_post_( type* type_obj, void* v_arg )
+ {
+ type_obj -> msg_post( (string*) v_arg );
+ }
+
+ virtual void check_timeout( int* i_timeout_settings )
+ {
+ nhashmap<type*>::run_func( &base<type>::check_timeout_ , (void*)i_timeout_settings );
+ }
+
+ static void check_timeout_( type* type_obj, void* v_arg )
+ {
+ type_obj -> check_timeout( (int*) v_arg );
+ }
+
+ virtual void reconf()
+ {
+ nhashmap<type*>::run_func( &base<type>::reconf_ );
+ }
+
+ static void reconf_ ( type* type_obj )
+ {
+ type_obj -> reconf ();
+ }
+
+ void get_data( map<string,string> *p_map_string )
+ {
+ nhashmap<type*>::run_func( &base<type>::get_data_ , (void*)p_map_string );
+ }
+
+ static void get_data_( type* type_obj, void* v_arg )
+ {
+ type_obj -> get_data ( (map<string,string>*) v_arg );
+ }
+
+
+ // chat::get_user_list gets a list of all users of the system.
+ // room::get_user_list gets a list of all users of the room.
+ // user::get_user_list gets a "list" of a user <font color="usercolor">username</font>seperator
+ void get_user_list( string &s_list )
+ {
+ container c;
+ c.elem[0] = (void*) &s_list;
+
+ nhashmap<type*>::run_func( &base<type>::get_user_list_, (void*)&c );
+ }
+
+ static void get_user_list_( type* type_obj, void* v_arg )
+ {
+ container *c = (container*) v_arg;
+ type_obj -> get_user_list( *((string*)c->elem[0]) );
+ }
};
#include "base.tmpl"
diff --git a/src/chat/base.tmpl b/src/chat/base.tmpl
index 53b609f..5b0fceb 100755
--- a/src/chat/base.tmpl
+++ b/src/chat/base.tmpl
@@ -4,30 +4,58 @@
#include "base.h"
template<class type>
-base<type>::base() : smap<type*,string>::smap(HMAPOCC)
-{
-}
+base<type>::base()
+{}
template<class type>
base<type>::~base( )
+{}
+
+template<class type>
+type*
+base<type>::get_elem( string s_name, bool &b_found )
{
+ s_name = to_lower(s_name);
+ type* p_type = nhashmap<type*>::get_elem( s_name );
+ b_found = p_type == NULL ? false : true;
+ return p_type;
}
template<class type>
type*
-base<type>::get_elem( string s_name, bool &b_found )
+base<type>::get_elem( string s_name)
{
- s_name = to_lower(s_name);
- type* p_type = smap<type*,string>::get_elem( s_name );
- b_found = p_type == NULL ? false : true;
- return p_type;
+ bool b;
+ return get_elem(s_name, b);
}
template<class type>
void
base<type>::add_elem( type* p_type )
{
- smap<type*,string>::add_elem(p_type, p_type->get_lowercase_name());
+ 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 56e9189..e4cbaac 100755
--- a/src/chat/chat.cpp
+++ b/src/chat/chat.cpp
@@ -6,310 +6,365 @@
#include "chat.h"
#include "../tool/tool.h"
#include "../maps/mtools.h"
+#include <list>
using namespace std;
chat::chat( )
{
- { // Set up replace strings;
- wrap::system_message(CHATREP);
- vector<string>* p_vec_keys = wrap::CONF->get_key_vector();
-
- for (vector<string>::iterator iter = p_vec_keys->begin();
- iter != p_vec_keys->end(); iter++ )
+ { // Set up replace strings;
+ wrap::system_message(CHATREP);
+ vector<string>* p_vec_keys = wrap::CONF->get_key_vector();
+
+ for (vector<string>::iterator iter = p_vec_keys->begin();
+ iter != p_vec_keys->end();
+ iter++ )
+ {
+ if ( iter->length() >= 24 && iter->compare( 0, 22, "chat.html.replace.from" ) == 0 )
{
- if ( iter->length() >= 24 && iter->compare( 0, 22, "chat.html.replace.from" ) == 0 )
- {
string s_from = wrap::CONF->get_elem(*iter);
map_replace_strings[s_from] = "chat.html.replace.into." + s_from;
- vec_replace_keys.push_back(s_from);
- }
- }
-
- sort(vec_replace_keys.begin(), vec_replace_keys.end());
- delete p_vec_keys;
+ vec_replace_keys.push_back(s_from);
+ }
}
+
+ sort(vec_replace_keys.begin(), vec_replace_keys.end());
+ delete p_vec_keys;
+ }
}
chat::~chat( )
{
- // Delete all room objects!
- run_func( mtools<room*>::delete_obj );
+ // Delete all room objects!
+ run_func( mtools<room*>::delete_obj );
}
user*
chat::get_user( string &s_user )
{
- bool b_flag;
- return get_user( s_user, b_flag );
+ bool b_flag;
+ return get_user( s_user, b_flag