From ae4e87df37ed8904de92c7cf2f3a11128cda2a21 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Apr 2013 13:14:41 +0200 Subject: tagging ychat-0.7.4.1 --- src/mods/commands/Makefile.in | 18 ++++ src/mods/commands/yc_about.cpp | 98 +++++++----------- src/mods/commands/yc_all.cpp | 101 +++++++----------- src/mods/commands/yc_away.cpp | 150 +++++++++++---------------- src/mods/commands/yc_col.cpp | 167 +++++++++++++----------------- src/mods/commands/yc_compopt.cpp | 45 ++------ src/mods/commands/yc_exec.cpp | 108 ++++++++------------ src/mods/commands/yc_fake.cpp | 67 ++++-------- src/mods/commands/yc_getroom.cpp | 94 +++++++---------- src/mods/commands/yc_getrusage.cpp | 93 +++++++---------- src/mods/commands/yc_help.cpp | 106 ++++++++----------- src/mods/commands/yc_invisible.cpp | 69 ++++--------- src/mods/commands/yc_j.cpp | 203 ++++++++++++++++--------------------- src/mods/commands/yc_ko.cpp | 112 ++++++++------------ src/mods/commands/yc_m.cpp | 89 ++++++---------- src/mods/commands/yc_md5.cpp | 108 ++++++++------------ src/mods/commands/yc_me.cpp | 77 +++++--------- src/mods/commands/yc_morph.cpp | 101 +++++++----------- src/mods/commands/yc_msg.cpp | 128 ++++++++++------------- src/mods/commands/yc_q.cpp | 51 +++------- src/mods/commands/yc_reload.cpp | 57 +++-------- src/mods/commands/yc_ren.cpp | 134 ++++++++++-------------- src/mods/commands/yc_s.cpp | 105 ++++++++----------- src/mods/commands/yc_set.cpp | 199 ++++++++++++++++-------------------- src/mods/commands/yc_template.cpp | 24 +++++ src/mods/commands/yc_time.cpp | 55 +++------- src/mods/commands/yc_topic.cpp | 162 +++++++++++++---------------- src/mods/commands/yc_uptime.cpp | 55 +++------- src/mods/commands/yc_version.cpp | 45 ++------ 29 files changed, 1099 insertions(+), 1722 deletions(-) create mode 100755 src/mods/commands/Makefile.in mode change 100644 => 100755 src/mods/commands/yc_all.cpp mode change 100644 => 100755 src/mods/commands/yc_away.cpp mode change 100644 => 100755 src/mods/commands/yc_col.cpp mode change 100644 => 100755 src/mods/commands/yc_compopt.cpp mode change 100644 => 100755 src/mods/commands/yc_exec.cpp mode change 100644 => 100755 src/mods/commands/yc_fake.cpp mode change 100644 => 100755 src/mods/commands/yc_getroom.cpp mode change 100644 => 100755 src/mods/commands/yc_getrusage.cpp mode change 100644 => 100755 src/mods/commands/yc_help.cpp mode change 100644 => 100755 src/mods/commands/yc_invisible.cpp mode change 100644 => 100755 src/mods/commands/yc_j.cpp mode change 100644 => 100755 src/mods/commands/yc_ko.cpp mode change 100644 => 100755 src/mods/commands/yc_m.cpp mode change 100644 => 100755 src/mods/commands/yc_md5.cpp mode change 100644 => 100755 src/mods/commands/yc_me.cpp mode change 100644 => 100755 src/mods/commands/yc_morph.cpp mode change 100644 => 100755 src/mods/commands/yc_msg.cpp mode change 100644 => 100755 src/mods/commands/yc_q.cpp mode change 100644 => 100755 src/mods/commands/yc_reload.cpp mode change 100644 => 100755 src/mods/commands/yc_ren.cpp mode change 100644 => 100755 src/mods/commands/yc_s.cpp mode change 100644 => 100755 src/mods/commands/yc_set.cpp create mode 100755 src/mods/commands/yc_template.cpp mode change 100644 => 100755 src/mods/commands/yc_time.cpp mode change 100644 => 100755 src/mods/commands/yc_topic.cpp mode change 100644 => 100755 src/mods/commands/yc_uptime.cpp mode change 100644 => 100755 src/mods/commands/yc_version.cpp (limited to 'src/mods/commands') diff --git a/src/mods/commands/Makefile.in b/src/mods/commands/Makefile.in new file mode 100755 index 0000000..ce8c00f --- /dev/null +++ b/src/mods/commands/Makefile.in @@ -0,0 +1,18 @@ +MODS=$(addprefix ../../../mods/commands/, $(SRCS:.cpp=.so)) +CC=COMPILER +INCLUDES=`cat ../../includes.add` +CFLAGS=`cat ../cflags.add` +all: mods +$(MODS): + @echo -n "Compiling command 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 command modules +mods: infotext $(MODS) + @echo "Num of command modules: " + @ls ../../../mods/commands/*.so | wc -l +clean: + @echo Cleaning command modules + @if test -d ../../../mods/commands; then rm -Rf ../../../mods/commands; fi diff --git a/src/mods/commands/yc_about.cpp b/src/mods/commands/yc_about.cpp index 5fedb6d..086e126 100644 --- a/src/mods/commands/yc_about.cpp +++ b/src/mods/commands/yc_about.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_about.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,54 +6,54 @@ using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params = (vector*) c->elem[2]; // param array - chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - - if ( ! params->empty() ) - { - vector::iterator iter = params->begin(); - string s_searched_user( *iter ); - bool b_found; - user* p_searched_user = p_chat->get_user( s_searched_user, b_found ); - - if ( b_found ) - { - string s_msg = "" + p_searched_user->get_colored_name() + "" +extern "C" { + int extern_function(void *v_arg) + { + + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + vector *params = (vector*) c->elem[2]; // param array + chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + + if ( ! params->empty() ) + { + vector::iterator iter = params->begin(); + string s_searched_user( *iter ); + bool b_found; + user* p_searched_user = p_chat->get_user( s_searched_user, b_found ); + + if ( b_found ) + { + string s_msg = "" + p_searched_user->get_colored_name() + "" + p_conf->get_elem("chat.msgs.userhasstatus") + "" + tool::int2string(p_searched_user->get_status()) - + ", " + + ", " + p_conf->get_elem("chat.msgs.userinroom") + "" - + p_searched_user->get_room()->get_name() - + "
\n" + + p_searched_user->get_room()->get_name() + + "
\n" + p_conf->get_elem("chat.msgs.lastactivity") + "" + tool::int2string((int)( p_searched_user->get_last_activity())) - + "
\n"; - p_user->msg_post( &s_msg ); - } - else - { - string s_msg = "
\n"; + p_user->msg_post( &s_msg ); + } + + else + { + string s_msg = "get_elem("chat.html.errorcolor") - + "\">" + + "\">" + s_searched_user + " " + p_conf->get_elem("chat.msgs.err.notavailable") + "
\n"; - p_user->msg_post( &s_msg ); + p_user->msg_post( &s_msg ); - } - } + } + } - return 0; - } + return 0; + } } diff --git a/src/mods/commands/yc_all.cpp b/src/mods/commands/yc_all.cpp old mode 100644 new mode 100755 index 4fae79d..c4c9cdf --- a/src/mods/commands/yc_all.cpp +++ b/src/mods/commands/yc_all.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_all.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 #include "../../chat/chat.h" /* @@ -30,44 +6,43 @@ using namespace std; -extern "C" -{ - int valid_color( string ); - - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params= (vector*) c->elem[2]; // param array - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; - - string s_tmp = ""; - string s_msg = ""; - - - if ( ! params->empty() ) - { - vector::iterator iter = params->begin(); - for ( iter = params->begin(); iter != params->end(); iter++ ) - s_tmp.append( *iter + " " ); - - s_msg = p_timr->get_time() + " get_elem("chat.html.sysmsgcolor") - + "\"> " - + p_conf->get_elem("chat.msgs.system"); - - p_chat->string_replacer(&s_tmp); - s_msg.append( s_tmp + "
\n" ); - p_chat->msg_post( &s_msg ); - return 0; - } - - s_msg = p_conf->colored_error_msg("chat.msgs.err.wrongcommandusage"); - p_user->msg_post(s_msg); - return 0; - } +extern "C" { + int valid_color( string ); + + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + vector *params= (vector*) c->elem[2]; // param array + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; + + string s_tmp = ""; + string s_msg = ""; + + + if ( ! params->empty() ) + { + vector::iterator iter = params->begin(); + for ( iter = params->begin(); iter != params->end(); iter++ ) + s_tmp.append( *iter + " " ); + + s_msg = p_timr->get_time() + " get_elem("chat.html.sysmsgcolor") + + "\"> " + + p_conf->get_elem("chat.msgs.system"); + + p_chat->string_replacer(&s_tmp); + s_msg.append( s_tmp + "
\n" ); + p_chat->msg_post( &s_msg ); + return 0; + } + + s_msg = p_conf->colored_error_msg("chat.msgs.err.wrongcommandusage"); + p_user->msg_post(s_msg); + return 0; + } } diff --git a/src/mods/commands/yc_away.cpp b/src/mods/commands/yc_away.cpp old mode 100644 new mode 100755 index b66b82c..af4a4a5 --- a/src/mods/commands/yc_away.cpp +++ b/src/mods/commands/yc_away.cpp @@ -1,96 +1,70 @@ -/*:* - *: File: ./src/mods/commands/yc_away.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 "../../chat/room.h" #include "../../chat/user.h" using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user* p_user = (user*) c->elem[1]; // the corresponding user - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - vector *params = (vector*) c->elem[2]; // param array - - string s_msg; - string s_away; - string s_col; - - vector::iterator iter; - - string s_time = p_timr->get_time(); - - s_away.append( s_time ).append( " " ); - - s_msg = s_time - + " " - + p_user->get_colored_bold_name() - + " " - + p_conf->get_elem("chat.msgs.setmodeaway") - + ""; - - if ( params->size() > 0 ) - { - s_msg.append(": "); - for ( iter = params->begin(); iter != params->end(); iter++ ) - { - s_msg.append( " " + *iter ); - s_away.append( *iter + " " ); - } - } - else - { - s_msg.append("."); - } - - s_msg.append( "
\n" ); - - room* p_room = p_user->get_room(); - - // Remove ' from away message: - auto unsigned int pos; - - do - { - pos = s_away.find_first_of( "'" ); - if ( pos == string::npos ) - break; - s_away.replace( pos, 1, "\"" ); - } - while (true); - - p_user->set_away( true, s_away ); - p_room->reload_onlineframe(); - p_room->msg_post ( &s_msg ); - - return 0; - } +extern "C" { + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user* p_user = (user*) c->elem[1]; // the corresponding user + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + vector *params = (vector*) c->elem[2]; // param array + + string s_msg; + string s_away; + string s_col; + + vector::iterator iter; + + string s_time = p_timr->get_time(); + + s_away.append( s_time ).append( " " ); + + s_msg = s_time + + " " + + p_user->get_colored_bold_name() + + " " + + p_conf->get_elem("chat.msgs.setmodeaway") + + ""; + + if ( params->size() > 0 ) + { + s_msg.append(": "); + for ( iter = params->begin(); iter != params->end(); iter++ ) + { + s_msg.append( " " + *iter ); + s_away.append( *iter + " " ); + } + } + + else + { + s_msg.append("."); + } + + s_msg.append( "
\n" ); + + room* p_room = p_user->get_room(); + + // Remove ' from away message: + auto unsigned int pos; + + do { + pos = s_away.find_first_of( "'" ); + if ( pos == string::npos ) + break; + s_away.replace( pos, 1, "\"" ); + } while (true); + + p_user->set_away( true, s_away ); + p_room->reload_onlineframe(); + p_room->msg_post ( &s_msg ); + + return 0; + } } diff --git a/src/mods/commands/yc_col.cpp b/src/mods/commands/yc_col.cpp old mode 100644 new mode 100755 index 11f93b6..4449278 --- a/src/mods/commands/yc_col.cpp +++ b/src/mods/commands/yc_col.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_col.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 #include "../../wrap.h" #include "../../chat/room.h" @@ -34,79 +10,76 @@ using namespace std; -extern "C" -{ - int valid_color( string ); - - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - - user *p_user = (user*)c->elem[1]; // the corresponding user - vector *params= (vector*) c->elem[2]; // param array - - string s_color; - string s_color2; - - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - if ( params->empty() ) - { - s_color = p_conf->get_elem( "chat.html.user.color1" ); - s_color2 = p_conf->get_elem( "chat.html.user.color2" ); - } - else - { - s_color = (string) params->front(); - params->erase( params->begin() ); - if ( ! params->empty() ) - s_color2 = (string) params->front(); - else - s_color2 = p_conf->get_elem( "chat.html.user.color1" ); - } - - s_color = tool::to_lower( s_color ); - s_color2 = tool::to_lower( s_color2 ); - - if( valid_color(s_color) != 1 ) - { - string *answerstring=new string(s_color + " is not a valid color.
\n"); - p_user->msg_post( answerstring ); - } - else if( valid_color(s_color2) != 1 ) - { - string *answerstring=new string( s_color2 + " is not a valid color.
\n"); - p_user->msg_post( answerstring ); - } - else - { - string *answerstring=new string(p_timr->get_time() + " " + p_user->get_colored_bold_name()+ " changes color to " + s_color + " " + s_color2 + "
\n"); - p_user->get_room()->msg_post( answerstring ); - p_user->set_col1(s_color); - p_user->set_col2(s_color2); - p_user->get_room()->reload_onlineframe(); - } - - return 0; - } - int valid_color( string s_color ) - { - - if(s_color.size()!=6) - return 0; - string valid="abcdef0123456789"; - for(int i=0;ielem[1]; // the corresponding user + vector *params= (vector*) c->elem[2]; // param array + + string s_color; + string s_color2; + + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + if ( params->empty() ) + { + s_color = p_conf->get_elem( "chat.html.user.color1" ); + s_color2 = p_conf->get_elem( "chat.html.user.color2" ); + } + + else + { + s_color = (string) params->front(); + params->erase( params->begin() ); + if ( ! params->empty() ) + s_color2 = (string) params->front(); + else + s_color2 = p_conf->get_elem( "chat.html.user.color1" ); + } + + s_color = tool::to_lower( s_color ); + s_color2 = tool::to_lower( s_color2 ); + + if( valid_color(s_color) != 1 ) + { + string *answerstring=new string(s_color + " is not a valid color.
\n"); + p_user->msg_post( answerstring ); + } + else if( valid_color(s_color2) != 1 ) + { + string *answerstring=new string( s_color2 + " is not a valid color.
\n"); + p_user->msg_post( answerstring ); + } + else + { + string *answerstring=new string(p_timr->get_time() + " " + p_user->get_colored_bold_name()+ " changes color to " + s_color + " " + s_color2 + "
\n"); + p_user->get_room()->msg_post( answerstring ); + p_user->set_col1(s_color); + p_user->set_col2(s_color2); + } + + return 0; + } + int valid_color( string s_color ){ + + if(s_color.size()!=6) return 0; + string valid="abcdef0123456789"; + for(int i=0;i #include "../../msgs.h" #include "../../chat/user.h" @@ -31,17 +7,16 @@ using namespace std; -extern "C" -{ - int valid_color( string ); - - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - user *p_user = (user*)c->elem[1]; // the corresponding user - p_user->msg_post( tool::ychat_version() + " " + UNAME + "
\n" + COMPOPT + "
\n"); +extern "C" { + int valid_color( string ); + + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + user *p_user = (user*)c->elem[1]; // the corresponding user + p_user->msg_post( tool::ychat_version() + " " + UNAME + "
\n" + COMPOPT + "
\n"); - return 0; - } + return 0; + } } diff --git a/src/mods/commands/yc_exec.cpp b/src/mods/commands/yc_exec.cpp old mode 100644 new mode 100755 index 7751566..f912c20 --- a/src/mods/commands/yc_exec.cpp +++ b/src/mods/commands/yc_exec.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_exec.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 "../../chat/room.h" #include "../../chat/user.h" @@ -33,58 +9,58 @@ using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; +extern "C" { + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user* p_user = (user*) c->elem[1]; // the corresponding user + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + vector *params = (vector*) c->elem[2]; // param array - user* p_user = (user*) c->elem[1]; // the corresponding user - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - vector *params = (vector*) c->elem[2]; // param array + string s_command; + string s_msg = p_timr->get_time(); + string s_output; - string s_command; - string s_msg = p_timr->get_time(); - string s_output; + vector::iterator iter; + for ( iter = params->begin(); iter != params->end(); iter++ ) + s_command.append( " " + *iter ); - vector::iterator iter; - for ( iter = params->begin(); iter != params->end(); iter++ ) - s_command.append( " " + *iter ); + s_command.append(" 2>error.log"); - s_command.append(" 2>error.log"); + s_msg.append( " " + s_command + "
\n" ); - s_msg.append( " " + s_command + "
\n" ); + p_user->msg_post( &s_msg ); - p_user->msg_post( &s_msg ); + FILE *file; + char buffer[READBUF]; - FILE *file; - char buffer[READBUF]; + if( (file=popen(s_command.c_str(), "r")) == NULL ) + { + s_output = "get_elem("chat.html.errorcolor") + + p_conf->get_elem("chat.msgs.err.execcommand") + + "
\n"; + p_user->msg_post( &s_output ); + } - if( (file=popen(s_command.c_str(), "r")) == NULL ) - { - s_output = "get_elem("chat.html.errorcolor") - + p_conf->get_elem("chat.msgs.err.execcommand") - + "
\n"; - p_user->msg_post( &s_output ); - } - else - { - s_output.append("
\n"); - while(true) - { - if(fgets(buffer, READBUF, file) == NULL) - break; + else + { + s_output.append("
\n"); + while(true) + { + if(fgets(buffer, READBUF, file) == NULL) + break; - s_output.append( string(buffer) + "
\n" ); - } + s_output.append( string(buffer) + "
\n" ); + } - p_user->msg_post( &s_output ); - pclose(file); - } + p_user->msg_post( &s_output ); + pclose(file); + } - return 0; - } + return 0; + } } diff --git a/src/mods/commands/yc_fake.cpp b/src/mods/commands/yc_fake.cpp old mode 100644 new mode 100755 index e8dd230..c708841 --- a/src/mods/commands/yc_fake.cpp +++ b/src/mods/commands/yc_fake.cpp @@ -1,54 +1,29 @@ -/*:* - *: File: ./src/mods/commands/yc_fake.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 "../../chat/room.h" #include "../../chat/user.h" using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user* p_user = (user*) c->elem[1]; // the corresponding user - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - - bool b_fake = p_user->get_fake(); - - string s_msg = (b_fake == 1 - ? p_conf->get_elem("chat.msgs.unsetmodefake") + "
\n" - : p_conf->get_elem("chat.msgs.setmodefake") + "
\n"); - - - p_user->set_fake( !b_fake ); - p_user->get_room()->reload_onlineframe(); - p_user->msg_post ( &s_msg ); - - return 0; - } +extern "C" { + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user* p_user = (user*) c->elem[1]; // the corresponding user + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + + bool b_fake = p_user->get_fake(); + + string s_msg = (b_fake == 1 + ? p_conf->get_elem("chat.msgs.unsetmodefake") + "
\n" + : p_conf->get_elem("chat.msgs.setmodefake") + "
\n"); + + + p_user->set_fake( !b_fake ); + p_user->get_room()->reload_onlineframe(); + p_user->msg_post ( &s_msg ); + + return 0; + } } diff --git a/src/mods/commands/yc_getroom.cpp b/src/mods/commands/yc_getroom.cpp old mode 100644 new mode 100755 index bc0805b..87e2d25 --- a/src/mods/commands/yc_getroom.cpp +++ b/src/mods/commands/yc_getroom.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_getroom.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,48 +6,48 @@ using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params = (vector*) c->elem[2]; // param array - chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - - if ( ! params->empty() ) - { - vector::iterator iter = params->begin(); - string s_searched_user( *iter ); - bool b_found; - user* p_searched_user = p_chat->get_user( s_searched_user, b_found ); - - if ( b_found ) - { - string s_msg = "" + p_searched_user->get_colored_name() + "" +extern "C" { + int extern_function(void *v_arg) + { + + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + vector *params = (vector*) c->elem[2]; // param array + chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + + if ( ! params->empty() ) + { + vector::iterator iter = params->begin(); + string s_searched_user( *iter ); + bool b_found; + user* p_searched_user = p_chat->get_user( s_searched_user, b_found ); + + if ( b_found ) + { + string s_msg = "" + p_searched_user->get_colored_name() + "" + p_conf->get_elem("chat.msgs.userinroom") + "" - + p_searched_user->get_room()->get_name() - + "
\n"; - p_user->msg_post( &s_msg ); - } - else - { - string s_msg = "get_room()->get_name() + + "

\n"; + p_user->msg_post( &s_msg ); + } + + else + { + string s_msg = "get_elem("chat.html.errorcolor") - + "\">" + + "\">" + s_searched_user + " " + p_conf->get_elem("chat.msgs.err.notavailable") + "
\n"; - p_user->msg_post( &s_msg ); + p_user->msg_post( &s_msg ); - } - } + } + } - return 0; - } + return 0; + } } diff --git a/src/mods/commands/yc_getrusage.cpp b/src/mods/commands/yc_getrusage.cpp old mode 100644 new mode 100755 index ba9d574..83dcbb9 --- a/src/mods/commands/yc_getrusage.cpp +++ b/src/mods/commands/yc_getrusage.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_getrusage.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 #include #include @@ -42,40 +18,39 @@ using namespace std; -extern "C" -{ - int valid_color( string ); - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - rusage* p_rusage = new rusage; - getrusage( RUSAGE_SELF, p_rusage ); - char c_msg[1024]; - - /* see man getrusage */ - - sprintf(c_msg, "getrusage:
\nmaxrss: %D (max resident set size)
\nixrss: %D (integral shared text memory size)
\nidrss: %D (integral unshared data size)
\nisrss %D (integral unshared stack size)
\nminflt: %D (page reclaims)
\nmajflt: %D (page faults)
\nnswap: %D (swaps)
\ninblock: %D (block input operations)
\noublock: %D (block output operations)
\nmsgsnd: %D (messages sent)
\nmsgrcv: %D (messages received)
\nnsignals: %D (signals received)
\nnvcsw: %D (voluntary context switches)
\nnivcsw: %D (involuntary context switches)
\n", - p_rusage->ru_maxrss, - p_rusage->ru_ixrss, - p_rusage->ru_idrss, - p_rusage->ru_isrss, - p_rusage->ru_minflt, - p_rusage->ru_majflt, - p_rusage->ru_nswap, - p_rusage->ru_inblock, - p_rusage->ru_oublock, - p_rusage->ru_msgsnd, - p_rusage->ru_msgrcv, - p_rusage->ru_nsignals, - p_rusage->ru_nvcsw, - p_rusage->ru_nivcsw - ); - - p_user->msg_post( new string( c_msg ) ); - - return 0; - } +extern "C" { + int valid_color( string ); + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + rusage* p_rusage = new rusage; + getrusage( RUSAGE_SELF, p_rusage ); + char c_msg[1024]; + + /* see man getrusage */ + + sprintf(c_msg, "getrusage:
\nmaxrss: %D (max resident set size)
\nixrss: %D (integral shared text memory size)
\nidrss: %D (integral unshared data size)
\nisrss %D (integral unshared stack size)
\nminflt: %D (page reclaims)
\nmajflt: %D (page faults)
\nnswap: %D (swaps)
\ninblock: %D (block input operations)
\noublock: %D (block output operations)
\nmsgsnd: %D (messages sent)
\nmsgrcv: %D (messages received)
\nnsignals: %D (signals received)
\nnvcsw: %D (voluntary context switches)
\nnivcsw: %D (involuntary context switches)
\n", + p_rusage->ru_maxrss, + p_rusage->ru_ixrss, + p_rusage->ru_idrss, + p_rusage->ru_isrss, + p_rusage->ru_minflt, + p_rusage->ru_majflt, + p_rusage->ru_nswap, + p_rusage->ru_inblock, + p_rusage->ru_oublock, + p_rusage->ru_msgsnd, + p_rusage->ru_msgrcv, + p_rusage->ru_nsignals, + p_rusage->ru_nvcsw, + p_rusage->ru_nivcsw + ); + + p_user->msg_post( new string( c_msg ) ); + + return 0; + } } diff --git a/src/mods/commands/yc_help.cpp b/src/mods/commands/yc_help.cpp old mode 100644 new mode 100755 index 7b4ddb9..41899c3 --- a/src/mods/commands/yc_help.cpp +++ b/src/mods/commands/yc_help.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/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" #include "../../chat/user.h" @@ -31,47 +7,45 @@ using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params = (vector*) c->elem[2]; // param array - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - string s_msg = ""; - - if (params->size() >= 1) - { - vector::iterator iter = params->begin(); - - string s_help = p_conf->get_elem("chat.msgs.help." + *iter); - - if ( s_help != "" ) - { - s_msg.append("" + *iter + ": " + s_help + "
\n"); - p_user->msg_post( &s_msg ); - return 0; - } - - s_msg.append(*iter + " " + p_conf->get_elem("chat.msgs.err.notavailable")); - } - - else - { - s_msg.append(p_conf->get_elem("chat.msgs.err.wrongcommandusage")); - } - - s_msg = "get_elem("chat.html.errorcolor") - + "\"> " - + s_msg - + "
\n"; - - p_user->msg_post( &s_msg ); - - return 0; - } +extern "C" { + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + vector *params = (vector*) c->elem[2]; // param array + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + string s_msg = ""; + + if (params->size() >= 1) + { + vector::iterator iter = params->begin(); + + string s_help = p_conf->get_elem("chat.msgs.help." + *iter); + + if ( s_help != "" ) { + s_msg.append("" + *iter + ": " + s_help + "
\n"); + p_user->msg_post( &s_msg ); + return 0; + } + + s_msg.append(*iter + " " + p_conf->get_elem("chat.msgs.err.notavailable")); + } + + else + { + s_msg.append(p_conf->get_elem("chat.msgs.err.wrongcommandusage")); + } + + s_msg = "get_elem("chat.html.errorcolor") + + "\"> " + + s_msg + + "
\n"; + + p_user->msg_post( &s_msg ); + + return 0; + } } diff --git a/src/mods/commands/yc_invisible.cpp b/src/mods/commands/yc_invisible.cpp old mode 100644 new mode 100755 index a207827..b78d934 --- a/src/mods/commands/yc_invisible.cpp +++ b/src/mods/commands/yc_invisible.cpp @@ -1,55 +1,30 @@ -/*:* - *: File: ./src/mods/commands/yc_invisible.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 "../../chat/room.h" #include "../../chat/user.h" using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user* p_user = (user*) c->elem[1]; // the corresponding user - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - - bool b_invisible = p_user->get_invisible(); - - string s_msg = b_invisible - ? p_conf->get_elem("chat.msgs.setmodeinvisible") - + "
\n" - : p_conf->get_elem("chat.msgs.unsetmodeinvisible") - + "
\n"; - - p_user->set_invisible( !b_invisible ); - p_user->get_room()->reload_onlineframe(); - p_user->msg_post ( &s_msg ); - - return 0; - } +extern "C" { + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user* p_user = (user*) c->elem[1]; // the corresponding user + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + + bool b_invisible = p_user->get_invisible(); + + string s_msg = b_invisible + ? p_conf->get_elem("chat.msgs.setmodeinvisible") + + "
\n" + : p_conf->get_elem("chat.msgs.unsetmodeinvisible") + + "
\n"; + + p_user->set_invisible( !b_invisible ); + p_user->get_room()->reload_onlineframe(); + p_user->msg_post ( &s_msg ); + + return 0; + } } diff --git a/src/mods/commands/yc_j.cpp b/src/mods/commands/yc_j.cpp old mode 100644 new mode 100755 index 2800764..903e49b --- a/src/mods/commands/yc_j.cpp +++ b/src/mods/commands/yc_j.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_j.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 "../../chat/user.h" #include "../../chat/room.h" @@ -31,98 +7,99 @@ using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params = (vector *) c->elem[2]; // param array - chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - gcol* p_gcol = (gcol*) ((dynamic_wrap*)c->elem[3])->GCOL; - - if ( ! params->empty() ) - { - vector ::iterator iter; - - string s_room; - - for ( iter = params->begin(); iter != params->end(); iter++ ) - { - s_room.append( *iter ); - if ( iter+1 != params->end() ) - s_room.append(" "); - } - - int i_max_room_len = tool::string2int( p_conf->get_elem("chat.maxlength.roomname") ); - if ( i_max_room_len < s_room.length() ) - s_room = s_room.substr(0, i_max_room_len ); - - if ( tool::to_lower(s_room) == p_user->get_room()->get_lowercase_name() ) - { - string s_msg = "get_elem("chat.html.errorcolor") + "\">" - + p_conf->get_elem("chat.msgs.err.alreadyinroom") + "" - + p_user->get_room()->get_name() + "
\n"; - p_user->msg_post( &s_msg ); - } - else - { - string s_user = p_timr->get_time() + " " + p_user->get_colored_bold_name(); - string s_msg = s_user + p_conf->get_elem( "chat.msgs.userleavesroom" ) + ""; - string s_msg2 = s_user + p_conf->get_elem( "chat.msgs.userentersroom" ) + ""; - - bool b_flag; - room* p_room = p_chat->get_room( s_room , b_flag ); - - // if room does not exist add room to list! - if ( p_room == NULL ) - { - p_room = p_gcol->get_room_from_garbage_or_new( s_room ); - - s_msg.append( s_room + "
\n" ); - s_msg2.append( s_room + "

\n" ); - - room* p_room_old = p_user->get_room(); - - string s_name_lowercase = p_user->get_lowercase_name(); - p_user->get_room()->del_elem( s_name_lowercase ); +extern "C" { + int extern_function(void *v_arg) + { - p_gcol->lock_mutex(); - if ( p_room_old != NULL ) - p_room_old->msg_post( &s_msg ); - p_gcol->unlock_mutex(); + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + vector *params = (vector *) c->elem[2]; // param array + chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + gcol* p_gcol = (gcol*) ((dynamic_wrap*)c->elem[3])->GCOL; - p_room->add_user( p_user ); - p_chat->add_elem( p_room ); - p_room->msg_post( &s_msg2 ); - } - else // p_room != NULL + if ( ! params->empty() ) { - s_msg.append( p_room->get_name() + "

\n" ); - s_msg2.append( p_room->get_name() + "
\n" ); - - room* p_room_old = p_user->get_room(); - - string s_name_lowercase = p_user->get_lowercase_name(); - p_user->get_room()->del_elem( s_name_lowercase ); - - p_gcol->lock_mutex(); - if ( p_room_old != NULL ) - p_room_old->msg_post( &s_msg ); - p_gcol->unlock_mutex(); - - p_room->add_user( p_user ); - p_room->msg_post( &s_msg2 ); - } - } - } - - return 0; - } + vector ::iterator iter; + + string s_room; + + for ( iter = params->begin(); iter != params->end(); iter++ ) + { + s_room.append( *iter ); + if ( iter+1 != params->end() ) + s_room.append(" "); + } + + int i_max_room_len = tool::string2int( p_conf->get_elem("chat.maxlength.roomname") ); + if ( i_max_room_len < s_room.length() ) + s_room = s_room.substr(0, i_max_room_len ); + + if ( tool::to_lower(s_room) == p_user->get_room()->get_lowercase_name() ) + { + string s_msg = "get_elem("chat.html.errorcolor") + "\">" + + p_conf->get_elem("chat.msgs.err.alreadyinroom") + "" + + p_user->get_room()->get_name() + "
\n"; + p_user->msg_post( &s_msg ); + } + + else + { + string s_user = p_timr->get_time() + " " + p_user->get_colored_bold_name(); + string s_msg = s_user + p_conf->get_elem( "chat.msgs.userleavesroom" ) + ""; + string s_msg2 = s_user + p_conf->get_elem( "chat.msgs.userentersroom" ) + ""; + + bool b_flag; + room* p_room = p_chat->get_room( s_room , b_flag ); + + // if room does not exist add room to list! + if ( p_room == NULL ) + { + p_room = p_gcol->get_room_from_garbage_or_new( s_room ); + + s_msg.append( s_room + "
\n" ); + s_msg2.append( s_room + "

\n" ); + + room* p_room_old = p_user->get_room(); + + string s_name_lowercase = p_user->get_lowercase_name(); + p_user->get_room()->del_elem( s_name_lowercase ); + + p_gcol->lock_mutex(); + if ( p_room_old != NULL ) + p_room_old->msg_post( &s_msg ); + p_gcol->unlock_mutex(); + + p_room->add_user( p_user ); + p_chat->add_elem( p_room ); + p_room->msg_post( &s_msg2 ); + } + + else // p_room != NULL + { + s_msg.append( p_room->get_name() + "
\n" ); + s_msg2.append( p_room->get_name() + "
\n" ); + + room* p_room_old = p_user->get_room(); + + string s_name_lowercase = p_user->get_lowercase_name(); + p_user->get_room()->del_elem( s_name_lowercase ); + + p_gcol->lock_mutex(); + if ( p_room_old != NULL ) + p_room_old->msg_post( &s_msg ); + p_gcol->unlock_mutex(); + + p_room->add_user( p_user ); + p_room->msg_post( &s_msg2 ); + } + } + } + + return 0; + } } diff --git a/src/mods/commands/yc_ko.cpp b/src/mods/commands/yc_ko.cpp old mode 100644 new mode 100755 index 99e8613..ac32ac7 --- a/src/mods/commands/yc_ko.cpp +++ b/src/mods/commands/yc_ko.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_ko.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,67 +6,67 @@ using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params = (vector*) c->elem[2]; // param array - chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - - if ( ! params->empty() ) - { - vector::iterator iter = params->begin(); - string s_searched_user( *iter ); - bool b_found; - user* p_searched_user = p_chat->get_user( s_searched_user, b_found ); - - if ( b_found ) - { - - string s_msg = p_timr->get_time() + " " +extern "C" { + int extern_function(void *v_arg) + { + + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + vector *params = (vector*) c->elem[2]; // param array + chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + + if ( ! params->empty() ) + { + vector::iterator iter = params->begin(); + string s_searched_user( *iter ); + bool b_found; + user* p_searched_user = p_chat->get_user( s_searched_user, b_found ); + + if ( b_found ) + { + + string s_msg = p_timr->get_time() + " " + p_user->get_colored_bold_name() + p_conf->get_elem( "chat.msgs.userkicksout1" ) + p_searched_user->get_colored_bold_name() + p_conf->get_elem( "chat.msgs.userkicksout2" ) + p_searched_user->get_room()->get_bold_name() - + "
\n"; + + "
\n"; - room* p_room1 = p_user->get_room(); - room* p_room2 = p_searched_user->get_room(); + room* p_room1 = p_user->get_room(); + room* p_room2 = p_searched_user->get_room(); - p_room1->msg_post( &s_msg ); + p_room1->msg_post( &s_msg ); - if ( p_room1->get_lowercase_name() != - p_room2->get_lowercase_name() ) - p_room2->msg_post( &s_msg ); + if ( p_room1->get_lowercase_name() != + p_room2->get_lowercase_name() ) + p_room2->msg_post( &s_msg ); - string s_kick = ""; - p_searched_user->msg_post( &s_kick ); - p_searched_user->set_online(false); - } - else - { - string s_msg = "msg_post( &s_kick ); + p_searched_user->set_online(false); + } + + else + { + string s_msg = "get_elem("chat.html.errorcolor") - + "\">" + + "\">" + s_searched_user + " " + p_conf->get_elem("chat.msgs.err.notavailable") + "
\n"; - p_user->msg_post( &s_msg ); - } - } + p_user->msg_post( &s_msg ); + } + } - return 0; - } + return 0; + } } diff --git a/src/mods/commands/yc_m.cpp b/src/mods/commands/yc_m.cpp old mode 100644 new mode 100755 index 5ef0098..a93cc3b --- a/src/mods/commands/yc_m.cpp +++ b/src/mods/commands/yc_m.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_m.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 #include "../../chat/user.h" #include "../../chat/room.h" @@ -31,38 +7,37 @@ using namespace std; -extern "C" -{ - int valid_color( string ); - - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params= (vector*) c->elem[2]; // param array - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - - string s_msg = ""; - - if ( p_conf->get_elem("chat.printalwaystime") == "true" ) - s_msg = p_timr->get_time() + " "; - - s_msg.append( "" + p_user->get_colored_name() - + " get_col2() - + "\">" ); - if ( ! params->empty() ) - { - vector::iterator iter = params->begin(); - for ( iter = params->begin(); iter != params->end(); iter++ ) - s_msg.append( *iter + " " ); - } - - s_msg.append( "
\n" ); - p_user->get_room()->msg_post( &s_msg ); - - return 0; - } +extern "C" { + int valid_color( string ); + + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + vector *params= (vector*) c->elem[2]; // param array + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + + string s_msg = ""; + + if ( p_conf->get_elem("chat.printalwaystime") == "true" ) + s_msg = p_timr->get_time() + " "; + + s_msg.append( "" + p_user->get_colored_name() + + " get_col2() + + "\">" ); + if ( ! params->empty() ) + { + vector::iterator iter = params->begin(); + for ( iter = params->begin(); iter != params->end(); iter++ ) + s_msg.append( *iter + " " ); + } + + s_msg.append( "
\n" ); + p_user->get_room()->msg_post( &s_msg ); + + return 0; + } } diff --git a/src/mods/commands/yc_md5.cpp b/src/mods/commands/yc_md5.cpp old mode 100644 new mode 100755 index cede991..d79d952 --- a/src/mods/commands/yc_md5.cpp +++ b/src/mods/commands/yc_md5.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_md5.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 "../../chat/user.h" #include "../../contrib/crypt/md5.h" @@ -32,47 +8,47 @@ using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params = (vector*) c->elem[2]; // param array - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - - if (params->size() >= 2) - { - vector::iterator iter; - string s_string = ""; - string s_salt = ""; - - for (iter = params->begin(); iter+1 != params->end(); ++iter) - { - s_string.append(*iter); - } - - s_salt = *iter; - - string s_msg = "Crypt: " + s_string + ", Salt: " - + s_salt + " = " + - + md5::MD5Crypt(s_string.c_str(), s_salt.c_str()) - + "
\n"; - p_user->msg_post( &s_msg ); - } - else - { - string s_msg = "get_elem("chat.html.errorcolor") - + "\"> " - + p_conf->get_elem("ERR_WRONG_COMMAND_USAGE") - + "
\n"; - p_user->msg_post( &s_msg ); - - } - - return 0; - } +extern "C" { + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + vector *params = (vector*) c->elem[2]; // param array + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + + if (params->size() >= 2) + { + vector::iterator iter; + string s_string = ""; + string s_salt = ""; + + for (iter = params->begin(); iter+1 != params->end(); ++iter) + { + s_string.append(*iter); + } + + s_salt = *iter; + + string s_msg = "Crypt: " + s_string + ", Salt: " + + s_salt + " = " + + + md5::MD5Crypt(s_string.c_str(), s_salt.c_str()) + + "
\n"; + p_user->msg_post( &s_msg ); + } + + else + { + string s_msg = "get_elem("chat.html.errorcolor") + + "\"> " + + p_conf->get_elem("ERR_WRONG_COMMAND_USAGE") + + "
\n"; + p_user->msg_post( &s_msg ); + + } + + return 0; + } } diff --git a/src/mods/commands/yc_me.cpp b/src/mods/commands/yc_me.cpp old mode 100644 new mode 100755 index 262ce11..66d54da --- a/src/mods/commands/yc_me.cpp +++ b/src/mods/commands/yc_me.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_me.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 #include "../../chat/user.h" #include "../../chat/room.h" @@ -31,39 +7,38 @@ using namespace std; -extern "C" -{ - int valid_color( string ); - - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params= (vector*) c->elem[2]; // param array - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; +extern "C" { + int valid_color( string ); + + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + vector *params= (vector*) c->elem[2]; // param array + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - string s_msg = ""; + string s_msg = ""; - if ( p_conf->get_elem("chat.printalwaystime") == "true" ) - s_msg = p_timr->get_time() + " "; + if ( p_conf->get_elem("chat.printalwaystime") == "true" ) + s_msg = p_timr->get_time() + " "; - s_msg.append( "get_col1() + "\">" - + p_user->get_name() + " "); + s_msg.append( "get_col1() + "\">" + + p_user->get_name() + " "); - if ( ! params->empty() ) - { - vector::iterator iter = params->begin(); - for ( iter = params->begin(); iter != params->end(); iter++ ) - s_msg.append( *iter + " " ); - } + if ( ! params->empty() ) + { + vector::iterator iter = params->begin(); + for ( iter = params->begin(); iter != params->end(); iter++ ) + s_msg.append( *iter + " " ); + } - s_msg.append( "
\n" ); - p_user->get_room()->msg_post( &s_msg ); + s_msg.append( "

\n" ); + p_user->get_room()->msg_post( &s_msg ); - return 0; + return 0; - } + } } diff --git a/src/mods/commands/yc_morph.cpp b/src/mods/commands/yc_morph.cpp old mode 100644 new mode 100755 index 2177a39..cf1f448 --- a/src/mods/commands/yc_morph.cpp +++ b/src/mods/commands/yc_morph.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_morph.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 "../../chat/user.h" #include "../../chat/room.h" #include "../../tool/tool.h" @@ -32,44 +8,45 @@ using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c = (container*) v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *p_params = (vector*) c->elem[2]; // param array - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - - if ( p_params->empty() ) - { - string s_msg = p_conf->colored_error_msg("chat.msgs.err.wrongcommandusage"); - p_user->msg_post(s_msg); - } - else - { - string s_morphed_name = p_params->at(0); - - if ( tool::to_lower(s_morphed_name) != p_user->get_lowercase_name() ) - { - string s_msg = p_conf->colored_error_msg("chat.msgs.err.morphnick"); - p_user->msg_post(s_msg); - } - else - { - string s_msg = p_timr->get_time() + " " + p_user->get_colored_bold_name() + p_conf->get_elem( "chat.msgs.usermorphs" ) + "get_col1() + "\">" + s_morphed_name + "
\n"; - - room* p_room = p_user->get_room(); - p_room->msg_post( &s_msg ); - p_user->set_name( s_morphed_name ); - p_room->reload_onlineframe(); - } - } - - return 0; - } +extern "C" { + int extern_function(void *v_arg) + { + container *c = (container*) v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + vector *p_params = (vector*) c->elem[2]; // param array + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + + if ( p_params->empty() ) + { + string s_msg = p_conf->colored_error_msg("chat.msgs.err.wrongcommandusage"); + p_user->msg_post(s_msg); + } + + else + { + string s_morphed_name = p_params->at(0); + + if ( tool::to_lower(s_morphed_name) != p_user->get_lowercase_name() ) + { + string s_msg = p_conf->colored_error_msg("chat.msgs.err.morphnick"); + p_user->msg_post(s_msg); + } + + else + { + string s_msg = p_timr->get_time() + " " + p_user->get_colored_bold_name() + p_conf->get_elem( "chat.msgs.usermorphs" ) + "get_col1() + "\">" + s_morphed_name + "
\n"; + + room* p_room = p_user->get_room(); + p_room->msg_post( &s_msg ); + p_user->set_name( s_morphed_name ); + p_room->reload_onlineframe(); + } + } + + return 0; + } } diff --git a/src/mods/commands/yc_msg.cpp b/src/mods/commands/yc_msg.cpp old mode 100644 new mode 100755 index 9f337c3..33beee4 --- a/src/mods/commands/yc_msg.cpp +++ b/src/mods/commands/yc_msg.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_msg.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 "../../chat/user.h" #include "../../chat/room.h" /* @@ -30,63 +6,63 @@ using namespace std; -extern "C" -{ - int valid_color( string ); - - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params = (vector*) c->elem[2]; // param array - chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - - if ( ! params->empty() ) - { - vector::iterator iter = params->begin(); - string s_whisper_user( *iter ); - bool b_found; - user* p_whisper_user = p_chat->get_user( s_whisper_user, b_found ); - - if ( b_found ) - { - string s_time = ""; - if ( p_conf->get_elem("chat.printalwaystime") == "true" ) - s_time = p_timr->get_time() + " "; - - string s_msg = s_time + " " + p_conf->get_elem("chat.msgs.whisperto") + " " + p_whisper_user->get_colored_name() + ": get_col2() + "\">"; - - string s_whisper_msg = s_time + "" + p_user->get_colored_name() + " " + p_conf->get_elem("chat.msgs.whisper") + ": get_col2() + "\">"; - - string s_tmp = ""; - for ( iter++; iter != params->end(); iter++ ) - s_tmp.append( *iter + " " ); - - p_chat->string_replacer(&s_tmp); - - s_msg .append( s_tmp + "
\n" ); - s_whisper_msg.append( s_tmp + "

\n" ); - - p_user ->msg_post( &s_msg ); - p_whisper_user->msg_post( &s_whisper_msg ); - } - else - { - string s_msg = "elem[1]; // the corresponding user + vector *params = (vector*) c->elem[2]; // param array + chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + + if ( ! params->empty() ) + { + vector::iterator iter = params->begin(); + string s_whisper_user( *iter ); + bool b_found; + user* p_whisper_user = p_chat->get_user( s_whisper_user, b_found ); + + if ( b_found ) + { + string s_time = ""; + if ( p_conf->get_elem("chat.printalwaystime") == "true" ) + s_time = p_timr->get_time() + " "; + + string s_msg = s_time + " " + p_conf->get_elem("chat.msgs.whisperto") + " " + p_whisper_user->get_colored_name() + ": get_col2() + "\">"; + + string s_whisper_msg = s_time + "" + p_user->get_colored_name() + " " + p_conf->get_elem("chat.msgs.whisper") + ": get_col2() + "\">"; + + string s_tmp = ""; + for ( iter++; iter != params->end(); iter++ ) + s_tmp.append( *iter + " " ); + + p_chat->string_replacer(&s_tmp); + + s_msg .append( s_tmp + "
\n" ); + s_whisper_msg.append( s_tmp + "

\n" ); + + p_user ->msg_post( &s_msg ); + p_whisper_user->msg_post( &s_whisper_msg ); + } + + else + { + string s_msg = "get_elem("chat.html.errorcolor") - + "\">" + + "\">" + s_whisper_user + " " + p_conf->get_elem("chat.msgs.err.notavailable") + "
\n"; - p_user->msg_post( &s_msg ); - } - } + p_user->msg_post( &s_msg ); + } + } - return 0; - } + return 0; + } } diff --git a/src/mods/commands/yc_q.cpp b/src/mods/commands/yc_q.cpp old mode 100644 new mode 100755 index 5dba617..4c9584d --- a/src/mods/commands/yc_q.cpp +++ b/src/mods/commands/yc_q.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_q.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 #include "../../chat/user.h" @@ -32,23 +8,22 @@ using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container* c = (container*) v_arg; - user* p_user = (user*)c->elem[1]; +extern "C" { + int extern_function(void *v_arg) + { + container* c = (container*) v_arg; + user* p_user = (user*)c->elem[1]; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - string s_quit = ""; + string s_quit = ""; - p_user->msg_post( &s_quit ); - p_user->set_online(false); + p_user->msg_post( &s_quit ); + p_user->set_online(false); - return 0; - } + return 0; + } } diff --git a/src/mods/commands/yc_reload.cpp b/src/mods/commands/yc_reload.cpp old mode 100644 new mode 100755 index ec94c5b..8b9cd0a --- a/src/mods/commands/yc_reload.cpp +++ b/src/mods/commands/yc_reload.cpp @@ -1,49 +1,24 @@ -/*:* - *: File: ./src/mods/commands/yc_reload.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 "../../chat/room.h" #include "../../chat/user.h" using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user* p_user = (user*) c->elem[1]; // the corresponding user - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - - string s_msg = p_conf->get_elem("chat.msgs.reloadonlineframe") - + "
\n"; - - p_user->get_room()->reload_onlineframe(); - p_user->msg_post ( &s_msg ); - - return 0; - } +extern "C" { + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user* p_user = (user*) c->elem[1]; // the corresponding user + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + + string s_msg = p_conf->get_elem("chat.msgs.reloadonlineframe") + + "
\n"; + + p_user->get_room()->reload_onlineframe(); + p_user->msg_post ( &s_msg ); + + return 0; + } } diff --git a/src/mods/commands/yc_ren.cpp b/src/mods/commands/yc_ren.cpp old mode 100644 new mode 100755 index 672d378..9735d8e --- a/src/mods/commands/yc_ren.cpp +++ b/src/mods/commands/yc_ren.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_ren.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 "../../chat/user.h" #include "../../chat/room.h" @@ -31,68 +7,68 @@ using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c = (container*) v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params = (vector*) c->elem[2]; // param array - - chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - - if ( ! params->empty() ) - { - vector::iterator iter; - - string s_room; - - for ( iter = params->begin(); iter != params->end(); iter++ ) - { - s_room.append( *iter ); - if ( iter+1 != params->end() ) - s_room.append(" "); - } - - int i_max_room_len = tool::string2int( p_conf->get_elem("chat.maxlength.roomname") ); - if ( i_max_room_len < s_room.length() ) - s_room = s_room.substr(0, i_max_room_len ); - - bool b_found; - string s_room_lower = tool::to_lower(s_room); - room* p_room = p_user->get_room(); - - if ( s_room_lower != p_room->get_lowercase_name() && - NULL != p_chat->get_room( s_room_lower , b_found ) ) - { - string s_msg = "elem[1]; // the corresponding user + vector *params = (vector*) c->elem[2]; // param array + + chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + + if ( ! params->empty() ) + { + vector::iterator iter; + + string s_room; + + for ( iter = params->begin(); iter != params->end(); iter++ ) + { + s_room.append( *iter ); + if ( iter+1 != params->end() ) + s_room.append(" "); + } + + int i_max_room_len = tool::string2int( p_conf->get_elem("chat.maxlength.roomname") ); + if ( i_max_room_len < s_room.length() ) + s_room = s_room.substr(0, i_max_room_len ); + + bool b_found; + string s_room_lower = tool::to_lower(s_room); + room* p_room = p_user->get_room(); + + if ( s_room_lower != p_room->get_lowercase_name() && + NULL != p_chat->get_room( s_room_lower , b_found ) ) + { + string s_msg = "get_elem("chat.html.errorcolor") - + "\">" + + "\">" + p_conf->get_elem("chat.msgs.err.roomexists") + "
\n"; - p_user->msg_post( &s_msg ); - } - else - { - string s_msg = p_timr->get_time() + " " - + p_user->get_colored_bold_name() - + p_conf->get_elem( "chat.msgs.us_errorenamesroom" ) + p_user->msg_post( &s_msg ); + } + + else + { + string s_msg = p_timr->get_time() + " " + + p_user->get_colored_bold_name() + + p_conf->get_elem( "chat.msgs.userrenamesroom" ) + "" + s_room + "
\n"; - p_chat->del_elem( p_room->get_lowercase_name() ); - p_room->set_name( s_room ); - p_chat->add_elem( p_room ); - p_room->msg_post( &s_msg ); - p_room->reload_onlineframe(); - } - } + p_chat->del_elem( p_room->get_lowercase_name() ); + p_room->set_name( s_room ); + p_chat->add_elem( p_room ); + p_room->msg_post( &s_msg ); + p_room->reload_onlineframe(); + } + } - return 0; - } + return 0; + } } diff --git a/src/mods/commands/yc_s.cpp b/src/mods/commands/yc_s.cpp old mode 100644 new mode 100755 index daece17..30a6892 --- a/src/mods/commands/yc_s.cpp +++ b/src/mods/commands/yc_s.cpp @@ -1,72 +1,47 @@ -/*:* - *: File: ./src/mods/commands/yc_s.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 "../../chat/user.h" #include "../../chat/room.h" using namespace std; -extern "C" -{ - string to_upper( string &s_msg ) - { - char* c_msg = (char*) s_msg.c_str(); - - for ( int i = 0; i < strlen( c_msg ); i++ ) - c_msg[i] = toupper( c_msg[i] ); - - return string( c_msg ); - }; - - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - vector *params= (vector*) c->elem[2]; // param array - - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - - string s_time = ""; - if ( p_conf->get_elem("chat.printalwaystime") == "true" ) - s_time = p_timr->get_time() + " "; - - string s_msg = s_time + "" + p_user->get_colored_name() + " " + p_conf->get_elem("chat.msgs.scream") + " get_col2() + "\">"; - - if ( ! params->empty() ) - { - vector::iterator iter = params->begin(); - for ( iter = params->begin(); iter != params->end(); iter++ ) - s_msg.append( to_upper(*iter) + " " ); - } - - s_msg.append( "
\n" ); - p_user->get_room()->msg_post( &s_msg ); - - return 0; - - } +extern "C" { + string to_upper( string &s_msg ) + { + char* c_msg = (char*) s_msg.c_str(); + + for ( int i = 0; i < strlen( c_msg ); i++ ) + c_msg[i] = toupper( c_msg[i] ); + + return string( c_msg ); + }; + + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + vector *params= (vector*) c->elem[2]; // param array + + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + + string s_time = ""; + if ( p_conf->get_elem("chat.printalwaystime") == "true" ) + s_time = p_timr->get_time() + " "; + + string s_msg = s_time + "" + p_user->get_colored_name() + " " + p_conf->get_elem("chat.msgs.scream") + " get_col2() + "\">"; + + if ( ! params->empty() ) + { + vector::iterator iter = params->begin(); + for ( iter = params->begin(); iter != params->end(); iter++ ) + s_msg.append( to_upper(*iter) + " " ); + } + + s_msg.append( "
\n" ); + p_user->get_room()->msg_post( &s_msg ); + + return 0; + + } } diff --git a/src/mods/commands/yc_set.cpp b/src/mods/commands/yc_set.cpp old mode 100644 new mode 100755 index 25bb2b0..a18b5e9 --- a/src/mods/commands/yc_set.cpp +++ b/src/mods/commands/yc_set.cpp @@ -1,124 +1,101 @@ -/*:* - *: File: ./src/mods/commands/yc_set.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 "../../chat/room.h" #include "../../chat/user.h" using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user* p_user = (user*) c->elem[1]; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; - - vector *params = (vector*) c->elem[2]; // param array - - bool b_invalid_syntax = 0; - - if ( params->size() >= 3 ) - { - string s_msg; - string s_command_name = params->at(0); - string s_option = params->at(1); - string s_newval = params->at(2); - - if ( s_option == "status" ) - { - const char* c_newval = s_newval.c_str(); - if ( isdigit( c_newval[0] ) ) - { - int i_newval = c_newval[0] - '0'; - - s_msg = p_timr->get_time() - + " " - + p_user->get_colored_bold_name() - + " " - + p_conf->get_elem("chat.msgs.setcommandstatus") - + " (" - + s_command_name + "," + s_newval + "," - + tool::int2string( p_chat->get_command_disabled(s_command_name)) - + ")
\n"; +extern "C" { + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user* p_user = (user*) c->elem[1]; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; + + vector *params = (vector*) c->elem[2]; // param array + + bool b_invalid_syntax = 0; + + if ( params->size() >= 3 ) + { + string s_msg; + string s_command_name = params->at(0); + string s_option = params->at(1); + string s_newval = params->at(2); + + if ( s_option == "status" ) + { + const char* c_newval = s_newval.c_str(); + if ( isdigit( c_newval[0] ) ) + { + int i_newval = c_newval[0] - '0'; + + s_msg = p_timr->get_time() + + " " + + p_user->get_colored_bold_name() + + " " + + p_conf->get_elem("chat.msgs.setcommandstatus") + + " (" + + s_command_name + "," + s_newval + "," + + tool::int2string( p_chat->get_command_disabled(s_command_name)) + + ")
\n"; + + p_user->get_room()->msg_post(&s_msg); + p_chat->set_command_status( s_command_name, i_newval ); + } + } + else if ( s_option == "disable" ) + { + const char* c_newval = s_newval.c_str(); + if ( isdigit( c_newval[0] ) ) + { + int i_newval = c_newval[0] - '0'; + + if ( i_newval != 0 ) + i_newval = 1; - p_user->get_room()->msg_post(&s_msg); - p_chat->set_command_status( s_command_name, i_newval ); + s_newval = tool::int2string(i_newval); + + s_msg = p_timr->get_time() + + " " + + p_user->get_colored_bold_name() + + " " + + p_conf->get_elem("chat.msgs.setcommandstatus") + + " (" + + s_command_name + "," + + tool::int2string( p_chat->get_command_status(s_command_name)) + + "," + s_newval + ")
\n"; + + p_user->get_room()->msg_post(&s_msg); + p_chat->set_command_disabled( s_command_name, (bool)i_newval ); + } + } + + else + { + b_invalid_syntax = 1; + } + } - } - else if ( s_option == "disable" ) - { - const char* c_newval = s_newval.c_str(); - if ( isdigit( c_newval[0] ) ) + + else { - int i_newval = c_newval[0] - '0'; - - if ( i_newval != 0 ) - i_newval = 1; - - s_newval = tool::int2string(i_newval); - - s_msg = p_timr->get_time() - + " " - + p_user->get_colored_bold_name() - + " " - + p_conf->get_elem("chat.msgs.setcommandstatus") - + " (" - + s_command_name + "," - + tool::int2string( p_chat->get_command_status(s_command_name)) - + "," + s_newval + ")
\n"; - - p_user->get_room()->msg_post(&s_msg); - p_chat->set_command_disabled( s_command_name, (bool)i_newval ); + b_invalid_syntax = 1; + } + + if ( b_invalid_syntax ) + { + string s_msg = "get_elem("chat.html.errorcolor") + + "\">" + + p_conf->get_elem("chat.msgs.err.wrongcommandusage") + + "
\n"; + p_user->msg_post( &s_msg ); } - } - else - { - b_invalid_syntax = 1; - } - - } - else - { - b_invalid_syntax = 1; - } - - if ( b_invalid_syntax ) - { - string s_msg = "get_elem("chat.html.errorcolor") - + "\">" - + p_conf->get_elem("chat.msgs.err.wrongcommandusage") - + "
\n"; - p_user->msg_post( &s_msg ); - } - return 0; - } + return 0; + } } diff --git a/src/mods/commands/yc_template.cpp b/src/mods/commands/yc_template.cpp new file mode 100755 index 0000000..e0aa009 --- /dev/null +++ b/src/mods/commands/yc_template.cpp @@ -0,0 +1,24 @@ +#include +#include "../../chat/user.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; + + user *p_user = (user*)c->elem[1]; // the corresponding user + vector *params=(vector*)c->elem[2]; // param array + + string *quitstring=new string("Text to send
"); + p_user->msg_post( quitstring ); + + return 0; + } +} + diff --git a/src/mods/commands/yc_time.cpp b/src/mods/commands/yc_time.cpp old mode 100644 new mode 100755 index 32dc8b1..c22e542 --- a/src/mods/commands/yc_time.cpp +++ b/src/mods/commands/yc_time.cpp @@ -1,46 +1,21 @@ -/*:* - *: File: ./src/mods/commands/yc_time.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" using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - - string s_msg = p_conf->get_elem("chat.msgs.servertime") + p_timr->get_time() + "
\n"; - - p_user->msg_post( &s_msg ); - - return 0; - } +extern "C" { + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + + string s_msg = p_conf->get_elem("chat.msgs.servertime") + p_timr->get_time() + "
\n"; + + p_user->msg_post( &s_msg ); + + return 0; + } } diff --git a/src/mods/commands/yc_topic.cpp b/src/mods/commands/yc_topic.cpp old mode 100644 new mode 100755 index d02727d..0fd01e9 --- a/src/mods/commands/yc_topic.cpp +++ b/src/mods/commands/yc_topic.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_topic.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 "../../tool/tool.h" #include "../../incl.h" #include "../../chat/room.h" @@ -29,74 +5,74 @@ using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user* p_user = (user*) c->elem[1]; // the corresponding user - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - vector *params = (vector*) c->elem[2]; // param array - - string s_msg; - string s_topic; - string s_col; - - room* p_room = p_user->get_room(); - - if ( ! params->empty() ) - { - vector::iterator iter; - - s_col = "get_col1() + "\">"; - - s_msg = p_timr->get_time() - + " " - + p_user->get_colored_bold_name() - + " " - + p_conf->get_elem("chat.msgs.topic") - + s_col; - - for ( iter = params->begin(); iter != params->end(); iter++ ) - { - s_msg.append( " " + *iter ); - s_topic.append( *iter + " " ); - } - s_msg.append( "" ); - - int i_topic_length = tool::string2int(p_conf->get_elem("chat.maxlength.topic")); - if ( s_topic.length() > i_topic_length ) - { - s_topic = s_topic.substr(0, i_topic_length ); - s_topic.append(" ... "); - - string s_private_msg = "get_elem("chat.html.errorcolor") - + ">" + p_conf->get_elem( "chat.msgs.topiccut" ) + "
"; - - p_user->msg_post ( &s_private_msg ); - } - - s_topic = "( " + s_topic + ")"; - p_room->set_topic( s_topic, p_user->get_col1() ); - } - else - { - s_msg = p_timr->get_time() - + " " - + p_user->get_colored_bold_name() - + " " - + p_conf->get_elem("chat.msgs.topicdelete"); - - p_room->set_topic( "" ); - } - - s_msg.append( "
\n" ); - - p_room->msg_post ( &s_msg ); - - return 0; - } +extern "C" { + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user* p_user = (user*) c->elem[1]; // the corresponding user + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + vector *params = (vector*) c->elem[2]; // param array + + string s_msg; + string s_topic; + string s_col; + + room* p_room = p_user->get_room(); + + if ( ! params->empty() ) + { + vector::iterator iter; + + s_col = "get_col1() + "\">"; + + s_msg = p_timr->get_time() + + " " + + p_user->get_colored_bold_name() + + " " + + p_conf->get_elem("chat.msgs.topic") + + s_col; + + for ( iter = params->begin(); iter != params->end(); iter++ ) + { + s_msg.append( " " + *iter ); + s_topic.append( *iter + " " ); + } + s_msg.append( "" ); + + int i_topic_length = tool::string2int(p_conf->get_elem("chat.maxlength.topic")); + if ( s_topic.length() > i_topic_length ) + { + s_topic = s_topic.substr(0, i_topic_length ); + s_topic.append(" ... "); + + string s_private_msg = "get_elem("chat.html.errorcolor") + + ">" + p_conf->get_elem( "chat.msgs.topiccut" ) + "
"; + + p_user->msg_post ( &s_private_msg ); + } + + s_topic = "( " + s_topic + ")"; + p_room->set_topic( s_topic, p_user->get_col1() ); + } + + else + { + s_msg = p_timr->get_time() + + " " + + p_user->get_colored_name() + + " " + + p_conf->get_elem("chat.msgs.topicdelete"); + + p_room->set_topic( "" ); + } + + s_msg.append( "
\n" ); + + p_room->msg_post ( &s_msg ); + + return 0; + } } diff --git a/src/mods/commands/yc_uptime.cpp b/src/mods/commands/yc_uptime.cpp old mode 100644 new mode 100755 index f566f73..5fe0929 --- a/src/mods/commands/yc_uptime.cpp +++ b/src/mods/commands/yc_uptime.cpp @@ -1,46 +1,21 @@ -/*:* - *: File: ./src/mods/commands/yc_uptime.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" using namespace std; -extern "C" -{ - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - - user *p_user = (user*) c->elem[1]; // the corresponding user - conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; - - string s_msg = p_conf->get_elem("chat.msgs.uptime") + p_timr->get_uptime() + "
\n"; - - p_user->msg_post( &s_msg ); - - return 0; - } +extern "C" { + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + + user *p_user = (user*) c->elem[1]; // the corresponding user + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR; + + string s_msg = p_conf->get_elem("chat.msgs.uptime") + p_timr->get_uptime() + "
\n"; + + p_user->msg_post( &s_msg ); + + return 0; + } } diff --git a/src/mods/commands/yc_version.cpp b/src/mods/commands/yc_version.cpp old mode 100644 new mode 100755 index 6bbff31..d64fabd --- a/src/mods/commands/yc_version.cpp +++ b/src/mods/commands/yc_version.cpp @@ -1,27 +1,3 @@ -/*:* - *: File: ./src/mods/commands/yc_version.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 #include "../../msgs.h" #include "../../chat/user.h" @@ -31,17 +7,16 @@ using namespace std; -extern "C" -{ - int valid_color( string ); - - int extern_function(void *v_arg) - { - container *c=(container *)v_arg; - user *p_user = (user*)c->elem[1]; // the corresponding user - p_user->msg_post( tool::ychat_version() + "
\n"); +extern "C" { + int valid_color( string ); + + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + user *p_user = (user*)c->elem[1]; // the corresponding user + p_user->msg_post( tool::ychat_version() + "
\n"); - return 0; - } + return 0; + } } -- cgit v1.2.3