summaryrefslogtreecommitdiff
path: root/user.cpp
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:46 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:46 +0200
commit07706f56cd421bf8b101a5c0fe44674d36e161a0 (patch)
treebec8b45765788370fbd148d68e05d8b437e60670 /user.cpp
parent56187184e11b085b82584d3b088c62f427aae83c (diff)
tagging ychat-0.5.1ychat-0.5.1
Diffstat (limited to 'user.cpp')
-rwxr-xr-xuser.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/user.cpp b/user.cpp
index 5a4068b..4cda685 100755
--- a/user.cpp
+++ b/user.cpp
@@ -4,16 +4,17 @@
#define USER_CXX
#include "user.h"
-#include "CONF.h"
-#include "TOOL.h"
+#include "s_conf.h"
+#include "s_modl.h"
+#include "s_tool.h"
using namespace std;
user::user( string s_name ) : name( s_name )
{
this -> b_online = true;
- this -> l_time = TOOL::unixtime();
- this -> s_col1 = CONF::get().get_val( "USERCOL1" );
+ this -> l_time = s_tool::unixtime();
+ this -> s_col1 = s_conf::get().get_val( "USERCOL1" );
pthread_mutex_init( &mut_b_online, NULL);
pthread_mutex_init( &mut_i_sock , NULL);
@@ -112,10 +113,36 @@ user::set_sock( int 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( )
{
pthread_mutex_lock ( &mut_l_time );
- l_time = TOOL::unixtime();
+ l_time = s_tool::unixtime();
pthread_mutex_unlock( &mut_l_time );
}