00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef AUTHENTICATION_H
00017 #define AUTHENTICATION_H
00018
00019 #ifndef USE_PCH
00020 #include <string>
00021 #include <boost/shared_ptr.hpp>
00022 #include "debug.h"
00023 #endif
00024
00025 #include "IdentityReference.h"
00026
00027 class UserAnswerEventType;
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 class Authentication : protected IdentityReference {
00041 private:
00042 std::string M_server_pass;
00043 std::string M_service_pass;
00044 std::string M_ident;
00045 std::string M_realname;
00046 boost::shared_ptr<Authentication>& M_ptr;
00047 bool M_received_nick;
00048 bool M_received_user;
00049
00050 public:
00051 void decode_pass(ClientMessageIn const& pass_msg);
00052 void received_nick(void);
00053 void decode_user(ClientMessageIn const& user_msg);
00054
00055 void send_authentication(ServerConnection& server_connection);
00056
00057 public:
00058
00059
00060 static void get(Identity* identity, boost::shared_ptr<Authentication>& ptr)
00061 { if (!ptr.get()) ptr.reset(NEW(Authentication(identity, ptr))); }
00062
00063
00064 std::string const& service_pass(void) const { return M_service_pass; }
00065
00066 private:
00067
00068 Authentication(Identity* identity, boost::shared_ptr<Authentication>& ptr) :
00069 IdentityReference(identity), M_ptr(ptr), M_received_nick(false), M_received_user(false)
00070 { Dout(dc::objects, "Constructing Authentication " << *this); }
00071
00072
00073 void received_nick_and_user(void);
00074
00075 public:
00076 #ifdef CWDEBUG
00077
00078 ~Authentication() { Dout(dc::objects, "Destructing Authentication " << *this); }
00079 #endif
00080
00081 Authentication(Authentication const& authentication) :
00082 IdentityReference(authentication),
00083 M_server_pass(authentication.M_server_pass),
00084 M_service_pass(authentication.M_service_pass),
00085 M_ident(authentication.M_ident),
00086 M_realname(authentication.M_realname),
00087 M_ptr(authentication.M_ptr),
00088 M_received_nick(authentication.M_received_nick),
00089 M_received_user(authentication.M_received_user)
00090 { Dout(dc::objects, "Copy-constructing Authentication from " << authentication); }
00091
00092 friend std::ostream& operator<<(std::ostream&, Authentication const&);
00093 };
00094
00095 #endif // AUTHENTICATION_H