diff options
| author | Paul Buetow <paul@buetow.org> | 2010-11-21 16:02:41 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2010-11-21 16:02:41 +0000 |
| commit | c155ee9e0f133aafff70984f5b09c45efc62ca5a (patch) | |
| tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /0.8/src/mods/html | |
| parent | 19f9940dc968afae01b54377ee23ec59069c9646 (diff) | |
moving stuff to branches
Diffstat (limited to '0.8/src/mods/html')
| -rw-r--r-- | 0.8/src/mods/html/Makefile | 25 | ||||
| -rw-r--r-- | 0.8/src/mods/html/yc_admin.cpp | 97 | ||||
| -rw-r--r-- | 0.8/src/mods/html/yc_colors.cpp | 62 | ||||
| -rw-r--r-- | 0.8/src/mods/html/yc_help.cpp | 75 | ||||
| -rw-r--r-- | 0.8/src/mods/html/yc_loggedin.cpp | 54 | ||||
| -rw-r--r-- | 0.8/src/mods/html/yc_options.cpp | 81 | ||||
| -rw-r--r-- | 0.8/src/mods/html/yc_register.cpp | 121 |
7 files changed, 0 insertions, 515 deletions
diff --git a/0.8/src/mods/html/Makefile b/0.8/src/mods/html/Makefile deleted file mode 100644 index c17d7f6..0000000 --- a/0.8/src/mods/html/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -SRCS=$(shell find ./ -name '*.cpp') -MODS=$(addprefix ../../../mods/html/, $(SRCS:.cpp=.so)) -CXX=g++ -CXXFLAGS=-fno-inline -fno-default-inline -g -O2 ${EFLAGS} -all: mods -${MODS}: - @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi - @${CXX} ${CXXGLAGS} -fPIC -shared -s -o $@ ` \ - echo $(notdir $@) | sed s/.so/.cpp/` - @echo "mods:html:`basename $@ | sed s/\.so// | sed s/yc_//` (` \ - du -hs $@ | awk '{ print $$1 }'`) " -infotext: - @echo "===> Compiling html modules" -mods: infotext ${MODS} - @echo "===> Num of html modules: `ls \ - ../../../mods/html/*.so | wc -l | sed 's/ //g;'`" -clean: - @echo "===> Cleaning html modules" - @if test -d ../../../mods/html; then rm -Rf ../../../mods/html; fi -../../../mods/html/./yc_admin.so: yc_admin.cpp -../../../mods/html/./yc_colors.so: yc_colors.cpp -../../../mods/html/./yc_help.so: yc_help.cpp -../../../mods/html/./yc_loggedin.so: yc_loggedin.cpp -../../../mods/html/./yc_options.so: yc_options.cpp -../../../mods/html/./yc_register.so: yc_register.cpp diff --git a/0.8/src/mods/html/yc_admin.cpp b/0.8/src/mods/html/yc_admin.cpp deleted file mode 100644 index a3a7f1f..0000000 --- a/0.8/src/mods/html/yc_admin.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/*:* - *: File: ./src/mods/html/yc_admin.cpp - *: - *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: Copyright (C) 2006, 2007 Paul C. Buetow - *: - *: 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" - -/* - gcc -shared -o yc_name.so yc_name.cpp -*/ - -using namespace std; - -extern "C" -{ - string replace_chars(string s_string) - { - s_string = tool::replace(s_string, "<", "<"); - s_string = tool::replace(s_string, ">", ">"); - 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/0.8/src/mods/html/yc_colors.cpp b/0.8/src/mods/html/yc_colors.cpp deleted file mode 100644 index dba0318..0000000 --- a/0.8/src/mods/html/yc_colors.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/*:* - *: File: ./src/mods/html/yc_colors.cpp - *: - *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: Copyright (C) 2006, 2007 Paul C. Buetow - *: - *: 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" - -/* - gcc -shared -o yc_name.so yc_name.cpp -*/ - -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; - } -} - diff --git a/0.8/src/mods/html/yc_help.cpp b/0.8/src/mods/html/yc_help.cpp deleted file mode 100644 index 970192e..0000000 --- a/0.8/src/mods/html/yc_help.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/*:* - *: File: ./src/mods/html/yc_help.cpp - *: - *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: Copyright (C) 2006, 2007 Paul C. Buetow - *: - *: 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" - -/* - gcc -shared -o yc_name.so yc_name.cpp -*/ - -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" ); - } - } - p_vec_keys_iter++; - } - return 0; - } -} - diff --git a/0.8/src/mods/html/yc_loggedin.cpp b/0.8/src/mods/html/yc_loggedin.cpp deleted file mode 100644 index a50993f..0000000 --- a/0.8/src/mods/html/yc_loggedin.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/*:* - *: File: ./src/mods/html/yc_loggedin.cpp - *: - *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: Copyright (C) 2006, 2007 Paul C. Buetow - *: - *: 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 "../../chat/chat.h" - -/* - gcc -shared -o yc_name.so yc_name.cpp -*/ - -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]; - chat* p_chat = (chat*) p_wrap->CHAT; - map<string,string>* p_map = (map<string,string>*) c->elem[1]; - - /* - string s_list; - p_chat->get_user_list(s_list); - (*p_map)["USERLIST"] = s_list; - */ - - p_chat->get_user_list((*p_map)["USERLIST"]); - - return 0; - } -} - diff --git a/0.8/src/mods/html/yc_options.cpp b/0.8/src/mods/html/yc_options.cpp deleted file mode 100644 index ec269c8..0000000 --- a/0.8/src/mods/html/yc_options.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/*:* - *: File: ./src/mods/html/yc_options.cpp - *: - *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: Copyright (C) 2006, 2007 Paul C. Buetow - *: - *: 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" - -/* - gcc -shared -o yc_name.so yc_name.cpp -*/ - -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 ) - { - 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" ) ); - } - else - { - p_email->append( p_user->get_email() ); - } - - return 0; - } -} - diff --git a/0.8/src/mods/html/yc_register.cpp b/0.8/src/mods/html/yc_register.cpp deleted file mode 100644 index c37ee02..0000000 --- a/0.8/src/mods/html/yc_register.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/*:* - *: File: ./src/mods/html/yc_register.cpp - *: - *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: Copyright (C) 2006, 2007 Paul C. Buetow - *: - *: 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" - -/* - gcc -shared -o yc_name.so yc_name.cpp -*/ - -using namespace std; - -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 - - } -} - |
