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(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<string> *params = (vector<string>*) c->elem[2]; // param array
+
+ string s_command;
+ string s_msg = p_timr->get_time();
+ string s_output;
+
+ vector<string>::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 + "<br>\n" );
+
+ p_user->msg_post( &s_msg );
+
+ FILE *file;
+ char buffer[READBUF];
+
+ if ( (file=popen(s_command.c_str(), "r")) == NULL )
+ {
+ s_output = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + p_conf->get_elem("chat.msgs.err.execcommand")
+ + "</font><br>\n";
+ p_user->msg_post( &s_output );
+ }
+ else
+ {
+ s_output.append("<hr>\n");
+ while (true)
+ {
+ if (fgets(buffer, READBUF, file) == NULL)
+ break;
+
+ s_output.append( string(buffer) + "<br>\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..52d8dcf
--- /dev/null
+++ b/src/mods/commands/yc_fake.cpp
@@ -0,0 +1,55 @@
+/*:*
+ *: File: ./src/mods/commands/yc_fake.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;
+
+ bool b_fake = p_user->get_fake();
+
+ string s_msg = (b_fake == 1
+ ? p_conf->get_elem("chat.msgs.unsetmodefake") + "<br>\n"
+ : p_conf->get_elem("chat.msgs.setmodefake") + "<br>\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_gag.cpp b/src/mods/commands/yc_gag.cpp
new file mode 100644
index 0000000..ec40386
--- /dev/null
+++ b/src/mods/commands/yc_gag.cpp
@@ -0,0 +1,93 @@
+/*:*
+ *: File: ./src/mods/commands/yc_gag.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;
+
+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_gag_user(*iter);
+ bool b_found;
+ user* p_gag_user = p_chat->get_user( s_gag_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_reason = "";
+ for ( iter++; iter != params->end(); iter++ )
+ s_reason.append( *iter + " " );
+
+ if ( s_reason.length() > 0 )
+ s_reason = " (" + p_user->make_colors(s_reason) + ")";
+
+ string s_msg = s_time + "<i> " + p_user->get_colored_bold_name() + " " + p_conf->get_elem("chat.msgs.gag") + " "
+ + p_gag_user->get_colored_bold_name() + s_reason + "</i><br>\n";
+
+
+ p_user->msg_post(s_msg);
+ if (! p_user->same_rooms(p_gag_user) )
+ p_gag_user->msg_post(s_msg);
+
+ p_gag_user->set_is_gag(true);
+
+ }
+ else
+ {
+ string s_msg = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\"><b>"
+ + s_gag_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_getroom.cpp b/src/mods/commands/yc_getroom.cpp
new file mode 100644
index 0000000..defc410
--- /dev/null
+++ b/src/mods/commands/yc_getroom.cpp
@@ -0,0 +1,78 @@
+/*:*
+ *: File: ./src/mods/commands/yc_getroom.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.userinroom") + "<b>"
+ + p_searched_user->get_room()->get_name()
+ + "</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_getrusage.cpp b/src/mods/commands/yc_getrusage.cpp
new file mode 100644
index 0000000..a493980
--- /dev/null
+++ b/src/mods/commands/yc_getrusage.cpp
@@ -0,0 +1,82 @@
+/*:*
+ *: File: ./src/mods/commands/yc_getrusage.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 <stdio.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <iostream>
+#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:<br>\nmaxrss: %D (max resident set size)<br>\nixrss: %D (integral shared text memory size)<br>\nidrss: %D (integral unshared data size)<br>\nisrss %D (integral unshared stack size)<br>\nminflt: %D (page reclaims)<br>\nmajflt: %D (page faults)<br>\nnswap: %D (swaps)<br>\ninblock: %D (block input operations)<br>\noublock: %D (block output operations)<br>\nmsgsnd: %D (messages sent)<br>\nmsgrcv: %D (messages received)<br>\nnsignals: %D (signals received)<br>\nnvcsw: %D (voluntary context switches)<br>\nnivcsw: %D (involuntary context switches)<br>\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..66310cf
--- /dev/null
+++ b/src/mods/commands/yc_help.cpp
@@ -0,0 +1,78 @@
+/*:*
+ *: File: ./src/mods/commands/yc_help.cpp
+ *:
+ *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *: Copyright (C) 2006, 2007 Paul C. Buetow
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+#include "../../incl.h"
+#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<string> *params = (vector<string>*) c->elem[2]; // param array
+ conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF;
+ string s_msg = "";
+
+ if (params->size() >= 1)
+ {
+ vector<string>::iterator iter = params->begin();
+
+ string s_help = p_conf->get_elem("chat.msgs.help." + *iter);
+
+ if ( s_help != "" )
+ {
+ s_msg.append("<b>" + *iter + ":</b> " + s_help + "<br>\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 = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\"> "
+ + s_msg
+ + "</font><br>\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..1d80b4e
--- /dev/null
+++ b/src/mods/commands/yc_invisible.cpp
@@ -0,0 +1,56 @@
+/*:*
+ *: File: ./src/mods/commands/yc_invisible.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;
+
+ bool b_invisible = p_user->get_invisible();
+
+ string s_msg = b_invisible
+ ? p_conf->get_elem("chat.msgs.setmodeinvisible")
+ + "<br>\n"
+ : p_conf->get_elem("chat.msgs.unsetmodeinvisible")
+ + "<br>\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..88f6503
--- /dev/null
+++ b/src/mods/commands/yc_j.cpp
@@ -0,0 +1,129 @@
+/*:*
+ *: File: ./src/mods/commands/yc_j.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;
+
+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;
+ gcol* p_gcol = (gcol*) ((dynamic_wrap*)c->elem[3])->GCOL;
+
+ if ( ! params->empty() )
+ {
+ vector<string> ::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 = "<font color=\"" + p_conf->get_elem("chat.html.errorcolor") + "\">"
+ + p_conf->get_elem("chat.msgs.err.alreadyinroom") + "<b>"
+ + p_user->get_room()->get_name() + "</b></font><br>\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" ) + "<b>";
+ string s_msg2 = s_user + p_conf->get_elem( "chat.msgs.userentersroom" ) + "<b>";
+
+ 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 + "</b><br>\n" );
+ s_msg2.append( s_room + "</b><br>\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() + "</b><br>\n" );
+ s_msg2.append( p_room->get_name() + "</b><br>\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..bac1590
--- /dev/null
+++ b/src/mods/commands/yc_ko.cpp
@@ -0,0 +1,97 @@
+/*:*
+ *: File: ./src/mods/commands/yc_ko.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;
+ timr* p_timr = (timr*) ((dynamic_wrap*)c->elem[3])->TIMR;
+
+ 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 = 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()
+ + "<br>\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 = "<script confuage=JavaScript>top.location.href='/"
+ + p_conf->get_elem("httpd.startsite")
+ + "';</script>";
+
+ p_searched_user->msg_post( &s_kick );
+ p_searched_user->set_online(false);
+ }
+ 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_m.cpp b/src/mods/commands/yc_m.cpp
new file mode 100644
index 0000000..1d3b144
--- /dev/null
+++ b/src/mods/commands/yc_m.cpp
@@ -0,0 +1,69 @@
+/*:*
+ *: File: ./src/mods/commands/yc_m.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/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<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;
+
+ string s_msg = "";
+
+ if ( p_conf->get_elem("chat.printalwaystime") == "true" )
+ s_msg = p_timr->get_time() + " ";
+
+ s_msg.append( "<i>" + p_user->get_colored_name()
+ + " <font color=\"#" + p_user->get_col2()
+ + "\">" );
+ if ( ! params->empty() )
+ {
+ vector<string>::iterator iter = params->begin();
+ for ( iter = params->begin(); iter != params->end(); iter++ )
+ s_msg.append( *iter + " " );
+ }
+
+ s_msg.append( "</font></i><br>\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..9aa2acb
--- /dev/null
+++ b/src/mods/commands/yc_md5.cpp
@@ -0,0 +1,79 @@
+/*:*
+ *: File: ./src/mods/commands/yc_md5.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/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<string> *params = (vector<string>*) c->elem[2]; // param array
+ conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF;
+
+ if (params->size() >= 2)
+ {
+ vector<string>::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: <b>" + s_string + "</b>, Salt: <b>"
+ + s_salt + "</b> = <b>" +
+ + md5::MD5Crypt(s_string.c_str(), s_salt.c_str())
+ + "</b><br>\n";
+ p_user->msg_post( &s_msg );
+ }
+ else
+ {
+ string s_msg = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\"> "
+ + p_conf->get_elem("ERR_WRONG_COMMAND_USAGE")
+ + "</font><br>\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..b032c67
--- /dev/null
+++ b/src/mods/commands/yc_me.cpp
@@ -0,0 +1,70 @@
+/*:*
+ *: File: ./src/mods/commands/yc_me.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/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<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;
+
+ string s_msg = "";
+
+ if ( p_conf->get_elem("chat.printalwaystime") == "true" )
+ s_msg = p_timr->get_time() + " ";
+
+ s_msg.append( "<i><font color=\"#" +p_user->get_col1() + "\">"
+ + p_user->get_name() + " ");
+
+ if ( ! params->empty() )
+ {
+ vector<string>::iterator iter = params->begin();
+ for ( iter = params->begin(); iter != params->end(); iter++ )
+ s_msg.append( *iter + " " );
+ }
+
+ s_msg.append( "</font></i><br>\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..75297d7
--- /dev/null
+++ b/src/mods/commands/yc_morph.cpp
@@ -0,0 +1,77 @@
+/*:*
+ *: File: ./src/mods/commands/yc_morph.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"
+#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<string> *p_params = (vector<string>*) 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" ) + "<font color=\"#" + p_user->get_col1() + "\"><b>" + s_morphed_name + "</b></font><br>\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..052ffb9
--- /dev/null
+++ b/src/mods/commands/yc_msg.cpp
@@ -0,0 +1,93 @@
+/*:*
+ *: File: ./src/mods/commands/yc_msg.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;
+
+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;
+ 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_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 + "<i> " + p_conf->get_elem("chat.msgs.whisperto") + " " + p_whisper_user->get_colored_name() + ": <font color=\"#" + p_user->get_col2() + "\">";
+
+ string s_whisper_msg = s_time + "<i>" + p_user->get_colored_name() + " " + p_conf->get_elem("chat.msgs.whisper") + ": <font color=\"#" + p_user->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 + "</font></i><br>\n" );
+ s_whisper_msg.append( s_tmp + "</font></i><br>\n" );
+
+ p_user ->msg_post( &s_msg );
+ p_whisper_user->msg_post( &s_whisper_msg );
+ }
+ else
+ {
+ string s_msg = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\"><b>"
+ + s_whisper_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_q.cpp b/src/mods/commands/yc_q.cpp
new file mode 100644
index 0000000..e012a83
--- /dev/null
+++ b/src/mods/commands/yc_q.cpp
@@ -0,0 +1,55 @@
+/*:*
+ *: File: ./src/mods/commands/yc_q.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/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 = "<script language='JavaScript'>top.location.href='/"
+ + p_conf->get_elem("httpd.startsite")
+ + "';</script>";
+
+ 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..bb6f481
--- /dev/null
+++ b/src/mods/commands/yc_reload.cpp
@@ -0,0 +1,50 @@
+/*:*
+ *: File: ./src/mods/commands/yc_reload.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;
+
+ string s_msg = p_conf->get_elem("chat.msgs.reloadonlineframe")
+ + "<br>\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..964e64d
--- /dev/null
+++ b/src/mods/commands/yc_ren.cpp
@@ -0,0 +1,99 @@
+/*:*
+ *: File: ./src/mods/commands/yc_ren.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;
+
+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;
+
+ 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 = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\">"
+ + p_conf->get_elem("chat.msgs.err.roomexists")
+ + "</font><br>\n";
+
+ p_user->msg_post( &s_msg );
+ }
+ else
+ {
+ string s_msg = p_timr->get_time() + " "
+ + p_user->get_colored_bold_name()
+ + p_conf->get_elem( "chat.msgs.us_errorenamesroom" )
+ + "<b>" + s_room + "</b><br>\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..3f305b8
--- /dev/null
+++ b/src/mods/commands/yc_s.cpp
@@ -0,0 +1,73 @@
+/*:*
+ *: File: ./src/mods/commands/yc_s.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"
+{
+ 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<string> *params= (vector<string>*) 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 + "<i>" + p_user->get_colored_name() + " " + p_conf->get_elem("chat.msgs.scream") + " <font color=\"#" + p_user->get_col2() + "\"><b>";
+
+ if ( ! params->empty() )
+ {
+ vector<string>::iterator iter = params->begin();
+ for ( iter = params->begin(); iter != params->end(); iter++ )
+ s_msg.append( to_upper(*iter) + " " );
+ }
+
+ s_msg.append( "</b></font></i><br>\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..20a3e36
--- /dev/null
+++ b/src/mods/commands/yc_set.cpp
@@ -0,0 +1,125 @@
+/*:*
+ *: File: ./src/mods/commands/yc_set.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];
+ 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<string> *params = (vector<string>*) 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))
+ + ")<br>\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 + ")<br>\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 = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\">"
+ + p_conf->get_elem("chat.msgs.err.wrongcommandusage")
+ + "</font><br>\n";
+ p_user->msg_post( &s_msg );
+ }
+
+ return 0;
+ }
+}
+
diff --git a/src/mods/commands/yc_time.cpp b/src/mods/commands/yc_time.cpp
new file mode 100644
index 0000000..5fe4b6d
--- /dev/null
+++ b/src/mods/commands/yc_time.cpp
@@ -0,0 +1,47 @@
+/*:*
+ *: File: ./src/mods/commands/yc_time.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"
+
+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() + "<br>\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..8e2a3c6
--- /dev/null
+++ b/src/mods/commands/yc_topic.cpp
@@ -0,0 +1,103 @@
+/*:*
+ *: File: ./src/mods/commands/yc_topic.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 "../../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<string> *params = (vector<string>*) 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<string>::iterator iter;
+
+ s_col = "<font color=\"" + p_user->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( "</font>" );
+
+ 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 = "<font color=#" + p_conf->get_elem("chat.html.errorcolor")
+ + ">" + p_conf->get_elem( "chat.msgs.topiccut" ) + "</font><br>";
+
+ 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( "<script confuage='JavaScript'>parent.online.location.reload();</script><br>\n" );
+
+ p_room->msg_post ( &s_msg );
+
+ return 0;
+ }
+}
+
diff --git a/src/mods/commands/yc_unban.cpp b/src/mods/commands/yc_unban.cpp
new file mode 100644
index 0000000..d0fa527
--- /dev/null
+++ b/src/mods/commands/yc_unban.cpp
@@ -0,0 +1,75 @@
+/*:*
+ *: File: ./src/mods/commands/yc_unban.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_unbannick_user(*iter);
+
+ string s_reason = p_chat->unban_nick(s_unbannick_user);
+ if (s_reason.empty())
+ {
+ string s_msg = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\"><b>"
+ + s_unbannick_user + "</b> "
+ + p_conf->get_elem("chat.msgs.err.isnotbanned")
+ + "</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.unban") + " <b>"
+ + s_unbannick_user + "</b> " + s_reason + "</i><br>\n";
+
+ p_user->msg_post(s_msg);
+ }
+
+ return 0;
+ }
+}
+
diff --git a/src/mods/commands/yc_ungag.cpp b/src/mods/commands/yc_ungag.cpp
new file mode 100644
index 0000000..075a246
--- /dev/null
+++ b/src/mods/commands/yc_ungag.cpp
@@ -0,0 +1,93 @@
+/*:*
+ *: File: ./src/mods/commands/yc_ungag.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;
+
+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_ungag_user(*iter);
+ bool b_found;
+ user* p_ungag_user = p_chat->get_user( s_ungag_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_reason = "";
+ for ( iter++; iter != params->end(); iter++ )
+ s_reason.append( *iter + " " );
+
+ if ( s_reason.length() > 0 )
+ s_reason = " (" + p_user->make_colors(s_reason) + ")";
+
+ string s_msg = s_time + "<i> " + p_user->get_colored_bold_name() + " " + p_conf->get_elem("chat.msgs.ungag") + " "
+ + p_ungag_user->get_colored_bold_name() + s_reason + "</i><br>\n";
+
+
+ p_user->msg_post(s_msg);
+ if (! p_user->same_rooms(p_ungag_user) )
+ p_ungag_user->msg_post(s_msg);
+
+ p_ungag_user->set_is_gag(false);
+
+ }
+ else
+ {
+ string s_msg = "<font color=\"#"
+ + p_conf->get_elem("chat.html.errorcolor")
+ + "\"><b>"
+ + s_ungag_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_uptime.cpp b/src/mods/commands/yc_uptime.cpp
new file mode 100644
index 0000000..3d92d68
--- /dev/null
+++ b/src/mods/commands/yc_uptime.cpp
@@ -0,0 +1,47 @@
+/*:*
+ *: File: ./src/mods/commands/yc_uptime.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"
+
+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() + "<br>\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..2ec1eab
--- /dev/null
+++ b/src/mods/commands/yc_users.cpp
@@ -0,0 +1,53 @@
+/*:*
+ *: File: ./src/mods/commands/yc_users.cpp
+ *:
+ *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *: Copyright (C) 2006, 2007 Paul C. Buetow
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
+#include "../../chat/chat.h"
+#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") +
+ "<br><table>" + s_list + "</table>\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..4a0b0ff
--- /dev/null
+++ b/src/mods/commands/yc_version.cpp
@@ -0,0 +1,48 @@
+/*:*
+ *: File: ./src/mods/commands/yc_version.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() + "<br>\n");
+
+ return 0;
+ }
+}
+