summaryrefslogtreecommitdiff
path: root/src/mods/html
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:41 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:41 +0200
commitae4e87df37ed8904de92c7cf2f3a11128cda2a21 (patch)
tree5333f2930165cc6e4083ce15154799626ddb3d03 /src/mods/html
parent9cd3ccffd5372dfde3af478e3f832f18db4be3f1 (diff)
tagging ychat-0.7.4.1ychat-0.7.4.1
Diffstat (limited to 'src/mods/html')
-rwxr-xr-xsrc/mods/html/Makefile.in18
-rw-r--r--src/mods/html/yc_admin.cpp143
-rwxr-xr-x[-rw-r--r--]src/mods/html/yc_colors.cpp76
-rwxr-xr-x[-rw-r--r--]src/mods/html/yc_help.cpp100
-rwxr-xr-x[-rw-r--r--]src/mods/html/yc_options.cpp103
-rwxr-xr-x[-rw-r--r--]src/mods/html/yc_register.cpp189
6 files changed, 258 insertions, 371 deletions
diff --git a/src/mods/html/Makefile.in b/src/mods/html/Makefile.in
new file mode 100755
index 0000000..30f1782
--- /dev/null
+++ b/src/mods/html/Makefile.in
@@ -0,0 +1,18 @@
+MODS=$(addprefix ../../../mods/html/, $(SRCS:.cpp=.so))
+CC=COMPILER
+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/`
+ @du -hc $@ | tail -n 1 | sed s/total// | sed "s/ //g"
+infotext:
+ @echo Compiling html modules
+mods: infotext $(MODS)
+ @echo "Num of html modules: "
+ @ls ../../../mods/html/*.so | wc -l
+clean:
+ @echo Cleaning html modules
+ @if test -d ../../../mods/html; then rm -Rf ../../../mods/html; fi
diff --git a/src/mods/html/yc_admin.cpp b/src/mods/html/yc_admin.cpp
index bdf1694..b6b979e 100644
--- a/src/mods/html/yc_admin.cpp
+++ b/src/mods/html/yc_admin.cpp
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/mods/html/yc_admin.cpp
- *:
- *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: 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.
- *:*/
-
#include "../../incl.h"
#include "../../tool/tool.h"
@@ -31,66 +7,63 @@
using namespace std;
-extern "C"
-{
- string replace_chars(string s_string)
- {
- s_string = tool::replace(s_string, "<", "&lt;");
- s_string = tool::replace(s_string, ">", "&gt;");
- s_string = tool::replace(s_string, "\n", "<br>");
- return s_string;
- }
-
- int extern_function(void *v_arg)
- {
- container* c = (container*) v_arg;
- dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0];
- user* p_user = (user*) c->elem[2];
- conf* p_conf = (conf*) p_wrap->CONF;
- string* p_content = &(*((map<string,string>*) c->elem[1]))["content"];
-
- vector<string>* p_vec_keys = p_conf->get_key_vector();
- sort(p_vec_keys->begin(), p_vec_keys->end());
- vector<string>::iterator p_vec_keys_iter = p_vec_keys->begin();
-
- p_content->append( "Currently are " + tool::int2string(p_vec_keys->size()) + " options available!<br><br>\n");
- p_content->append( "<table bordercolor=\"1\">\n" );
-
- for( ;p_vec_keys_iter != p_vec_keys->end(); ++p_vec_keys_iter )
- {
-
- if ( p_vec_keys_iter->find(".descr") != string::npos )
- continue;
-
- p_content->append( "<tr><td>\n<font color=\"#FFFFFF\"><b>" + *p_vec_keys_iter + "\n</b></font></td></tr>\n" );
-
- string s_descr = p_conf->get_elem(*p_vec_keys_iter + ".descr");
- if ( s_descr.length()
- > 0 )
- {
- p_content->append( "<tr><td><font color=\"#CCCCCC\">\n" );
- p_content->append( replace_chars(p_conf->get_elem(*p_vec_keys_iter + ".descr")) );
- p_content->append( "\n</font></td></tr>\n" );
- }
-
- p_content->append( "<tr><td>\n" );
-
- // Hide some fields!
- if ( p_vec_keys_iter->find(".password")
- != string::npos
- || p_vec_keys_iter->find("base.user") != string::npos
- || p_vec_keys_iter->find(".dbname") != string::npos )
- p_content->append( "X X X X X X X X X X" );
-
- else
- p_content->append( replace_chars(p_conf->get_elem(*p_vec_keys_iter)) );
-
- p_content->append( "<br><br></td></tr>\n" );
- } // while
-
- p_content->append( "</table>\n<br>\n" );
-
- return 0;
- }
+extern "C" {
+ string replace_chars(string s_string) {
+ s_string = tool::replace(s_string, "<", "&lt;");
+ s_string = tool::replace(s_string, ">", "&gt;");
+ s_string = tool::replace(s_string, "\n", "<br>");
+ return s_string;
+ }
+
+ int extern_function(void *v_arg)
+ {
+ container* c = (container*) v_arg;
+ dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0];
+ user* p_user = (user*) c->elem[2];
+ conf* p_conf = (conf*) p_wrap->CONF;
+ string* p_content = &(*((map<string,string>*) c->elem[1]))["content"];
+
+ vector<string>* p_vec_keys = p_conf->get_key_vector();
+ sort(p_vec_keys->begin(), p_vec_keys->end());
+ vector<string>::iterator p_vec_keys_iter = p_vec_keys->begin();
+
+
+ p_content->append( "Currently are " + tool::int2string(p_vec_keys->size()) + " options available!<br><br>\n");
+
+ p_content->append( "<table bordercolor=\"1\">\n" );
+
+ for( ;p_vec_keys_iter != p_vec_keys->end(); ++p_vec_keys_iter ) {
+
+ if ( p_vec_keys_iter->find(".descr") != string::npos )
+ continue;
+
+ p_content->append( "<tr><td>\n<font color=\"#FFFFFF\"><b>" + *p_vec_keys_iter + "\n</b></font></td></tr>\n" );
+
+ string s_descr = p_conf->get_elem(*p_vec_keys_iter + ".descr");
+ if ( s_descr.length() > 0 )
+ {
+ p_content->append( "<tr><td><font color=\"#CCCCCC\">\n" );
+ p_content->append( replace_chars(p_conf->get_elem(*p_vec_keys_iter + ".descr")) );
+ p_content->append( "\n</font></td></tr>\n" );
+ }
+
+ p_content->append( "<tr><td>\n" );
+
+ // Hide some fields!
+ if ( p_vec_keys_iter->find(".password") != string::npos
+ || p_vec_keys_iter->find("base.user") != string::npos
+ || p_vec_keys_iter->find(".dbname") != string::npos )
+ p_content->append( "X X X X X X X X X X" );
+
+ else
+ p_content->append( replace_chars(p_conf->get_elem(*p_vec_keys_iter)) );
+
+ p_content->append( "<br><br></td></tr>\n" );
+ } // while
+
+ p_content->append( "</table>\n<br>\n" );
+
+ return 0;
+ }
}
diff --git a/src/mods/html/yc_colors.cpp b/src/mods/html/yc_colors.cpp
index be87942..6d2c5ab 100644..100755
--- a/src/mods/html/yc_colors.cpp
+++ b/src/mods/html/yc_colors.cpp
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/mods/html/yc_colors.cpp
- *:
- *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: 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.
- *:*/
-
#include "../../incl.h"
/*
@@ -30,32 +6,30 @@
using namespace std;
-extern "C"
-{
- int extern_function(void *v_arg)
- {
- container* c = (container*) v_arg;
- dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0];
- conf* p_conf = (conf*) p_wrap->CONF;
- string* p_col1 = &(*((map<string,string>*) c->elem[1]))["col1"];
- string* p_col2 = &(*((map<string,string>*) c->elem[1]))["col2"];
- string* p_flag = &(*((map<string,string>*) c->elem[1]))["flag"];
- user* p_user = (user*) c->elem[2];
-
- p_col1->erase(0);
- p_col2->erase(0);
-
- p_col1->append( p_user->get_col1() );
- p_col2->append( p_user->get_col2() );
-
- if ( *p_flag == "submit" )
- {
- string* p_msgs = &(*((map<string,string>*) c->elem[1])
- )["msgs"];
- p_msgs->append( p_conf->get_elem( "chat.msgs.optionschanged" ) );
- }
-
- return 0;
- }
+extern "C" {
+ int extern_function(void *v_arg)
+ {
+ container* c = (container*) v_arg;
+ dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0];
+ conf* p_conf = (conf*) p_wrap->CONF;
+ string* p_col1 = &(*((map<string,string>*) c->elem[1]))["col1"];
+ string* p_col2 = &(*((map<string,string>*) c->elem[1]))["col2"];
+ string* p_flag = &(*((map<string,string>*) c->elem[1]))["flag"];
+ user* p_user = (user*) c->elem[2];
+
+ p_col1->erase(0);
+ p_col2->erase(0);
+
+ p_col1->append( p_user->get_col1() );
+ p_col2->append( p_user->get_col2() );
+
+ if ( *p_flag == "submit" )
+ {
+ string* p_msgs = &(*((map<string,string>*) c->elem[1]))["msgs"];
+ p_msgs->append( p_conf->get_elem( "chat.msgs.optionschanged" ) );
+ }
+
+ return 0;
+ }
}
diff --git a/src/mods/html/yc_help.cpp b/src/mods/html/yc_help.cpp
index 8b548e5..4d6db03 100644..100755
--- a/src/mods/html/yc_help.cpp
+++ b/src/mods/html/yc_help.cpp
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/mods/html/yc_help.cpp
- *:
- *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: 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.
- *:*/
-
#include "../../incl.h"
/*
@@ -30,45 +6,43 @@
using namespace std;
-extern "C"
-{
- int extern_function(void *v_arg)
- {
- container* c = (container*) v_arg;
- dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0];
- user* p_user = (user*) c->elem[2];
-
- modl* p_modl = (modl*) p_wrap->MODL;
- conf* p_conf = (conf*) p_wrap->CONF;
- chat* p_chat = (chat*) p_wrap->CHAT;
- string* s_content = &(*((map<string,string>*) c->elem[1]))["content"];
-
- vector<string>* p_vec_keys = p_modl->get_mod_vector();
-
- sort(p_vec_keys->begin(), p_vec_keys->end());
- vector<string>::iterator p_vec_keys_iter = p_vec_keys->begin();
-
- while( p_vec_keys_iter != p_vec_keys->end() )
- {
-
- if ( p_vec_keys_iter->find( "mods/commands/", 0 ) != string::npos )
- {
-
- string s_command_name = p_vec_keys_iter->substr(17);
- s_command_name.erase( s_command_name.find( ".so" ) );
-
- if ( !p_chat->get_command_disabled( s_command_name ) &&
- p_chat->get_command_status( s_command_name ) >= p_user->get_status())
- {
- s_content->append( "<table bordercolor=\"1\">\n" );
- s_content->append( "<tr><td><font color=\"#FFFFFF\"><b>/" + s_command_name + "</b></font></td></tr>\n" );
- s_content->append( "<tr><td>" + p_conf->get_elem("chat.msgs.help." + s_command_name) + "</td></tr>\n" );
- s_content->append( "</table>\n<br>\n" );
+extern "C" {
+ int extern_function(void *v_arg)
+ {
+ container* c = (container*) v_arg;
+ dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0];
+ user* p_user = (user*) c->elem[2];
+ modl* p_modl = (modl*) p_wrap->MODL;
+ conf* p_conf = (conf*) p_wrap->CONF;
+ chat* p_chat = (chat*) p_wrap->CHAT;
+ string* s_content = &(*((map<string,string>*) c->elem[1]))["content"];
+
+ vector<string>* p_vec_keys = p_modl->get_mod_vector();
+
+ sort(p_vec_keys->begin(), p_vec_keys->end());
+ vector<string>::iterator p_vec_keys_iter = p_vec_keys->begin();
+
+ while( p_vec_keys_iter != p_vec_keys->end() ) {
+
+ if ( p_vec_keys_iter->find( "mods/commands/", 0 ) != string::npos )
+ {
+
+ string s_command_name = p_vec_keys_iter->substr(17);
+ s_command_name.erase( s_command_name.find( ".so" ) );
+
+ if ( !p_chat->get_command_disabled( s_command_name ) &&
+ p_chat->get_command_status( s_command_name ) >= p_user->get_status())
+ {
+ s_content->append( "<table bordercolor=\"1\">\n" );
+ s_content->append( "<tr><td><font color=\"#FFFFFF\"><b>/" + s_command_name + "</b></font></td></tr>\n" );
+ s_content->append( "<tr><td>" + p_conf->get_elem("chat.msgs.help." + s_command_name) + "</td></tr>\n" );
+ s_content->append( "</table>\n<br>\n" );
+ }
+ }
+ p_vec_keys_iter++;
}
- }
- p_vec_keys_iter++;
- }
- return 0;
- }
+
+ return 0;
+ }
}
diff --git a/src/mods/html/yc_options.cpp b/src/mods/html/yc_options.cpp
index 502fdfa..47c3153 100644..100755
--- a/src/mods/html/yc_options.cpp
+++ b/src/mods/html/yc_options.cpp
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/mods/html/yc_options.cpp
- *:
- *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: 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.
- *:*/
-
#include "../../incl.h"
/*
@@ -30,51 +6,50 @@
using namespace std;
-extern "C"
-{
- int extern_function(void *v_arg)
- {
- container* c = (container*) v_arg;
- dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0];
- conf* p_conf = (conf*) p_wrap->CONF;
- string* p_flag = &(*((map<string,string>*) c->elem[1]))["flag"];
- string* p_email = &(*((map<string,string>*) c->elem[1]))["email"];
- string* p_pass = &(*((map<string,string>*) c->elem[1]))["pass"];
- string* p_newpass = &(*((map<string,string>*) c->elem[1]))["newpass"];
- string* p_newpass2 = &(*((map<string,string>*) c->elem[1]))["newpass2"];
- user* p_user = (user*) c->elem[2];
-
- if ( *p_flag == "submit" )
- {
- string* p_msgs = &(*((map<string,string>*) c->elem[1])
- )["msgs"];
-
- // If the password has to be changed:
- if ( *p_pass != "" || *p_newpass != "" || *p_newpass2 != "" )
- {
- if ( p_user->get_pass() != *p_pass )
+extern "C" {
+ int extern_function(void *v_arg)
+ {
+ container* c = (container*) v_arg;
+ dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0];
+ conf* p_conf = (conf*) p_wrap->CONF;
+ string* p_flag = &(*((map<string,string>*) c->elem[1]))["flag"];
+ string* p_email = &(*((map<string,string>*) c->elem[1]))["email"];
+ string* p_pass = &(*((map<string,string>*) c->elem[1]))["pass"];
+ string* p_newpass = &(*((map<string,string>*) c->elem[1]))["newpass"];
+ string* p_newpass2 = &(*((map<string,string>*) c->elem[1]))["newpass2"];
+ user* p_user = (user*) c->elem[2];
+
+ if ( *p_flag == "submit" )
{
- p_msgs->append( p_conf->get_elem( "chat.msgs.err.changepassword" ) );
- return 0;
+ string* p_msgs = &(*((map<string,string>*) c->elem[1]))["msgs"];
+
+ // If the password has to be changed:
+ if ( *p_pass != "" || *p_newpass != "" || *p_newpass2 != "" )
+ {
+ if ( p_user->get_pass() != *p_pass )
+ {
+ p_msgs->append( p_conf->get_elem( "chat.msgs.err.changepassword" ) );
+ return 0;
+ }
+
+ if ( *p_newpass != *p_newpass2 )
+ {
+ p_msgs->append( p_conf->get_elem( "chat.msgs.err.changepassword2" ) );
+ return 0;
+ }
+ p_user->set_pass( *p_newpass );
+ }
+
+ p_user->set_email( *p_email );
+ p_msgs->append( p_conf->get_elem( "chat.msgs.optionschanged" ) );
}
- if ( *p_newpass != *p_newpass2 )
+ else
{
- p_msgs->append( p_conf->get_elem( "chat.msgs.err.changepassword2" ) );
- return 0;
+ p_email->append( p_user->get_email() );
}
- p_user->set_pass( *p_newpass );
- }
-
- p_user->set_email( *p_email );
- p_msgs->append( p_conf->get_elem( "chat.msgs.optionschanged" ) );
- }
- else
- {
- p_email->append( p_user->get_email() );
- }
- return 0;
- }
+ return 0;
+ }
}
diff --git a/src/mods/html/yc_register.cpp b/src/mods/html/yc_register.cpp
index 5ae000c..5d65b50 100644..100755
--- a/src/mods/html/yc_register.cpp
+++ b/src/mods/html/yc_register.cpp
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/mods/html/yc_register.cpp
- *:
- *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: 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.
- *:*/
-
#include "../../incl.h"
/*
@@ -30,91 +6,88 @@
using namespace std;
-extern "C"
-{
- int extern_function(void *v_arg)
- {
+extern "C" {
+ int extern_function(void *v_arg)
+ {
#ifdef DATABASE
- container* c = (container*) v_arg;
- dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0];
- conf* p_conf = (conf*) p_wrap->CONF;
- data* p_data = (data*) p_wrap->DATA;
- string* p_msgs = &(*((map<string,string>*) c->elem[1]))["INFO"];
- string* p_nick = &(*((map<string,string>*) c->elem[1]))["nick"];
- string* p_email = &(*((map<string,string>*) c->elem[1]))["email"];
- string* p_pass = &(*((map<string,string>*) c->elem[1]))["pass"];
- string* p_pass2 = &(*((map<string,string>*) c->elem[1]))["pass2"];
- string* p_request = &(*((map<string,string>*) c->elem[1]))["request"];
- user* p_user = (user*) c->elem[2];
- string s_nick = *p_nick;
-
-
- p_user->set_name( "!" + s_nick );
- p_user->set_has_sess( false );
- *p_nick = tool::to_lower(*p_nick);
-
- if ( *p_pass != *p_pass2 )
- {
- p_msgs->append( p_conf->get_elem( "chat.msgs.err.registerpassword" ) )
- ;
- }
-
- // prove if the nick is alphanumeric:
- else if ( ! tool::is_alpha_numeric( *p_nick ) )
- {
- p_msgs->append( p_conf->get_elem( "chat.msgs.err.alpnum" ) )
- ;
- }
-
- // prove if the nick is too long:
- else if ( p_nick->length() > tool::string2int( p_conf->get_elem("chat.maxlength.username")
- ) )
- {
- p_msgs->append( p_conf->get_elem( "chat.msgs.err.nicklength" ) );
- }
- else if ( p_pass->length() > tool::string2int( p_conf->get_elem("chat.maxlength.password")
- ) )
- {
- p_msgs->append( p_conf->get_elem( "chat.msgs.err.passlength" ) );
- }
- else if ( p_email->length() > tool::string2int( p_conf->get_elem("chat.maxlength.emailaddress")
- ) )
- {
- p_msgs->append( p_conf->get_elem( "chat.msgs.err.emaillength" ) );
- }
- else
- {
- hashmap<string> result_map = p_data->select_user_data( *p_nick, "selectnick" );
- if (result_map["nick"] == *p_nick)
- {
- p_msgs->append( p_conf->get_elem( "chat.msgs.err.registerexists" ) );
- }
- else
- {
- p_user->set_name( s_nick );
- p_msgs->append( p_conf->get_elem( "chat.msgs.registernick" ) );
- p_request->replace( 0, p_request->length(), p_conf->get_elem("httpd.startsite") );
-
- map<string,string> map_insert = *((map<string,string>*) c->elem[1]);
- map_insert["password"] = *p_pass;
- map_insert["color1"] = p_conf->get_elem("chat.html.user.color1");
- map_insert["color2"] = p_conf->get_elem("chat.html.user.color2");
- map_insert["registerdate"] = tool::int2string((int)tool::unixtime());
-
- p_user->set_pass( map_insert["password"] );
- p_user->set_email( map_insert["email"] );
- p_user->set_col1( map_insert["color1"] );
- p_user->set_col2( map_insert["color2"] );
- p_user->set_is_reg( 1 );
- p_user->set_status( tool::string2int(p_conf->get_elem("chat.defaultrang") ) );
-
- p_data->insert_user_data( *p_nick, "registernick", map_insert );
- }
- }
-
- return 0;
-#endif
+ container* c = (container*) v_arg;
+ dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0];
+ conf* p_conf = (conf*) p_wrap->CONF;
+ data* p_data = (data*) p_wrap->DATA;
+ string* p_msgs = &(*((map<string,string>*) c->elem[1]))["INFO"];
+ string* p_nick = &(*((map<string,string>*) c->elem[1]))["nick"];
+ string* p_email = &(*((map<string,string>*) c->elem[1]))["email"];
+ string* p_pass = &(*((map<string,string>*) c->elem[1]))["pass"];
+ string* p_pass2 = &(*((map<string,string>*) c->elem[1]))["pass2"];
+ string* p_request = &(*((map<string,string>*) c->elem[1]))["request"];
+ user* p_user = (user*) c->elem[2];
+ string s_nick = *p_nick;
+
+
+ p_user->set_name( "!" + s_nick );
+ p_user->set_has_sess( false );
+ *p_nick = tool::to_lower(*p_nick);
+
+ if ( *p_pass != *p_pass2 )
+ {
+ p_msgs->append( p_conf->get_elem( "chat.msgs.err.registerpassword" ) );
+ }
+
+ // prove if the nick is alphanumeric:
+ else if ( ! tool::is_alpha_numeric( *p_nick ) )
+ {
+ p_msgs->append( p_conf->get_elem( "chat.msgs.err.alpnum" ) );
+ }
+
+ // prove if the nick is too long:
+ else if ( p_nick->length() > tool::string2int( p_conf->get_elem("chat.maxlength.username") ) )
+ {
+ p_msgs->append( p_conf->get_elem( "chat.msgs.err.nicklength" ) );
+ }
- }
+ else if ( p_pass->length() > tool::string2int( p_conf->get_elem("chat.maxlength.password") ) )
+ {
+ p_msgs->append( p_conf->get_elem( "chat.msgs.err.passlength" ) );
+ }
+
+ else if ( p_email->length() > tool::string2int( p_conf->get_elem("chat.maxlength.emailaddress") ) )
+ {
+ p_msgs->append( p_conf->get_elem( "chat.msgs.err.emaillength" ) );
+ }
+
+ else
+ {
+ map<string,string> result_map = p_data->select_user_data( *p_nick, "selectnick" );
+ if (result_map["nick"] == *p_nick)
+ {
+ p_msgs->append( p_conf->get_elem( "chat.msgs.err.registerexists" ) );
+ }
+
+ else
+ {
+ p_user->set_name( s_nick );
+ p_msgs->append( p_conf->get_elem( "chat.msgs.registernick" ) );
+ p_request->replace( 0, p_request->length(), p_conf->get_elem("httpd.startsite") );
+
+ map<string,string> map_insert = *((map<string,string>*) c->elem[1]);
+ map_insert["password"] = *p_pass;
+ map_insert["color1"] = p_conf->get_elem("chat.html.user.color1");
+ map_insert["color2"] = p_conf->get_elem("chat.html.user.color2");
+ map_insert["registerdate"] = tool::int2string((int)tool::unixtime());
+
+ p_user->set_pass( map_insert["password"] );
+ p_user->set_email( map_insert["email"] );
+ p_user->set_col1( map_insert["color1"] );
+ p_user->set_col2( map_insert["color2"] );
+ p_user->set_is_reg( 1 );
+ p_user->set_status( tool::string2int(p_conf->get_elem("chat.defaultrang") ) );
+
+ p_data->insert_user_data( *p_nick, "registernick", map_insert );
+ }
+ }
+
+ return 0;
+#endif
+ }
}