From c67ed39bc994a0aef06454c1e3044e79f712b739 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 21 Nov 2010 16:56:10 +0000 Subject: --- src/mods/commands/Makefile.in | 18 ++++++ src/mods/commands/yc_about.cpp | 83 ++++++++++++++++++++++++ src/mods/commands/yc_all.cpp | 73 +++++++++++++++++++++ src/mods/commands/yc_away.cpp | 96 ++++++++++++++++++++++++++++ src/mods/commands/yc_col.cpp | 112 ++++++++++++++++++++++++++++++++ src/mods/commands/yc_compopt.cpp | 47 ++++++++++++++ src/mods/commands/yc_exec.cpp | 90 ++++++++++++++++++++++++++ src/mods/commands/yc_fake.cpp | 54 ++++++++++++++++ src/mods/commands/yc_getroom.cpp | 77 ++++++++++++++++++++++ src/mods/commands/yc_getrusage.cpp | 81 +++++++++++++++++++++++ src/mods/commands/yc_help.cpp | 76 ++++++++++++++++++++++ src/mods/commands/yc_invisible.cpp | 55 ++++++++++++++++ src/mods/commands/yc_j.cpp | 128 +++++++++++++++++++++++++++++++++++++ src/mods/commands/yc_ko.cpp | 96 ++++++++++++++++++++++++++++ src/mods/commands/yc_m.cpp | 68 ++++++++++++++++++++ src/mods/commands/yc_md5.cpp | 78 ++++++++++++++++++++++ src/mods/commands/yc_me.cpp | 69 ++++++++++++++++++++ src/mods/commands/yc_morph.cpp | 76 ++++++++++++++++++++++ src/mods/commands/yc_msg.cpp | 92 ++++++++++++++++++++++++++ src/mods/commands/yc_q.cpp | 54 ++++++++++++++++ src/mods/commands/yc_reload.cpp | 49 ++++++++++++++ src/mods/commands/yc_ren.cpp | 98 ++++++++++++++++++++++++++++ src/mods/commands/yc_s.cpp | 72 +++++++++++++++++++++ src/mods/commands/yc_set.cpp | 124 +++++++++++++++++++++++++++++++++++ src/mods/commands/yc_template.cpp | 49 ++++++++++++++ src/mods/commands/yc_time.cpp | 46 +++++++++++++ src/mods/commands/yc_topic.cpp | 102 +++++++++++++++++++++++++++++ src/mods/commands/yc_uptime.cpp | 46 +++++++++++++ src/mods/commands/yc_users.cpp | 52 +++++++++++++++ src/mods/commands/yc_version.cpp | 47 ++++++++++++++ 30 files changed, 2208 insertions(+) create mode 100644 src/mods/commands/Makefile.in create mode 100644 src/mods/commands/yc_about.cpp create mode 100644 src/mods/commands/yc_all.cpp create mode 100644 src/mods/commands/yc_away.cpp create mode 100644 src/mods/commands/yc_col.cpp create mode 100644 src/mods/commands/yc_compopt.cpp create mode 100644 src/mods/commands/yc_exec.cpp create mode 100644 src/mods/commands/yc_fake.cpp create mode 100644 src/mods/commands/yc_getroom.cpp create mode 100644 src/mods/commands/yc_getrusage.cpp create mode 100644 src/mods/commands/yc_help.cpp create mode 100644 src/mods/commands/yc_invisible.cpp create mode 100644 src/mods/commands/yc_j.cpp create mode 100644 src/mods/commands/yc_ko.cpp create mode 100644 src/mods/commands/yc_m.cpp create mode 100644 src/mods/commands/yc_md5.cpp create mode 100644 src/mods/commands/yc_me.cpp create mode 100644 src/mods/commands/yc_morph.cpp create mode 100644 src/mods/commands/yc_msg.cpp create mode 100644 src/mods/commands/yc_q.cpp create mode 100644 src/mods/commands/yc_reload.cpp create mode 100644 src/mods/commands/yc_ren.cpp create mode 100644 src/mods/commands/yc_s.cpp create mode 100644 src/mods/commands/yc_set.cpp create mode 100644 src/mods/commands/yc_template.cpp create mode 100644 src/mods/commands/yc_time.cpp create mode 100644 src/mods/commands/yc_topic.cpp create mode 100644 src/mods/commands/yc_uptime.cpp create mode 100644 src/mods/commands/yc_users.cpp create mode 100644 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 100644 index 0000000..42884b6 --- /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): + @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi + @$(CC) $(CFLAGS) $(INCLUDES) -shared -s -o $@ `echo $(notdir $@) | sed s/.so/.cpp/` + @echo -n "Command module `basename $@ | sed s/\.so// | sed s/yc_//` " + @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 new file mode 100644 index 0000000..b4449a1 --- /dev/null +++ b/src/mods/commands/yc_about.cpp @@ -0,0 +1,83 @@ +/*:* + *: File: ./src/mods/commands/yc_about.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" + +/* + 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 + 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_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 = "get_elem("chat.html.errorcolor") + + "\">" + + s_searched_user + " " + + p_conf->get_elem("chat.msgs.err.notavailable") + + "
\n"; + p_user->msg_post( &s_msg ); + + } + } + + return 0; + } + +} + diff --git a/src/mods/commands/yc_all.cpp b/src/mods/commands/yc_all.cpp new file mode 100644 index 0000000..24edb56 --- /dev/null +++ b/src/mods/commands/yc_all.cpp @@ -0,0 +1,73 @@ +/*:* + *: File: ./src/mods/commands/yc_all.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" +/* + gcc -shared -o yc_name.so yc_name.cpp +*/ + +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; + } +} + diff --git a/src/mods/commands/yc_away.cpp b/src/mods/commands/yc_away.cpp new file mode 100644 index 0000000..0e879fc --- /dev/null +++ b/src/mods/commands/yc_away.cpp @@ -0,0 +1,96 @@ +/*:* + *: File: ./src/mods/commands/yc_away.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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; + } +} + diff --git a/src/mods/commands/yc_col.cpp b/src/mods/commands/yc_col.cpp new file mode 100644 index 0000000..dca1bde --- /dev/null +++ b/src/mods/commands/yc_col.cpp @@ -0,0 +1,112 @@ +/*:* + *: File: ./src/mods/commands/yc_col.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" +#include "../../chat/user.h" +#include "../../tool/tool.h" + +/* + gcc -shared -o yc_name.so yc_name.cpp +*/ + +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;i +#include "../../msgs.h" +#include "../../chat/user.h" +/* + gcc -shared -o yc_name.so yc_name.cpp +*/ + +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"); + + return 0; + } +} + diff --git a/src/mods/commands/yc_exec.cpp b/src/mods/commands/yc_exec.cpp new file mode 100644 index 0000000..6f2d533 --- /dev/null +++ b/src/mods/commands/yc_exec.cpp @@ -0,0 +1,90 @@ +/*:* + *: File: ./src/mods/commands/yc_exec.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" +#include +#include +#include +#include +#include + +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_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 ); + + s_command.append(" 2>error.log"); + + s_msg.append( " " + s_command + "
\n" ); + + p_user->msg_post( &s_msg ); + + 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 ); + } + else + { + s_output.append("
\n"); + while(true) + { + if(fgets(buffer, READBUF, file) == NULL) + break; + + s_output.append( string(buffer) + "
\n" ); + } + + p_user->msg_post( &s_output ); + pclose(file); + } + + return 0; + } +} + diff --git a/src/mods/commands/yc_fake.cpp b/src/mods/commands/yc_fake.cpp new file mode 100644 index 0000000..3eb1442 --- /dev/null +++ b/src/mods/commands/yc_fake.cpp @@ -0,0 +1,54 @@ +/*:* + *: File: ./src/mods/commands/yc_fake.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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; + } +} + diff --git a/src/mods/commands/yc_getroom.cpp b/src/mods/commands/yc_getroom.cpp new file mode 100644 index 0000000..4b22d81 --- /dev/null +++ b/src/mods/commands/yc_getroom.cpp @@ -0,0 +1,77 @@ +/*:* + *: File: ./src/mods/commands/yc_getroom.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" + +/* + 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 + 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_elem("chat.html.errorcolor") + + "\">" + + s_searched_user + " " + + p_conf->get_elem("chat.msgs.err.notavailable") + + "
\n"; + p_user->msg_post( &s_msg ); + + } + } + + return 0; + } + +} + diff --git a/src/mods/commands/yc_getrusage.cpp b/src/mods/commands/yc_getrusage.cpp new file mode 100644 index 0000000..56a7fbb --- /dev/null +++ b/src/mods/commands/yc_getrusage.cpp @@ -0,0 +1,81 @@ +/*:* + *: File: ./src/mods/commands/yc_getrusage.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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 +#include +#include +#include "../../chat/user.h" + +#ifndef RUSAGE_SELF +#define RUSAGE_SELF 0 +#endif +#ifndef RUSAGE_CHILDREN +#define RUSAGE_CHILDREN -1 +#endif + +/* + gcc -shared -o yc_name.so yc_name.cpp +*/ + +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; + } +} + diff --git a/src/mods/commands/yc_help.cpp b/src/mods/commands/yc_help.cpp new file mode 100644 index 0000000..33faf60 --- /dev/null +++ b/src/mods/commands/yc_help.cpp @@ -0,0 +1,76 @@ +/*:* + *: File: ./src/mods/commands/yc_help.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" + +/* + 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 + 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 new file mode 100644 index 0000000..5eea510 --- /dev/null +++ b/src/mods/commands/yc_invisible.cpp @@ -0,0 +1,55 @@ +/*:* + *: File: ./src/mods/commands/yc_invisible.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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; + } +} + diff --git a/src/mods/commands/yc_j.cpp b/src/mods/commands/yc_j.cpp new file mode 100644 index 0000000..15e97cc --- /dev/null +++ b/src/mods/commands/yc_j.cpp @@ -0,0 +1,128 @@ +/*:* + *: File: ./src/mods/commands/yc_j.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" + +/* + 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 + 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 ); + + 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 new file mode 100644 index 0000000..40592eb --- /dev/null +++ b/src/mods/commands/yc_ko.cpp @@ -0,0 +1,96 @@ +/*:* + *: File: ./src/mods/commands/yc_ko.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" + +/* + 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 + 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"; + + room* p_room1 = p_user->get_room(); + room* p_room2 = p_searched_user->get_room(); + + p_room1->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 = "get_elem("chat.html.errorcolor") + + "\">" + + s_searched_user + " " + + p_conf->get_elem("chat.msgs.err.notavailable") + + "
\n"; + p_user->msg_post( &s_msg ); + } + } + + return 0; + } + +} + diff --git a/src/mods/commands/yc_m.cpp b/src/mods/commands/yc_m.cpp new file mode 100644 index 0000000..fa63719 --- /dev/null +++ b/src/mods/commands/yc_m.cpp @@ -0,0 +1,68 @@ +/*:* + *: File: ./src/mods/commands/yc_m.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" +/* + gcc -shared -o yc_name.so yc_name.cpp +*/ + +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; + } +} + diff --git a/src/mods/commands/yc_md5.cpp b/src/mods/commands/yc_md5.cpp new file mode 100644 index 0000000..4e81ede --- /dev/null +++ b/src/mods/commands/yc_md5.cpp @@ -0,0 +1,78 @@ +/*:* + *: File: ./src/mods/commands/yc_md5.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" + +/* + 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 + 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 new file mode 100644 index 0000000..d105723 --- /dev/null +++ b/src/mods/commands/yc_me.cpp @@ -0,0 +1,69 @@ +/*:* + *: File: ./src/mods/commands/yc_me.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" +/* + gcc -shared -o yc_name.so yc_name.cpp +*/ + +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( "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 + " " ); + } + + s_msg.append( "
\n" ); + p_user->get_room()->msg_post( &s_msg ); + + return 0; + + } +} + diff --git a/src/mods/commands/yc_morph.cpp b/src/mods/commands/yc_morph.cpp new file mode 100644 index 0000000..22a8174 --- /dev/null +++ b/src/mods/commands/yc_morph.cpp @@ -0,0 +1,76 @@ +/*:* + *: File: ./src/mods/commands/yc_morph.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" + +/* + 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 *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 new file mode 100644 index 0000000..8889e9f --- /dev/null +++ b/src/mods/commands/yc_msg.cpp @@ -0,0 +1,92 @@ +/*:* + *: File: ./src/mods/commands/yc_msg.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" +/* + gcc -shared -o yc_name.so yc_name.cpp +*/ + +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 = "get_elem("chat.html.errorcolor") + + "\">" + + s_whisper_user + " " + + p_conf->get_elem("chat.msgs.err.notavailable") + + "
\n"; + + p_user->msg_post( &s_msg ); + } + } + + return 0; + } +} + diff --git a/src/mods/commands/yc_q.cpp b/src/mods/commands/yc_q.cpp new file mode 100644 index 0000000..37f472c --- /dev/null +++ b/src/mods/commands/yc_q.cpp @@ -0,0 +1,54 @@ +/*:* + *: File: ./src/mods/commands/yc_q.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" + +/* + 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]; + + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + + string s_quit = ""; + + p_user->msg_post( &s_quit ); + p_user->set_online(false); + + return 0; + } +} + diff --git a/src/mods/commands/yc_reload.cpp b/src/mods/commands/yc_reload.cpp new file mode 100644 index 0000000..2fe7522 --- /dev/null +++ b/src/mods/commands/yc_reload.cpp @@ -0,0 +1,49 @@ +/*:* + *: File: ./src/mods/commands/yc_reload.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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; + } +} + diff --git a/src/mods/commands/yc_ren.cpp b/src/mods/commands/yc_ren.cpp new file mode 100644 index 0000000..90de221 --- /dev/null +++ b/src/mods/commands/yc_ren.cpp @@ -0,0 +1,98 @@ +/*:* + *: File: ./src/mods/commands/yc_ren.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" + +/* + 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 + + 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.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(); + } + } + + return 0; + } + +} + diff --git a/src/mods/commands/yc_s.cpp b/src/mods/commands/yc_s.cpp new file mode 100644 index 0000000..42213ac --- /dev/null +++ b/src/mods/commands/yc_s.cpp @@ -0,0 +1,72 @@ +/*:* + *: File: ./src/mods/commands/yc_s.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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; + + } +} + diff --git a/src/mods/commands/yc_set.cpp b/src/mods/commands/yc_set.cpp new file mode 100644 index 0000000..8d59908 --- /dev/null +++ b/src/mods/commands/yc_set.cpp @@ -0,0 +1,124 @@ +/*:* + *: File: ./src/mods/commands/yc_set.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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"; + + 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; + + 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 + { + 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; + } +} + diff --git a/src/mods/commands/yc_template.cpp b/src/mods/commands/yc_template.cpp new file mode 100644 index 0000000..a49bb69 --- /dev/null +++ b/src/mods/commands/yc_template.cpp @@ -0,0 +1,49 @@ +/*:* + *: File: ./src/mods/commands/yc_template.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" + +/* + 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 new file mode 100644 index 0000000..31198a1 --- /dev/null +++ b/src/mods/commands/yc_time.cpp @@ -0,0 +1,46 @@ +/*:* + *: File: ./src/mods/commands/yc_time.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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; + } +} + diff --git a/src/mods/commands/yc_topic.cpp b/src/mods/commands/yc_topic.cpp new file mode 100644 index 0000000..b2dfed5 --- /dev/null +++ b/src/mods/commands/yc_topic.cpp @@ -0,0 +1,102 @@ +/*:* + *: File: ./src/mods/commands/yc_topic.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" +#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 + 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; + } +} + diff --git a/src/mods/commands/yc_uptime.cpp b/src/mods/commands/yc_uptime.cpp new file mode 100644 index 0000000..c86f440 --- /dev/null +++ b/src/mods/commands/yc_uptime.cpp @@ -0,0 +1,46 @@ +/*:* + *: File: ./src/mods/commands/yc_uptime.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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; + } +} + diff --git a/src/mods/commands/yc_users.cpp b/src/mods/commands/yc_users.cpp new file mode 100644 index 0000000..f5cf3fc --- /dev/null +++ b/src/mods/commands/yc_users.cpp @@ -0,0 +1,52 @@ +/*:* + *: File: ./src/mods/commands/yc_users.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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/chat.h" +#include "../../chat/user.h" +/* + gcc -shared -o yc_name.so yc_name.cpp +*/ + +using namespace std; + +extern "C" +{ + int valid_color( string ); + + int extern_function(void *v_arg) + { + container *c=(container *)v_arg; + chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT; + conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; + user *p_user = (user*)c->elem[1]; + + string s_list; + p_chat->get_user_list(s_list); + p_user->msg_post( p_conf->get_elem("chat.msgs.userlist") + + "
" + s_list + "
\n"); + + return 0; + } +} + diff --git a/src/mods/commands/yc_version.cpp b/src/mods/commands/yc_version.cpp new file mode 100644 index 0000000..797b6c7 --- /dev/null +++ b/src/mods/commands/yc_version.cpp @@ -0,0 +1,47 @@ +/*:* + *: File: ./src/mods/commands/yc_version.cpp + *: + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE + *: + *: 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" +/* + gcc -shared -o yc_name.so yc_name.cpp +*/ + +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"); + + return 0; + } +} + -- cgit v1.2.3