From d34015c5ba231b95de20e9fcd7a33c5b2b9a1006 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Apr 2013 13:14:45 +0200 Subject: tagging ychat-0.5.3 --- src/user.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/user.cpp') diff --git a/src/user.cpp b/src/user.cpp index 7fd5858..1250254 100755 --- a/src/user.cpp +++ b/src/user.cpp @@ -5,6 +5,7 @@ #include "user.h" #include "s_conf.h" +#include "s_modl.h" #include "s_tool.h" using namespace std; @@ -112,6 +113,34 @@ user::set_sock( int i_sock ) pthread_mutex_unlock( &mut_i_sock ); } +void +user::command( string &s_command ) +{ + + auto unsigned int pos = s_command.find( "/" ); + while( pos != string::npos ) + { + s_command.replace( pos, 1, "" ); + pos = s_command.find( "/" ); + } + + string s_mod( "cmnd/yc_" ); + s_mod.append( s_command ).append( ".so" ); + + dynmod *mod = s_modl::get + ().get_module( s_mod ); + + if ( mod == NULL ) + { + msg_post( new string( s_lang::get + ().get_val( "ERRORCMD" ) ) ); + return; + } + + // execute the module. + ( *(mod->the_func) ) ( (void*) this ); +} + void user::renew_stamp( ) { -- cgit v1.2.3