/home/matthew/data/programming/current/libircpp/user.h

00001 /* 
00002  * libircpp++ user.h
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                 /* Interface functions */
00021                 public:
00022                         /* Constructors and destructors */
00023                         user(session& parent, const std::string& name, bool temporary = false);
00024                         explicit user(const user& parent, bool temporary = false);
00025                         ~user();
00026 
00027                         /* Type determination functions */
00028                         bool is_user() const;
00029                         bool is_channel() const;
00030 
00031                 /* Data access functions */
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                 /* Operators */
00048                         user& operator=(const user& from);
00049                         using entity::operator==;
00050                         bool operator==(const std::string& rhs) const;
00051                         operator bool() const;
00052 
00053                 /* Signals */
00054                         /* Note, these signals are invoked by the session, to save every user 
00055                          * comparing every message against itself */
00056                         /* sig_privmsg_msg and sig_notice_msg inherited from entity */
00060                         mutable boost::signal1<void, const message &> sig_nick_msg;
00061 
00062                         /* FIXME remove debugging */
00063                         int constructed;
00064 
00065                 private:
00066                 /* Private functions */
00067 
00068                 /* Slots */
00069                         void update_data_slot(const message& msg);
00070                         boost::signals::connection update_data_connection;
00071                         
00072 
00073                 /* Private data */
00074                         //std::string s_name; // inherited from entity
00075                         //const session& s; // inherited from entity
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; /* Set to true if nick, username, and hostname are filled in */
00083                         mutable void* _ptr; /* user-defined pointer */
00084 
00085                 /* Friends */
00086                 friend class session;
00087         };
00088 
00089 
00090 } /* namespace ircpp */
00091 
00092 #endif /* __USER_H__ */

Generated on Sat Oct 13 23:35:40 2007 for libircpp by  doxygen 1.5.3