summaryrefslogtreecommitdiff
path: root/src/mods/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/mods/commands')
-rw-r--r--src/mods/commands/Makefile53
-rw-r--r--src/mods/commands/yc_about.cpp84
-rw-r--r--src/mods/commands/yc_all.cpp74
-rw-r--r--src/mods/commands/yc_away.cpp97
-rw-r--r--src/mods/commands/yc_ban.cpp109
-rw-r--r--src/mods/commands/yc_banned.cpp69
-rw-r--r--src/mods/commands/yc_col.cpp113
-rw-r--r--src/mods/commands/yc_compopt.cpp48
-rw-r--r--src/mods/commands/yc_debug.cpp68
-rw-r--r--src/mods/commands/yc_exec.cpp91
-rw-r--r--src/mods/commands/yc_fake.cpp55
-rw-r--r--src/mods/commands/yc_gag.cpp93
-rw-r--r--src/mods/commands/yc_getroom.cpp78
-rw-r--r--src/mods/commands/yc_getrusage.cpp82
-rw-r--r--src/mods/commands/yc_help.cpp78
-rw-r--r--src/mods/commands/yc_invisible.cpp56
-rw-r--r--src/mods/commands/yc_j.cpp129
-rw-r--r--src/mods/commands/yc_ko.cpp97
-rw-r--r--src/mods/commands/yc_m.cpp69
-rw-r--r--src/mods/commands/yc_md5.cpp79
-rw-r--r--src/mods/commands/yc_me.cpp70
-rw-r--r--src/mods/commands/yc_morph.cpp77
-rw-r--r--src/mods/commands/yc_msg.cpp93
-rw-r--r--src/mods/commands/yc_q.cpp55
-rw-r--r--src/mods/commands/yc_reload.cpp50
-rw-r--r--src/mods/commands/yc_ren.cpp99
-rw-r--r--src/mods/commands/yc_s.cpp73
-rw-r--r--src/mods/commands/yc_set.cpp125
-rw-r--r--src/mods/commands/yc_time.cpp47
-rw-r--r--src/mods/commands/yc_topic.cpp103
-rw-r--r--src/mods/commands/yc_unban.cpp75
-rw-r--r--src/mods/commands/yc_ungag.cpp93
-rw-r--r--src/mods/commands/yc_uptime.cpp47
-rw-r--r--src/mods/commands/yc_users.cpp53
-rw-r--r--src/mods/commands/yc_version.cpp48
35 files changed, 2730 insertions, 0 deletions
diff --git a/src/mods/commands/Makefile b/src/mods/commands/Makefile
new file mode 100644
index 0000000..bed632e
--- /dev/null
+++ b/src/mods/commands/Makefile
@@ -0,0 +1,53 @@
+SRCS=$(shell find ./ -name '*.cpp')
+MODS=$(addprefix ../../../mods/commands/, $(SRCS:.cpp=.so))
+CXX=g++
+CXXFLAGS=-fno-inline -fno-default-inline -g -O2 ${EFLAGS}
+all: mods
+${MODS}:
+ @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi
+ @${CXX} ${CXXGLAGS} -fPIC -shared -s -o $@ ` \
+ echo $(notdir $@) | sed s/.so/.cpp/`
+ @echo "mods:commands:`basename $@ | sed s/\.so// | sed s/yc_//` (` \
+ du -hs $@ | awk '{ print $$1 }'`) "
+infotext:
+ @echo "===> Compiling commands modules"
+mods: infotext ${MODS}
+ @echo "===> Num of commands modules: `ls \
+ ../../../mods/commands/*.so | wc -l | sed 's/ //g;'`"
+clean:
+ @echo "===> Cleaning commands modules"
+ @if test -d ../../../mods/commands; then rm -Rf ../../../mods/commands; fi
+../../../mods/commands/./yc_about.so: yc_about.cpp
+../../../mods/commands/./yc_all.so: yc_all.cpp
+../../../mods/commands/./yc_away.so: yc_away.cpp
+../../../mods/commands/./yc_ban.so: yc_ban.cpp
+../../../mods/commands/./yc_banned.so: yc_banned.cpp
+../../../mods/commands/./yc_col.so: yc_col.cpp
+../../../mods/commands/./yc_compopt.so: yc_compopt.cpp
+../../../mods/commands/./yc_debug.so: yc_debug.cpp
+../../../mods/commands/./yc_exec.so: yc_exec.cpp
+../../../mods/commands/./yc_fake.so: yc_fake.cpp
+../../../mods/commands/./yc_gag.so: yc_gag.cpp
+../../../mods/commands/./yc_getroom.so: yc_getroom.cpp
+../../../mods/commands/./yc_getrusage.so: yc_getrusage.cpp
+../../../mods/commands/./yc_help.so: yc_help.cpp
+../../../mods/commands/./yc_invisible.so: yc_invisible.cpp
+../../../mods/commands/./yc_j.so: yc_j.cpp
+../../../mods/commands/./yc_ko.so: yc_ko.cpp
+../../../mods/commands/./yc_m.so: yc_m.cpp
+../../../mods/commands/./yc_md5.so: yc_md5.cpp
+../../../mods/commands/./yc_me.so: yc_me.cpp
+../../../mods/commands/./yc_morph.so: yc_morph.cpp
+../../../mods/commands/./yc_msg.so: yc_msg.cpp
+../../../mods/commands/./yc_q.so: yc_q.cpp
+../../../mods/commands/./yc_reload.so: yc_reload.cpp
+../../../mods/commands/./yc_ren.so: yc_ren.cpp
+../../../mods/commands/./yc_s.so: yc_s.cpp
+../../../mods/commands/./yc_set.so: yc_set.cpp
+../../../mods/commands/./yc_time.so: yc_time.cpp
+../../../mods/commands/./yc_topic.so: yc_topic.cpp
+../../../mods/commands/./yc_unban.so: yc_unban.cpp
+../../../mods/commands/./yc_ungag.so: yc_ungag.cpp
+../../../mods/commands/./yc_uptime.so: yc_uptime.cpp
+../../../mods/commands/./yc_users.so: yc_users.cpp
+../../../mods/commands/./yc_version.so: yc_version.cpp
diff --git a/src/mods/commands/yc_about.cpp b/src/mods/commands/yc_about.cpp
new file mode 100644
index 0000000..38862a3
--- /dev/null
+++ b/src/mods/commands/yc_about.cpp
@@ -0,0 +1,84 @@
+/*:*
+ *: File: ./src/mods/commands/yc_about.cpp
+ *:
+ *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *: Copyright (C) 2006, 2007 Paul C. Buetow
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+#include "../../incl.h"
+
+/*
+ gcc -shared -o yc_name.so yc_name.cpp
+*/
+
+using namespace std;
+
+extern "C"
+{
+ int extern_function(void *v_arg)
+ {
+
+ container *c=(container *)v_arg;
+
+ user *p_user = (user*) c->elem[1]; // the corresponding user
+ vector<string> *params = (vector<string>*) 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<string>::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 = "<b>" + p_searched_user->get_colored_name() + "</b>"
+ + p_conf->get_elem("chat.msgs.userhasstatus") + "<b>"
+ + tool::int2string(p_searched_user->get_status())
+ + "</b>, "
+ + p_conf->get_elem("chat.msgs.userinroom") + "<b>"
+ + p_searched_user->get_room()->get_name()
+ + "</b><br>\n"
+ + p_conf->get_elem("chat.msgs.lastactivity") + "<b>"
+ + tool::int2string((int)( p_searched_user->get_last_activity()))
+ + "</b><br>\n";
+ p_user->msg_post( &s_msg );
+ }
+ else
+ {
+ string s_msg = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\"><b>"
+ + s_searched_user + "</b> "
+ + p_conf->get_elem("chat.msgs.err.notavailable")
+ + "</font><br>\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..961a051
--- /dev/null
+++ b/src/mods/commands/yc_all.cpp
@@ -0,0 +1,74 @@
+/*:*
+ *: File: ./src/mods/commands/yc_all.cpp
+ *:
+ *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *: Copyright (C) 2006, 2007 Paul C. Buetow
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+#include <iostream>
+#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<string> *params= (vector<string>*) 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<string>::iterator iter = params->begin();
+ for ( iter = params->begin(); iter != params->end(); iter++ )
+ s_tmp.append( *iter + " " );
+
+ s_msg = p_timr->get_time() + " <b><font color=\"#"
+ + p_conf->get_elem("chat.html.sysmsgcolor")
+ + "\"> "
+ + p_conf->get_elem("chat.msgs.system");
+
+ p_chat->string_replacer(&s_tmp);
+ s_msg.append( s_tmp + "</font></b><br>\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..4034730
--- /dev/null
+++ b/src/mods/commands/yc_away.cpp
@@ -0,0 +1,97 @@
+/*:*
+ *: File: ./src/mods/commands/yc_away.cpp
+ *:
+ *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *: Copyright (C) 2006, 2007 Paul C. Buetow
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+#include "../../incl.h"
+#include "../../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<string> *params = (vector<string>*) c->elem[2]; // param array
+
+ string s_msg;
+ string s_away;
+ string s_col;
+
+ vector<string>::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")
+ + "<font color=" + p_user->get_col2() + ">";
+
+ 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( "</font><br>\n" );
+
+ room* p_room = p_user->get_room();
+
+ // Remove ' from away message:
+ unsigned long 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_ban.cpp b/src/mods/commands/yc_ban.cpp
new file mode 100644
index 0000000..010b180
--- /dev/null
+++ b/src/mods/commands/yc_ban.cpp
@@ -0,0 +1,109 @@
+/*:*
+ *: File: ./src/mods/commands/yc_ban.cpp
+ *:
+ *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *: Copyright (C) 2006, 2007 Paul C. Buetow
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+#include "../../chat/user.h"
+#include "../../chat/room.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
+ vector<string> *params = (vector<string>*) 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<string>::iterator iter = params->begin();
+ string s_bannick_user(*iter);
+ //if (string.find(".") != string::npos) {
+ //}
+
+ bool b_found;
+ user* p_bannick_user = p_chat->get_user( s_bannick_user, b_found );
+
+ if ( b_found )
+ {
+ string s_reason = "";
+ for ( iter++; iter != params->end(); iter++ )
+ s_reason.append( *iter + " " );
+
+ bool b_reason = s_reason.length() > 0;
+
+ string s_retmsg = p_chat->ban_nick(s_bannick_user, string("( " + p_user->get_colored_name() + (b_reason ? ": " : "") + s_reason + " )"));
+ if (!s_retmsg.empty())
+ {
+ string s_msg = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\"><b>"
+ + s_bannick_user + "</b> "
+ + p_conf->get_elem("chat.msgs.err.alreadybanned")
+ + " " + s_retmsg
+ + "</font><br>\n";
+
+ p_user->msg_post( &s_msg );
+ return 0;
+ }
+
+ string s_time = "";
+ if ( p_conf->get_elem("chat.printalwaystime") == "true" )
+ s_time = p_timr->get_time() + " ";
+
+ string s_msg = s_time + "<i> " + p_user->get_colored_bold_name() + " " + p_conf->get_elem("chat.msgs.ban") + " "
+ + p_bannick_user->get_colored_bold_name();
+
+ if (b_reason)
+ s_msg.append( " ( " + s_reason + " )");
+
+ s_msg.append("</i><br>\n");
+
+ p_user->msg_post(s_msg);
+ if (! p_user->same_rooms(p_bannick_user) )
+ p_bannick_user->msg_post(s_msg);
+
+ }
+ else
+ {
+ string s_msg = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\"><b>"
+ + s_bannick_user + "</b> "
+ + p_conf->get_elem("chat.msgs.err.notavailable")
+ + "</font><br>\n";
+
+ p_user->msg_post( &s_msg );
+ }
+ }
+
+ return 0;
+ }
+}
+
diff --git a/src/mods/commands/yc_banned.cpp b/src/mods/commands/yc_banned.cpp
new file mode 100644
index 0000000..2dcdf97
--- /dev/null
+++ b/src/mods/commands/yc_banned.cpp
@@ -0,0 +1,69 @@
+/*:*
+ *: File: ./src/mods/commands/yc_banned.cpp
+ *:
+ *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *: Copyright (C) 2006, 2007 Paul C. Buetow
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+#include "../../chat/user.h"
+#include "../../chat/chat.h"
+#include "../../maps/shashmap.h"
+
+using namespace std;
+
+extern "C"
+{
+ int extern_function(void *v_arg)
+ {
+ container *c=(container *)v_arg;
+
+ user *p_user = (user*) c->elem[1];
+ chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT;
+ conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF;
+
+ shashmap<string>* map_banned_nicks = p_chat->get_map_banned_nicks();
+ string s_msg("");
+
+ if ( map_banned_nicks->size() > 0 )
+ {
+ vector<string>* vec_keys = map_banned_nicks->get_key_vector();
+
+ for (vector<string>::iterator iter = vec_keys->
+ begin();
+ iter != vec_keys->end();
+ ++iter)
+ s_msg.append(*iter + ": " + map_banned_nicks->get_elem(*iter) + "<br>\n");
+
+ }
+ else
+ {
+ s_msg = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\">"
+ + p_conf->get_elem("chat.msgs.err.nobanned")
+ + "</font><br>\n";
+ }
+
+ p_user->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..1a04ece
--- /dev/null
+++ b/src/mods/commands/yc_col.cpp
@@ -0,0 +1,113 @@
+/*:*
+ *: File: ./src/mods/commands/yc_col.cpp
+ *:
+ *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *: Copyright (C) 2006, 2007 Paul C. Buetow
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+#include <iostream>
+#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<string> *params= (vector<string>*) 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.<br>\n");
+ p_user->msg_post( answerstring );
+ }
+ else if ( valid_color(s_color2) != 1 )
+ {
+ string *answerstring=new string( s_color2 + " is not a valid color.<br>\n");
+ p_user->msg_post( answerstring );
+ }
+ else
+ {
+ string *answerstring=new string(p_timr->get_time() + " " + p_user->get_colored_bold_name()+ " changes color to <font color=\"#"
+ + s_color + "\">" + s_color + "</font> <font color=\"#"
+ + s_color2 + "\">" + s_color2 + "</font><br>\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<s_color.size();i++)
+ {
+ string s_char=s_color.substr(i,1);
+ if (valid.find(s_char)==string::npos)
+ return 0;
+ }
+
+ return 1;
+ }
+
+}
+
diff --git a/src/mods/commands/yc_compopt.cpp b/src/mods/commands/yc_compopt.cpp
new file mode 100644
index 0000000..c8b64bf
--- /dev/null
+++ b/src/mods/commands/yc_compopt.cpp
@@ -0,0 +1,48 @@
+/*:*
+ *: File: ./src/mods/commands/yc_compopt.cpp
+ *:
+ *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *: Copyright (C) 2006, 2007 Paul C. Buetow
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+#include <iostream>
+#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 + "<br>\n" + COMPOPT + "<br>\n");
+
+ return 0;
+ }
+}
+
diff --git a/src/mods/commands/yc_debug.cpp b/src/mods/commands/yc_debug.cpp
new file mode 100644
index 0000000..0109d02
--- /dev/null
+++ b/src/mods/commands/yc_debug.cpp
@@ -0,0 +1,68 @@
+/*:*
+ *: File: ./src/mods/commands/yc_debug.cpp
+ *:
+ *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *: Copyright (C) 2006, 2007 Paul C. Buetow
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+#include "../../chat/user.h"
+#include "../../chat/room.h"
+/*
+ gcc -shared -o yc_name.so yc_name.cpp
+*/
+
+using namespace std;
+
+// THIS MODULE IS FOR DEBUGGING PURPOSE ONLY, IT DOESNT HAVE ANY OTHER USE!
+
+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<string> *params = (vector<string>*) c->elem[2]; // param array
+ chat* p_chat = (chat*) ((dynamic_wrap*)c->elem[3])->CHAT;
+ sman* p_sman = (sman*) ((dynamic_wrap*)c->elem[3])->SMAN;
+
+ if ( ! params->empty() )
+ {
+ vector<string>::iterator iter = params->begin();
+ string s_test_user( *iter );
+ bool b_found;
+ user* p_whisper_user = p_chat->get_user( s_test_user, b_found );
+ sess *p_sess = p_sman->get_elem(p_user->get_tmpid());
+
+ string s_msg = "DEBUG-A: " + tool::long2string(reinterpret_cast<long>(p_sess->get_user())) + "<br>";
+ p_user->msg_post( &s_msg );
+
+ //p_user->debug();
+ s_msg = "DEBUG-B: " + tool::long2string(reinterpret_cast<long>(p_sess->get_user())) + "<br>";
+ p_user->msg_post( &s_msg );
+ }
+
+ return 0;
+ }
+}
+
diff --git a/src/mods/commands/yc_exec.cpp b/src/mods/commands/yc_exec.cpp
new file mode 100644
index 0000000..b87b3ed
--- /dev/null
+++ b/src/mods/commands/yc_exec.cpp
@@ -0,0 +1,91 @@
+/*:*
+ *: File: ./src/mods/commands/yc_exec.cpp
+ *:
+ *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *: Copyright (C) 2006, 2007 Paul C. Buetow
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+#include "../../incl.h"
+#include "../../chat/room.h"
+#include "../../chat/user.h"
+#include <unistd.h>
+#include <sys/wait.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+using namespace std;
+
+extern "C"
+{
+ int extern_function(