00001
00002
00003
00004 #ifndef __USER_H__
00005 #define __USER_H__
00006
00007 #include <string>
00008 #include <boost/signals.hpp>
00009 #include "entity.h"
00010
00011 namespace ircpp {
00012 class message;
00013
00018 class user : public entity
00019 {
00020
00021 public:
00022
00023 user(session& parent, const std::string& name, bool temporary = false);
00024 explicit user(const user& parent, bool temporary = false);
00025 ~user();
00026
00027
00028 bool is_user() const;
00029 bool is_channel() const;
00030
00031
00032 public:
00033 const std::string& username() const;
00034 const std::string& hostname() const;
00035 const std::string& realname() const;
00036 const std::string& nuh() const;
00037 const unsigned long signon_time() const;
00038 void username(const std::string& username);
00039 void hostname(const std::string& hostname);
00040 void realname(const std::string& realname);
00041 void increment_channelcount();
00042 void decrement_channelcount();
00043 void ptr(void* p) const;
00044 void* ptr() const;
00045 bool update_nuh(const std::string& nuh);
00046
00047
00048 user& operator=(const user& from);
00049 using entity::operator==;
00050 bool operator==(const std::string& rhs) const;
00051 operator bool() const;
00052
00053
00054
00055
00056
00060 mutable boost::signal1<void, const message &> sig_nick_msg;
00061
00062
00063 int constructed;
00064
00065 private:
00066
00067
00068
00069 void update_data_slot(const message& msg);
00070 boost::signals::connection update_data_connection;
00071
00072
00073
00074
00075
00076 std::string _username;
00077 std::string _hostname;
00078 std::string _realname;
00079 std::string _nuh;
00080 unsigned int _channelcount;
00081 unsigned long _signon_time;
00082 bool _nuh_complete;
00083 mutable void* _ptr;
00084
00085
00086 friend class session;
00087 };
00088
00089
00090 }
00091
00092 #endif