diff options
Diffstat (limited to 'src/mods/commands')
| -rw-r--r-- | src/mods/commands/Makefile.in | 18 | ||||
| -rw-r--r-- | src/mods/commands/yc_ban.cpp | 107 | ||||
| -rw-r--r-- | src/mods/commands/yc_debug.cpp | 67 | ||||
| -rw-r--r-- | src/mods/commands/yc_gag.cpp | 92 | ||||
| -rw-r--r-- | src/mods/commands/yc_help.cpp | 1 | ||||
| -rw-r--r-- | src/mods/commands/yc_q.cpp | 2 | ||||
| -rw-r--r-- | src/mods/commands/yc_ren.cpp | 2 | ||||
| -rw-r--r-- | src/mods/commands/yc_template.cpp (renamed from src/mods/commands/yc_banned.cpp) | 38 | ||||
| -rw-r--r-- | src/mods/commands/yc_unban.cpp | 73 | ||||
| -rw-r--r-- | src/mods/commands/yc_ungag.cpp | 92 |
10 files changed, 31 insertions, 461 deletions
diff --git a/src/mods/commands/Makefile.in b/src/mods/commands/Makefile.in new file mode 100644 index 0000000..42884b6 --- /dev/null +++ b/src/mods/commands/Makefile.in @@ -0,0 +1,18 @@ +MODS=$(addprefix ../../../mods/commands/, $(SRCS:.cpp=.so)) +CC=COMPILER +INCLUDES=`cat ../../includes.add` +CFLAGS=`cat ../cflags.add` +all: mods +$(MODS): + @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi + @$(CC) $(CFLAGS) $(INCLUDES) -shared -s -o $@ `echo $(notdir $@) | sed s/.so/.cpp/` + @echo -n "Command module `basename $@ | sed s/\.so// | sed s/yc_//` " + @du -hc $@ | tail -n 1 | sed s/total// | sed "s/ //g" +infotext: + @echo Compiling command modules +mods: infotext $(MODS) + @echo "Num of command modules: " + @ls ../../../mods/commands/*.so | wc -l +clean: + @echo Cleaning command modules + @if test -d ../../../mods/commands; then rm -Rf ../../../mods/commands; fi diff --git a/src/mods/commands/yc_ban.cpp b/src/mods/commands/yc_ban.cpp deleted file mode 100644 index 03e6470..0000000 --- a/src/mods/commands/yc_ban.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/*:* - *: File: ./src/mods/commands/yc_bannick.cpp - *: - *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: - *: This program is free software; you can redistribute it and/or - *: modify it under the terms of the GNU General Public License - *: as published by the Free Software Foundation; either version 2 - *: of the License, or (at your option) any later version. - *: - *: This program is distributed in the hope that it will be useful, - *: but WITHOUT ANY WARRANTY; without even the implied warranty of - *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - *: GNU General Public License for more details. - *: - *: You should have received a copy of the GNU General Public License - *: along with this program; if not, write to the Free Software - *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *:*/ - -#include "../../chat/user.h" -#include "../../chat/room.h" - -using namespace std; - -extern "C" -{ - 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_debug.cpp b/src/mods/commands/yc_debug.cpp deleted file mode 100644 index 9f770b7..0000000 --- a/src/mods/commands/yc_debug.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/*:* - *: File: ./src/mods/commands/yc_msg.cpp - *: - *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: - *: This program is free software; you can redistribute it and/or - *: modify it under the terms of the GNU General Public License - *: as published by the Free Software Foundation; either version 2 - *: of the License, or (at your option) any later version. - *: - *: This program is distributed in the hope that it will be useful, - *: but WITHOUT ANY WARRANTY; without even the implied warranty of - *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - *: GNU General Public License for more details. - *: - *: You should have received a copy of the GNU General Public License - *: along with this program; if not, write to the Free Software - *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *:*/ - -#include "../../chat/user.h" -#include "../../chat/room.h" -/* - 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::int2string(reinterpret_cast<int>(p_sess->get_user())) + "<br>"; - p_user->msg_post( &s_msg ); - - //p_user->debug(); - s_msg = "DEBUG-B: " + tool::int2string(reinterpret_cast<int>(p_sess->get_user())) + "<br>"; - p_user->msg_post( &s_msg ); - } - - return 0; - } -} - diff --git a/src/mods/commands/yc_gag.cpp b/src/mods/commands/yc_gag.cpp deleted file mode 100644 index e58a22d..0000000 --- a/src/mods/commands/yc_gag.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/*:* - *: File: ./src/mods/commands/yc_gag.cpp - *: - *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: - *: This program is free software; you can redistribute it and/or - *: modify it under the terms of the GNU General Public License - *: as published by the Free Software Foundation; either version 2 - *: of the License, or (at your option) any later version. - *: - *: This program is distributed in the hope that it will be useful, - *: but WITHOUT ANY WARRANTY; without even the implied warranty of - *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - *: GNU General Public License for more details. - *: - *: You should have received a copy of the GNU General Public License - *: along with this program; if not, write to the Free Software - *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *:*/ - -#include "../../chat/user.h" -#include "../../chat/room.h" -/* - 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_help.cpp b/src/mods/commands/yc_help.cpp index 7b4ddb9..537e4f7 100644 --- a/src/mods/commands/yc_help.cpp +++ b/src/mods/commands/yc_help.cpp @@ -57,7 +57,6 @@ extern "C" s_msg.append(*iter + " " + p_conf->get_elem("chat.msgs.err.notavailable")); } - else { s_msg.append(p_conf->get_elem("chat.msgs.err.wrongcommandusage")); diff --git a/src/mods/commands/yc_q.cpp b/src/mods/commands/yc_q.cpp index 5dba617..58422cf 100644 --- a/src/mods/commands/yc_q.cpp +++ b/src/mods/commands/yc_q.cpp @@ -41,7 +41,7 @@ extern "C" conf* p_conf = (conf*) ((dynamic_wrap*)c->elem[3])->CONF; - string s_quit = "<script language='JavaScript'>top.location.href='/" + string s_quit = "<script confuage=JavaScript>top.location.href='/" + p_conf->get_elem("httpd.startsite") + "';</script>"; diff --git a/src/mods/commands/yc_ren.cpp b/src/mods/commands/yc_ren.cpp index 672d378..658ff58 100644 --- a/src/mods/commands/yc_ren.cpp +++ b/src/mods/commands/yc_ren.cpp @@ -80,7 +80,7 @@ extern "C" { string s_msg = p_timr->get_time() + " " + p_user->get_colored_bold_name() - + p_conf->get_elem( "chat.msgs.us_errorenamesroom" ) + + p_conf->get_elem( "chat.msgs.userrenamesroom" ) + "<b>" + s_room + "</b><br>\n"; p_chat->del_elem( p_room->get_lowercase_name() ); diff --git a/src/mods/commands/yc_banned.cpp b/src/mods/commands/yc_template.cpp index feeb19c..a49bb69 100644 --- a/src/mods/commands/yc_banned.cpp +++ b/src/mods/commands/yc_template.cpp @@ -1,7 +1,7 @@ /*:* - *: File: ./src/mods/commands/yc_banned.cpp + *: File: ./src/mods/commands/yc_template.cpp *: - *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT + *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE *: *: Copyright (C) 2003 Paul C. Buetow, Volker Richter *: Copyright (C) 2004 Paul C. Buetow @@ -22,9 +22,12 @@ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *:*/ +#include <iostream> #include "../../chat/user.h" -#include "../../chat/chat.h" -#include "../../maps/shashmap.h" + +/* + gcc -shared -o yc_name.so yc_name.cpp +*/ using namespace std; @@ -34,31 +37,12 @@ extern "C" { 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(); + user *p_user = (user*)c->elem[1]; // the corresponding user + vector<string> *params=(vector<string>*)c->elem[2]; // param array - 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"; - } + string *quitstring=new string("Text to send<br>"); + p_user->msg_post( quitstring ); - p_user->msg_post( &s_msg ); return 0; } } diff --git a/src/mods/commands/yc_unban.cpp b/src/mods/commands/yc_unban.cpp deleted file mode 100644 index fbe7513..0000000 --- a/src/mods/commands/yc_unban.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/*:* - *: File: ./src/mods/commands/yc_unbannick.cpp - *: - *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: - *: This program is free software; you can redistribute it and/or - *: modify it under the terms of the GNU General Public License - *: as published by the Free Software Foundation; either version 2 - *: of the License, or (at your option) any later version. - *: - *: This program is distributed in the hope that it will be useful, - *: but WITHOUT ANY WARRANTY; without even the implied warranty of - *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - *: GNU General Public License for more details. - *: - *: You should have received a copy of the GNU General Public License - *: along with this program; if not, write to the Free Software - *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *:*/ - -#include "../../chat/user.h" -#include "../../chat/room.h" - -using namespace std; - -extern "C" -{ - 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 deleted file mode 100644 index 6d8c03c..0000000 --- a/src/mods/commands/yc_ungag.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/*:* - *: File: ./src/mods/commands/yc_ungag.cpp - *: - *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT - *: - *: Copyright (C) 2003 Paul C. Buetow, Volker Richter - *: Copyright (C) 2004 Paul C. Buetow - *: Copyright (C) 2005 EXA Digital Solutions GbR - *: - *: This program is free software; you can redistribute it and/or - *: modify it under the terms of the GNU General Public License - *: as published by the Free Software Foundation; either version 2 - *: of the License, or (at your option) any later version. - *: - *: This program is distributed in the hope that it will be useful, - *: but WITHOUT ANY WARRANTY; without even the implied warranty of - *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - *: GNU General Public License for more details. - *: - *: You should have received a copy of the GNU General Public License - *: along with this program; if not, write to the Free Software - *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *:*/ - -#include "../../chat/user.h" -#include "../../chat/room.h" -/* - 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; - } -} - |
