summaryrefslogtreecommitdiff
path: root/src/chat
diff options
context:
space:
mode:
Diffstat (limited to 'src/chat')
-rw-r--r--src/chat/base.h2
-rw-r--r--src/chat/base.tmpl11
-rw-r--r--src/chat/chat.cpp57
-rw-r--r--src/chat/chat.h2
-rw-r--r--src/chat/gcol.cpp40
-rw-r--r--src/chat/gcol.h2
-rw-r--r--src/chat/perm.cpp2
-rw-r--r--src/chat/perm.h2
-rw-r--r--src/chat/room.cpp11
-rw-r--r--src/chat/room.h2
-rw-r--r--src/chat/sess.cpp4
-rw-r--r--src/chat/sess.h2
-rw-r--r--src/chat/sman.cpp30
-rw-r--r--src/chat/sman.h6
-rw-r--r--src/chat/user.cpp90
-rw-r--r--src/chat/user.h43
16 files changed, 208 insertions, 98 deletions
diff --git a/src/chat/base.h b/src/chat/base.h
index bfdd6f6..145fb6c 100644
--- a/src/chat/base.h
+++ b/src/chat/base.h
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/base.h
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
diff --git a/src/chat/base.tmpl b/src/chat/base.tmpl
index c94ed44..87c3a0b 100644
--- a/src/chat/base.tmpl
+++ b/src/chat/base.tmpl
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/base.tmpl
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
@@ -64,18 +64,21 @@ template<class type>
void
base<type>::dumpit()
{
- dumpable::add("[base]");
+ dumpable::add
+ ("[base]");
vector<string>* p_vec = nhashmap<type*>::get_key_vector();
vector<string>::iterator iter;
for (iter = p_vec->begin(); iter != p_vec->end(); ++iter)
{
- dumpable::add(*iter);
+ dumpable::add
+ (*iter);
type* p_elem = get_elem(*iter);
if (p_elem)
{
dumpable::next_no_newline();
- dumpable::add(p_elem->dump(dumpable::get_level()));
+ dumpable::add
+ (p_elem->dump(dumpable::get_level()));
}
}
diff --git a/src/chat/chat.cpp b/src/chat/chat.cpp
index 764da85..a56c74d 100644
--- a/src/chat/chat.cpp
+++ b/src/chat/chat.cpp
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/chat.cpp
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
@@ -40,9 +40,8 @@ chat::chat( )
wrap::system_message(CHATREP);
vector<string>* p_vec_keys = wrap::CONF->get_key_vector();
- for (vector<string>::iterator iter = p_vec_keys->begin();
- iter != p_vec_keys->end();
- iter++ )
+ for (vector<string>::iterator iter = p_vec_keys-> begin();
+ iter != p_vec_keys->end(); iter++ )
{
if ( iter->length() >= 24 && iter->compare( 0, 22, "chat.html.replace.from" ) == 0 )
{
@@ -147,8 +146,8 @@ chat::login( map<string,string> &map_params )
return;
}
- // prove if maxpoolsize (threads) allows this login
- else if ( !wrap::POOL->allow_user_login() )
+ // prove if maxpoolsize (threads) allows this login
+ else if ( !pool::allow_user_login() )
{
map_params["INFO"] = wrap::CONF->get_elem( "chat.msgs.err.maxuserlimit" );
map_params["request"] = wrap::CONF->get_elem( "httpd.startsite" ); // redirect to the startpage.
@@ -156,6 +155,13 @@ chat::login( map<string,string> &map_params )
return;
}
+ // prove if nick is banned from chat
+ if (map_banned_nicks.exists(tool::to_lower(s_user))) {
+ map_params["INFO"] = wrap::CONF->get_elem( "chat.msgs.err.banned" );
+ map_params["request"] = wrap::CONF->get_elem( "httpd.startsite" );
+ return;
+ }
+
bool b_flag;
// prove if nick is already online / logged in.
@@ -349,6 +355,13 @@ chat::post( user* p_user, map<string,string> &map_params )
if ( i_pos == 0 )
return p_user->command( s_msg );
+ if (p_user->get_is_gag())
+ {
+ p_user->msg_post(wrap::CONF->colored_error_msg("chat.msgs.err.gagged"));
+ return;
+ }
+
+
string_replacer(&s_msg);
string s_post;
@@ -387,8 +400,38 @@ chat::string_replacer(string *p_msg)
void
chat::dumpit()
{
- dumpable::add("[chat]");
+ dumpable::add
+ ("[chat]");
base<room>::dumpit();
}
+string
+chat::ban_nick(string &s_nick, string s_reason) {
+ string s_lower_nick(tool::to_lower(s_nick));
+
+ if (map_banned_nicks.exists(s_lower_nick))
+ return map_banned_nicks.get_elem(s_lower_nick);
+
+ map_banned_nicks.add_elem(s_reason, s_lower_nick);
+ return "";
+}
+
+string
+chat::unban_nick(string &s_nick) {
+ string s_lower_nick(tool::to_lower(s_nick));
+
+ if (!map_banned_nicks.exists(s_lower_nick))
+ return "";
+
+ string s_ret(map_banned_nicks.get_elem(s_lower_nick));
+ map_banned_nicks.del_elem(s_lower_nick);
+
+ return s_ret;
+}
+
+shashmap<string>*
+chat::get_map_banned_nicks() {
+ return &map_banned_nicks;
+}
+
#endif
diff --git a/src/chat/chat.h b/src/chat/chat.h
index b61ed95..1758790 100644
--- a/src/chat/chat.h
+++ b/src/chat/chat.h
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/chat.h
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
diff --git a/src/chat/gcol.cpp b/src/chat/gcol.cpp
index 099f11e..b7f1288 100644
--- a/src/chat/gcol.cpp
+++ b/src/chat/gcol.cpp
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/gcol.cpp
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
@@ -36,10 +36,6 @@ gcol::gcol()
p_map_users = new shashmap<user*>;
wrap::system_message( GARBAGE );
-#ifdef NCURSES
-
- print_garbage();
-#endif
}
gcol::~gcol()
@@ -66,14 +62,10 @@ void
gcol::add_user_to_garbage( user* p_user )
{
p_user->s_mess_delete();
- p_map_users->add_elem( p_user, tool::to_lower(p_user->get_name()) );
- wrap::system_message( GARUSER + p_user->get_name() );
+ p_map_users->add_elem(p_user, tool::to_lower(p_user->get_name()));
+ wrap::system_message(GARUSER + p_user->get_name());
p_user->destroy_session();
-#ifdef NCURSES
-
- print_garbage();
-#endif
}
bool
@@ -128,11 +120,6 @@ gcol::get_room_from_garbage()
vec_rooms.pop_back();
pthread_mutex_unlock( &mut_vec_rooms );
-#ifdef NCURSES
-
- print_garbage();
-#endif
-
return p_room;
}
@@ -151,7 +138,6 @@ gcol::get_user_from_garbage( string s_user )
{
user* p_user = p_map_users->get_elem( tool::to_lower(s_user) );
- ;
if ( p_user != NULL )
{
@@ -161,11 +147,6 @@ gcol::get_user_from_garbage( string s_user )
p_user->set_invisible( false );
p_user->renew_timeout();
wrap::system_message(GARUSE2 + p_user->get_name() );
-#ifdef NCURSES
-
- print_garbage();
-#endif
-
}
return p_user;
@@ -191,19 +172,4 @@ gcol::unlock_mutex()
pthread_mutex_unlock ( &mut_vec_rooms );
}
-#ifdef NCURSES
-void
-gcol::print_garbage( )
-{
- if ( wrap::NCUR->is_ready() )
- {
- pthread_mutex_lock ( &mut_vec_rooms );
- mvprintw( NCUR_GARBAGE_X,NCUR_GARBAGE_Y, "Garbage: %d ", p_map_users->size() + vec_rooms.size() );
- pthread_mutex_unlock( &mut_vec_rooms );
- refresh();
- }
-}
-
-#endif
-
#endif
diff --git a/src/chat/gcol.h b/src/chat/gcol.h
index ab84269..a564d22 100644
--- a/src/chat/gcol.h
+++ b/src/chat/gcol.h
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/gcol.h
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
diff --git a/src/chat/perm.cpp b/src/chat/perm.cpp
index f84d4de..544d2c0 100644
--- a/src/chat/perm.cpp
+++ b/src/chat/perm.cpp
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/perm.cpp
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
diff --git a/src/chat/perm.h b/src/chat/perm.h
index 5fc34c3..709b60e 100644
--- a/src/chat/perm.h
+++ b/src/chat/perm.h
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/perm.h
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
diff --git a/src/chat/room.cpp b/src/chat/room.cpp
index 9ff5517..a4d6549 100644
--- a/src/chat/room.cpp
+++ b/src/chat/room.cpp
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/room.cpp
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
@@ -128,9 +128,12 @@ room::set_name( string s_name )
void
room::dumpit()
{
- dumpable::add("[room]");
- dumpable::add("Name: "+get_name());
- dumpable::add("Topic: "+get_topic());
+ dumpable::add
+ ("[room]");
+ dumpable::add
+ ("Name: "+get_name());
+ dumpable::add
+ ("Topic: "+get_topic());
base<user>::dumpit();
}
diff --git a/src/chat/room.h b/src/chat/room.h
index 8f673f5..6de217a 100644
--- a/src/chat/room.h
+++ b/src/chat/room.h
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/room.h
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
diff --git a/src/chat/sess.cpp b/src/chat/sess.cpp
index 485b643..2007cb1 100644
--- a/src/chat/sess.cpp
+++ b/src/chat/sess.cpp
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/sess.cpp
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
@@ -72,7 +72,7 @@ sess::set_user(user* p_user)
void
-sess::invalidate()
+sess::invalidate()
{
this->s_tmpid = "0";
}
diff --git a/src/chat/sess.h b/src/chat/sess.h
index f008ea2..e6d9b8c 100644
--- a/src/chat/sess.h
+++ b/src/chat/sess.h
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/sess.h
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
diff --git a/src/chat/sman.cpp b/src/chat/sman.cpp
index 661085f..53a15f7 100644
--- a/src/chat/sman.cpp
+++ b/src/chat/sman.cpp
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/sman.cpp
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
@@ -32,7 +32,7 @@
sman::sman()
{
- i_session_count = 0;
+ i_continous_session_count = i_session_count = 0;
pthread_mutex_init( &mut_i_session_count, NULL );
}
@@ -85,10 +85,9 @@ sess *sman::create_session( )
pthread_mutex_lock( &mut_i_session_count );
i_session_count++;
-#ifdef NCURSES
-
- print_sessions();
-#endif
+ wrap::system_message(string(SESSIOC) + "(" +
+ tool::int2string(++i_continous_session_count) + "," +
+ tool::int2string(reinterpret_cast<int>(p_sess)) + ")" );
pthread_mutex_unlock( &mut_i_session_count );
@@ -106,12 +105,15 @@ sess *sman::get_session( string s_id )
void
sman::destroy_session( string s_id )
{
+ sess* p_sess = get_elem(s_id);
+
pthread_mutex_lock( &mut_i_session_count );
i_session_count--;
#ifdef NCURSES
- print_sessions();
-#endif
+ wrap::system_message(string(SESSIOD) + "(" +
+ tool::int2string(i_continous_session_count) + "," +
+ tool::int2string(reinterpret_cast<int>(p_sess)) + ")" );
pthread_mutex_unlock( &mut_i_session_count );
@@ -142,12 +144,18 @@ void sman::print_init_ncurses()
int
sman::get_session_count()
{
- int i_ret;
pthread_mutex_lock( &mut_i_session_count );
- i_ret = i_session_count;
+ int i_ret = i_session_count;
pthread_mutex_unlock( &mut_i_session_count );
return i_ret;
}
-#endif
+/*
+void
+sman::dump() {
+ shashmap<sess*>::dump();
+ cout << "BLA" << endl;
+}
+*/
+
#endif
diff --git a/src/chat/sman.h b/src/chat/sman.h
index 5211fbd..d97a12d 100644
--- a/src/chat/sman.h
+++ b/src/chat/sman.h
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/sman.h
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
@@ -42,10 +42,6 @@ private:
int i_session_count;
pthread_mutex_t mut_i_session_count;
-#ifdef NCURSES
-
- void print_sessions();
-#endif
public:
sman();
diff --git a/src/chat/user.cpp b/src/chat/user.cpp
index 5fa4ccb..b7816ab 100644
--- a/src/chat/user.cpp
+++ b/src/chat/user.cpp
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/user.cpp
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
@@ -49,6 +49,7 @@ user::~user()
pthread_mutex_destroy( & mut_b_invisible );
pthread_mutex_destroy( & mut_b_has_sess );
pthread_mutex_destroy( & mut_b_is_reg );
+ pthread_mutex_destroy( & mut_b_is_gag );
pthread_mutex_destroy( & mut_s_mess );
pthread_mutex_destroy( & mut_s_pass );
pthread_mutex_destroy( & mut_p_room );
@@ -65,6 +66,12 @@ user::~user()
void
user::initialize()
{
+ time(&t_flood_time);
+ init_strings(wrap::CONF->get_vector("chat.fields.userstrings"));
+ init_ints(wrap::CONF->get_vector("chat.fields.userints"));
+ init_bools(wrap::CONF->get_vector("chat.fields.userbools"));
+
+ this -> p_room = NULL;
this -> b_is_reg = false;
this -> b_set_changed_data = false;
this -> b_away = false;
@@ -80,6 +87,7 @@ user::initialize()
pthread_mutex_init( & mut_b_invisible , NULL );
pthread_mutex_init( & mut_b_has_sess , NULL );
pthread_mutex_init( & mut_b_is_reg , NULL );
+ pthread_mutex_init( & mut_b_is_gag , NULL );
pthread_mutex_init( & mut_s_mess , NULL );
pthread_mutex_init( & mut_s_pass , NULL );
pthread_mutex_init( & mut_p_room , NULL );
@@ -112,7 +120,8 @@ user::destroy_session()
#ifdef DATABASE
// Store all changed data into the mysql table if this user is registered:
if ( b_is_reg )
- wrap::DATA->update_user_data( get_name(), "savechangednick", map_changed_data );
+ wrap::DATA->update_user_data( get_name(), "savechangednick",
+ map_changed_data );
#endif
set_has_sess(false);
@@ -200,6 +209,16 @@ user::get_is_reg( )
return b_ret;
}
+bool
+user::get_is_gag( )
+{
+ bool b_ret;
+ pthread_mutex_lock ( &mut_b_is_gag );
+ b_ret = b_is_gag;
+ pthread_mutex_unlock( &mut_b_is_gag );
+ return b_ret;
+}
+
void
user::set_is_reg( bool b_is_reg )
{
@@ -207,6 +226,14 @@ user::set_is_reg( bool b_is_reg )
}
void
+user::set_is_gag( bool b_is_gag )
+{
+ pthread_mutex_lock ( &mut_b_is_gag );
+ this -> b_is_gag = b_is_gag;
+ pthread_mutex_unlock( &mut_b_is_gag );
+}
+
+void
user::set_online( bool b_online )
{
pthread_mutex_lock ( &mut_b_online );
@@ -498,7 +525,7 @@ user::s_mess_delete( )
void
-user::msg_post( string *p_msg )
+user::s_mess_delete( )
{
pthread_mutex_lock ( &mut_s_mess );
s_mess.append( *p_msg );
@@ -508,6 +535,47 @@ user::msg_post( string *p_msg )
}
void
+user::post_action_msg(string s_msgkey)
+{
+ get_room()->msg_post(wrap::TIMR->get_time()+" "+get_colored_bold_name()+wrap::CONF->get_elem(s_msgkey)+"<br>\n");
+}
+
+
+void
+user::renew_timeout()
+{
+ timo::renew_timeout();
+ double d_time_diff = wrap::TIMR->get_time_diff(t_flood_time);
+
+ if (d_time_diff < static_cast<double>(wrap::CONF->get_int("chat.floodprotection.seconds")))
+ {
+ if (++i_flood_messages > static_cast<double>(wrap::CONF->get_int("chat.floodprotection.messages")))
+ {
+ room* p_room = get_room();
+ if (p_room == 0)
+ {
+ i_flood_messages = 0;
+ return;
+ }
+
+ wrap::system_message(CHATFLO+get_name()+","+p_room->get_name()+","+tool::int2string(i_flood_messages)+")");
+ msg_post(wrap::CONF->colored_error_msg("chat.msgs.err.flooding"));
+ if (!get_is_gag())
+ {
+ set_is_gag(true);
+ post_action_msg("chat.msgs.floodgag");
+ }
+ }
+ }
+
+ else
+ {
+ time(&t_flood_time);
+ i_flood_messages = 0;
+ }
+}
+
+void
user::check_timeout( int* i_idle_timeout )
{
int i_user_timeout = (int) get_last_activity();
@@ -610,10 +678,22 @@ user::dumpit()
{
dumpable::add("[user]");
dumpable::add("Name: " + get_name() +
- "; Room: " + get_room()->get_name() +
- "; Status: " + tool::int2string(get_status()));
+ "; Room: " + get_room()->get_name() +
+ "; Status: " + tool::int2string(get_status()));
dumpable::add("TempID: " + get_tmpid());
}
+bool
+user::same_rooms(user *p_user)
+{
+ return p_user->get_room()->get_lowercase_name()
+ .compare(this->get_room()->get_lowercase_name()) == 0;
+}
+
+string
+user::make_colors(string s_msg)
+{
+ return "<font color=\"#" + get_col1() + "\">" + s_msg + "</font>";
+}
#endif
diff --git a/src/chat/user.h b/src/chat/user.h
index c5535a5..b88a820 100644
--- a/src/chat/user.h
+++ b/src/chat/user.h
@@ -1,7 +1,7 @@
/*:*
*: File: ./src/chat/user.h
*:
- *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
@@ -40,14 +40,22 @@ class user : public name, public timo, public dumpable
private:
// private members:
- 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
- bool b_away; // true if user is away.
- bool b_fake; // true if user hides his status logo (does not work for guest)
- bool b_invisible; // true if user hides his status logo (does not work for guest)
- int i_status; // user's rang ( see enum rang @ globals.h ).
- int i_old_status; // user's previous status.
+ 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
+ bool b_is_gag; // true if user is gagged
+ bool b_away; // true if user is away.
+ bool b_fake; // true if user hides his status logo (does not work for guest)
+ bool b_invisible; // true if user hides his status logo (does not work for guest)
+ bool b_set_changed_data; // Only set change data if required!
+
+ 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)
+
string s_tmpid;
string s_agnt; // user's http user agent.
string s_away; // user's last away message.
@@ -57,9 +65,11 @@ private:
string s_mess; // message string which has to be sent to the user.
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!
- bool b_set_changed_data; // Only set change data if required!
+ pthread_mutex_t mut_map_changed_data;
+ pthread_mutex_t mut_s_mess;
// Modules which are allowed to be executed by the user.
@@ -69,7 +79,7 @@ private:
pthread_mutex_t mut_b_invisible;
pthread_mutex_t mut_b_has_sess;
pthread_mutex_t mut_b_is_reg;
- pthread_mutex_t mut_s_mess;
+ 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;
@@ -77,7 +87,6 @@ private:
pthread_mutex_t mut_s_email;
pthread_mutex_t mut_s_tmpid;
pthread_mutex_t mut_i_status;
- pthread_mutex_t mut_map_changed_data;
void initialize();
void set_changed_data( string s_varname, string s_value );
@@ -110,21 +119,21 @@ public:
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_changed_data_on()
- {
- b_set_changed_data = 1;
- }
+ 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);
string get_pass();
string get_col1();
string get_col2();
@@ -138,7 +147,9 @@ public:
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 );