summaryrefslogtreecommitdiff
path: root/ychat-0.7.0/src/mods/commands/yc_msg.cpp
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:41 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:41 +0200
commit9cd3ccffd5372dfde3af478e3f832f18db4be3f1 (patch)
tree631c295a4a4a16b57502b847626763a279bf6df7 /ychat-0.7.0/src/mods/commands/yc_msg.cpp
parent13aaf70af703748fe096e0664c305cd202637ad2 (diff)
tagging tags
Diffstat (limited to 'ychat-0.7.0/src/mods/commands/yc_msg.cpp')
-rwxr-xr-xychat-0.7.0/src/mods/commands/yc_msg.cpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/ychat-0.7.0/src/mods/commands/yc_msg.cpp b/ychat-0.7.0/src/mods/commands/yc_msg.cpp
new file mode 100755
index 0000000..dda26b3
--- /dev/null
+++ b/ychat-0.7.0/src/mods/commands/yc_msg.cpp
@@ -0,0 +1,73 @@
+#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;
+
+ 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_msg = "<i> "
+ + p_conf->get_elem("chat.msgs.whisperto")
+ + " "
+ + p_whisper_user->get_colored_name()
+ + ": <font color=\"#"
+ + p_user->get_col2()
+ + "\">";
+
+ string s_whisper_msg = "<i>"
+ + p_user->get_colored_name()
+ + " "
+ + p_conf->get_elem("chat.msgs.whisper")
+ + ": <font color=\"#"
+ + p_user->get_col2()
+ + "\">";
+
+ for ( iter++; iter != params->end(); iter++ )
+ {
+ s_msg .append( *iter + " " );
+ s_whisper_msg.append( *iter + " " );
+ }
+
+ s_msg .append( "</font></i><br>\n" );
+ s_whisper_msg.append( "</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 );
+ }
+ }
+ }
+}
+