diff options
| author | Paul Buetow <paul@buetow.org> | 2010-11-21 16:20:55 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2010-11-21 16:20:55 +0000 |
| commit | 6fde6b0fe90abde84011202edd40fe46eb06af44 (patch) | |
| tree | ef760338c50b4df3ae9cca96347bca962fdbec7e /src/chat/user.h | |
| parent | 55b08bd93257d32df76efc4e8e3f49311c39ee82 (diff) | |
Diffstat (limited to 'src/chat/user.h')
| -rw-r--r-- | src/chat/user.h | 109 |
1 files changed, 62 insertions, 47 deletions
diff --git a/src/chat/user.h b/src/chat/user.h index 1369067..cde0729 100644 --- a/src/chat/user.h +++ b/src/chat/user.h @@ -1,12 +1,11 @@ /*:* *: File: ./src/chat/user.h *: - *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT + *: 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 - *: 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 @@ -47,8 +46,8 @@ class user : private: // private members: - _socket *p_sock; - string s_msg; + string s_mess; // message string which has to be sent to the user. + bool b_online; // true if user is online. bool b_has_sess; // true if user already has a session! bool b_is_reg; // true if user is registered @@ -61,8 +60,7 @@ private: int i_status; // user's rang ( see enum rang @ globals.h ). int i_old_status; // user's previous status. int i_flood_messages; // user's message posts (needed for flood protection, does not need to be syncronized) - time_t t_flood_time; // user's time count (needed for flood protection, does not need to be syncronized) - long l_messages_recv; + time_t t_flood_time; // user's time count (needed for flood protection, does not need to be syncronized) string s_tmpid; string s_agnt; // user's http user agent. @@ -72,14 +70,36 @@ private: string s_email; // user's email addres string s_pass; // password room* p_room; // pointer to the user's room. +// sess** p_sess; // pointer to the pointer to the session object hashmap<string> map_changed_data; // Needed to tell yChat which data to change after user is removed! + pthread_mutex_t mut_map_changed_data; + pthread_mutex_t mut_s_mess; + + // Modules which are allowed to be executed by the user. + + pthread_mutex_t mut_away; + pthread_mutex_t mut_b_online; + pthread_mutex_t mut_b_fake; + pthread_mutex_t mut_b_invisible; + pthread_mutex_t mut_b_has_sess; + pthread_mutex_t mut_b_is_reg; + pthread_mutex_t mut_b_is_gag; + pthread_mutex_t mut_s_pass; + pthread_mutex_t mut_p_room; + pthread_mutex_t mut_s_col1; + pthread_mutex_t mut_s_col2; + pthread_mutex_t mut_s_email; + pthread_mutex_t mut_s_tmpid; + pthread_mutex_t mut_i_status; void initialize(); void set_changed_data( string s_varname, string s_value ); void dumpit(); public: + pthread_cond_t cond_message; + pthread_mutex_t mut_message; user(); user(string s_name); @@ -99,63 +119,58 @@ public: { return "<b>" + get_colored_name() + "</b>"; } - void msg_clear() - { - s_msg.clear(); - } - bool get_online(); - bool get_fake(); - bool get_invisible(); - bool get_has_sess(); - bool get_is_reg(); - bool get_is_gag(); - void set_online( bool b_online ); - void set_sock(_socket *p_sock); - void set_fake( bool b_fake ); - void set_invisible( bool b_invisible ); - void set_has_sess( bool b_has_sess ); - void set_is_reg( bool b_is_reg ); - void set_is_gag( bool b_is_gag ); - void set_changed_data_on() - { - b_set_changed_data = 1; - } - bool get_away( ); - string get_away_msg( ); - void set_away( bool b_away, string s_away ); - void set_away( bool b_away ); + bool get_online(); + bool get_fake(); + bool get_invisible(); + bool get_has_sess(); + bool get_is_reg(); + bool get_is_gag(); + void set_online( bool b_online ); + void set_fake( bool b_fake ); + void set_invisible( bool b_invisible ); + void set_has_sess( bool b_has_sess ); + void set_is_reg( bool b_is_reg ); + void set_is_gag( bool b_is_gag ); + void set_changed_data_on() { b_set_changed_data = 1; } + bool get_away( ); + string get_away_msg( ); + void set_away( bool b_away, string s_away ); + void set_away( bool b_away ); room* get_room(); - void set_p_room( room* p_room ); - // void set_sess(sess** p_sess); + void set_p_room( room* p_room ); +// void set_sess(sess** p_sess); string get_pass(); string get_col1(); string get_col2(); string get_email(); string get_tmpid(); - void set_tmpid( string s_tmpid ); - void set_pass( string s_col1 ); - void set_col1( string s_col1 ); - void set_col2( string s_col2 ); - void set_email( string s_email ); - int get_status( ); - void set_status( int i_status ); - void set_messages_recv( long l ) - { - l_messages_recv = l; - } - void post_action_msg(string s_msgkey); - void check_timeout( int* i_idle_timeout ); - void renew_timeout(); + void set_tmpid( string s_tmpid ); + void set_pass( string s_col1 ); + void set_col1( string s_col1 ); + void set_col2( string s_col2 ); + void set_email( string s_email ); + int get_status( ); + void set_status( int i_status ); + bool new_msgs ( ); + void post_action_msg(string s_msgkey); + void check_timeout( int* i_idle_timeout ); + void renew_timeout(); // executes a command. void command( string &s_command ); + // gets the message and clears s_mess; + string get_mess(); + + // Here are starting methods which are mainly needed by the data<type> class. + // appends a string to s_mess including br. void msg_post( string s_msg ) { msg_post( &s_msg ); } void msg_post( string *p_msg ); + void s_mess_delete( ); void get_user_list( string &s_list ); void check_restore_away(); void reconf(); |
