summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/base.cpp92
-rw-r--r--src/base.h94
-rw-r--r--src/chat.cpp179
-rw-r--r--src/chat.h69
-rw-r--r--src/chat/base.tmpl4
-rw-r--r--src/chat/chat.cpp4
-rw-r--r--src/chat/chat.h18
-rw-r--r--src/chat/gcol.cpp9
-rw-r--r--src/chat/gcol.h5
-rw-r--r--src/chat/room.h4
-rw-r--r--src/chat/sess.cpp14
-rw-r--r--src/chat/sess.h2
-rw-r--r--src/chat/sman.cpp25
-rw-r--r--src/chat/sman.h6
-rw-r--r--src/chat/user.cpp24
-rw-r--r--src/chat/user.h15
-rw-r--r--src/cli/cli.cpp27
-rw-r--r--src/cli/cli.h21
-rw-r--r--src/conf.cpp99
-rw-r--r--src/conf.h47
-rw-r--r--src/conf/conf.cpp6
-rw-r--r--src/conf/conf.h2
-rw-r--r--src/config.h.in82
-rwxr-xr-xsrc/configure254
-rw-r--r--src/configure.ac93
-rw-r--r--src/cont.cpp47
-rw-r--r--src/cont.h52
-rw-r--r--src/data/data_base.cpp18
-rw-r--r--src/data/data_base.h5
-rw-r--r--src/glob.h72
-rw-r--r--src/hmap.cpp206
-rw-r--r--src/hmap.h146
-rw-r--r--src/html.cpp18
-rw-r--r--src/html.h5
-rw-r--r--src/incl.h4
-rw-r--r--src/lang.cpp102
-rw-r--r--src/lang.h47
-rw-r--r--src/logd.cpp2
-rw-r--r--src/main.cpp6
-rw-r--r--src/maps/hashmap.h14
-rw-r--r--src/maps/nhashmap.h8
-rw-r--r--src/maps/shashmap.h12
-rw-r--r--src/memb/memb.h93
-rw-r--r--src/memb/memb.tmpl104
-rw-r--r--src/modl.cpp26
-rw-r--r--src/modl.h5
-rw-r--r--src/mods/Makefile12
-rw-r--r--src/mods/Makefile.mods.in19
-rw-r--r--src/mods/commands/Makefile.in18
-rw-r--r--src/mods/commands/yc_ban.cpp107
-rw-r--r--src/mods/commands/yc_banned.cpp65
-rw-r--r--src/mods/commands/yc_debug.cpp67
-rw-r--r--src/mods/commands/yc_gag.cpp92
-rw-r--r--src/mods/commands/yc_help.cpp1
-rw-r--r--src/mods/commands/yc_q.cpp2
-rw-r--r--src/mods/commands/yc_ren.cpp2
-rw-r--r--src/mods/commands/yc_template.cpp (renamed from src/thrd/thro.cpp)52
-rw-r--r--src/mods/commands/yc_unban.cpp73
-rw-r--r--src/mods/commands/yc_ungag.cpp92
-rwxr-xr-xsrc/mods/configure40
-rw-r--r--src/mods/html/Makefile.in18
-rw-r--r--src/monitor/dump.cpp24
-rw-r--r--src/monitor/dump.h8
-rw-r--r--src/monitor/stats.cpp11
-rw-r--r--src/monitor/stats.h6
-rw-r--r--src/msgs.h25
-rw-r--r--src/mutx.cpp43
-rw-r--r--src/mutx.h44
-rw-r--r--src/ncur/menu.cpp141
-rw-r--r--src/ncur/menu.h63
-rw-r--r--src/ncur/ncur.cpp314
-rw-r--r--src/ncur/ncur.h75
-rw-r--r--src/pool.cpp203
-rw-r--r--src/pool.h75
-rw-r--r--src/room.cpp (renamed from src/build.h)27
-rw-r--r--src/room.h57
-rw-r--r--src/s_chat.cpp33
-rw-r--r--src/s_chat.h (renamed from src/thrd/thro.h)42
-rw-r--r--src/s_conf.cpp33
-rw-r--r--src/s_conf.h50
-rw-r--r--src/s_html.cpp33
-rw-r--r--src/s_html.h50
-rw-r--r--src/s_lang.cpp33
-rw-r--r--src/s_lang.h51
-rw-r--r--src/s_mutx.cpp33
-rw-r--r--src/s_mutx.h50
-rw-r--r--src/s_sman.cpp33
-rw-r--r--src/s_sman.h50
-rw-r--r--src/s_sock.cpp33
-rw-r--r--src/s_sock.h50
-rw-r--r--src/s_tool.cpp162
-rw-r--r--src/s_tool.h44
-rw-r--r--src/sess.cpp (renamed from src/memb/tupel.tmpl)57
-rw-r--r--src/sess.h51
-rw-r--r--src/sman.cpp80
-rw-r--r--src/sman.h59
-rw-r--r--src/sock.cpp263
-rw-r--r--src/sock.h80
-rw-r--r--src/sock/sock.cpp2
-rw-r--r--src/sock/sock.h2
-rw-r--r--src/sock/sslsock.cpp165
-rw-r--r--src/sock/sslsock.h65
-rw-r--r--src/thrd.cpp52
-rw-r--r--src/thrd.h (renamed from src/memb/tupel.h)36
-rw-r--r--src/time/timo.h2
-rw-r--r--src/time/timr.cpp26
-rw-r--r--src/time/timr.h5
-rw-r--r--src/tool/tool.cpp3
-rw-r--r--src/user.cpp167
-rw-r--r--src/user.h125
-rw-r--r--src/wrap.cpp8
-rw-r--r--src/wrap.h19
112 files changed, 4569 insertions, 1441 deletions
diff --git a/src/base.cpp b/src/base.cpp
new file mode 100644
index 0000000..68ccd80
--- /dev/null
+++ b/src/base.cpp
@@ -0,0 +1,92 @@
+/*:*
+ *: File: ./src/base.cpp
+ *:
+ *: yChat; Homepage: www.yChat.org; Version 0.5.6-BASIC
+ *:
+ *: Copyright (C) 2003, 2004 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+/*
+ This file is part of yChat
+
+ $Author: buetow $
+ $Date: 2005-11-12 15:51:43 $
+
+ $Header: /cvs/cvsroot/ychat-0.5/src/base.cpp,v 1.4 2005-11-12 15:51:43 buetow Exp $
+*/
+// template class data implementation;
+
+#ifndef BASE_CPP
+#define BASE_CPP
+
+#include "base.h"
+
+template<class type>
+base<type>::base()
+{
+ map_elem = new hmap<type*,string>(80);
+ pthread_mutex_init (&mut_map_elem, NULL );
+}
+
+template<class type>
+base<type>::~base( )
+{
+ pthread_mutex_destroy( &mut_map_elem );
+}
+
+template<class type>
+void
+base<type>::add_elem( type* p_type )
+{
+ pthread_mutex_lock ( &mut_map_elem );
+ map_elem->add_elem ( p_type, p_type->get_name());
+ pthread_mutex_unlock( &mut_map_elem );
+}
+
+template<class type>
+void
+base<type>::del_elem( string &s_name )
+{
+ pthread_mutex_lock ( &mut_map_elem );
+ map_elem->del_elem ( s_name );
+ pthread_mutex_unlock( &mut_map_elem );
+}
+
+template<class type>
+type*
+base<type>::get_elem( string &s_name, bool &b_found )
+{
+ pthread_mutex_lock ( &mut_map_elem );
+ type* p_type = map_elem->get_elem( s_name );
+ pthread_mutex_unlock( &mut_map_elem );
+
+ b_found = p_type == NULL ? false : true;
+
+ return p_type;
+}
+
+template<class type>
+void
+base<type>::run_func( void (*func)(type*, void*), void* v_arg )
+{
+ pthread_mutex_lock ( &mut_map_elem );
+ map_elem->run_func( func, v_arg );
+ pthread_mutex_unlock( &mut_map_elem );
+}
+
+#endif
diff --git a/src/base.h b/src/base.h
new file mode 100644
index 0000000..300c916
--- /dev/null
+++ b/src/base.h
@@ -0,0 +1,94 @@
+/*:*
+ *: File: ./src/base.h
+ *:
+ *: yChat; Homepage: www.yChat.org; Version 0.5.6-BASIC
+ *:
+ *: Copyright (C) 2003, 2004 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+// template class data declaration;
+
+#ifndef BASE_H
+#define BASE_H
+
+#include "incl.h"
+#include "hmap.h"
+
+template<class type>
+class base
+{
+private:
+ hmap<type*,string>* map_elem;
+ pthread_mutex_t mut_map_elem;
+
+public:
+ base();
+ ~base();
+
+ virtual void add_elem( type* p_type ); // add a element.
+ virtual void del_elem( string &s_name ); // delete a alement.
+ virtual type* get_elem( string &s_name, bool &b_found ); // get a element.
+
+ // execute func on all elements of map_elem. v_pointer is the argument.
+ virtual void run_func( void (*func)(type*, void*), void* v_arg );
+
+ // chat::msg_post sends to all users of the system a message.
+ // room::msg_post sends to all users of the room a message.
+ // user::msg_post sends to the user a message.
+ void msg_post( string *s_msg )
+ {
+ run_func( &base<type>::msg_post_ , (void*)s_msg );
+ }
+ static void msg_post_( type* type_obj, void* v_arg )
+ {
+ string *p_msg = (string*) v_arg;
+ type_obj -> msg_post( p_msg );
+ }
+
+ void get_data( map_string *p_map_string )
+ {
+ run_func( &base<type>::get_data_ , (void*)p_map_string );
+ }
+ static void get_data_( type* type_obj, void* v_arg )
+ {
+ map_string *map_params = (map_string*) v_arg;
+ type_obj -> get_data ( map_params );
+ }
+
+ // chat::get_user_list gets a list of all users of the system.
+ // room::get_user_list gets a list of all users of the room.
+ // user::get_user_list gets a "list" of a user <font color="usercolor">username</font>seperator
+ void get_user_list( string &s_list, string &s_seperator )
+ {
+
+ container c;
+ c.elem[0] = (void*) &s_list;
+ c.elem[1] = (void*) &s_seperator;
+
+ 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]), *((string*)c->elem[1]) );
+ }
+};
+
+#include "base.cpp"
+
+#endif
diff --git a/src/chat.cpp b/src/chat.cpp
new file mode 100644
index 0000000..8fd60e7
--- /dev/null
+++ b/src/chat.cpp
@@ -0,0 +1,179 @@
+/*:*
+ *: File: ./src/chat.cpp
+ *:
+ *: yChat; Homepage: www.yChat.org; Version 0.5.6-BASIC
+ *:
+ *: Copyright (C) 2003, 2004 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+// class chat implementation.
+
+#ifndef s_chat_CXX
+#define s_chat_CXX
+
+#include "chat.h"
+#include "s_conf.h"
+#include "s_mutx.h"
+#include "s_tool.h"
+
+using namespace std;
+
+chat::chat( )
+{
+ if ( s_conf::get
+ ().get_val( "HTML" ) == "OFF" )
+ b_strip_html = true;
+ else
+ b_strip_html = false;
+
+}
+
+chat::~chat( )
+{}
+
+user*
+chat::get_user( string &s_user )
+{
+ bool b_flag;
+ return get_user( s_user, b_flag );
+}
+
+user*
+chat::get_user( string &s_user, bool &b_found )
+{
+ container param;
+
+ param.elem[0] = (void*) &s_user ;
+ param.elem[1] = (void*) &b_found;
+
+ b_found = false;
+
+ run_func( get_user_, (void*)&param );
+
+ if ( *( (bool*)param.elem[1] ) )
+ return (user*)param.elem[2];
+}
+
+void
+chat::get_user_( room *room_obj, void *v_arg )
+{
+ container* param = (container*) v_arg;
+ param->elem[2] = (void*)room_obj->get_elem( *((string*)param->elem[0]), *((bool*)param->elem[1]) );
+}
+
+void
+chat::login( map_string &map_params )
+{
+ string s_user = map_params["nick"];
+
+ // prove if nick is empty:
+ if ( s_user.empty() )
+ {
+ map_params["INFO"] = E_NONICK;
+ map_params["request"] = s_conf::get
+ ().get_val( "STARTMPL" ); // redirect to the startpage.
+ return;
+ }
+
+ // prove if the nick ist alphanumeric:
+ else if ( ! s_tool::is_alpha_numeric( s_user ) )
+ {
+ map_params["INFO"] = E_ALPNUM;
+ map_params["request"] = s_conf::get
+ ().get_val( "ST