ircproxy The Ultimate Cyborg |
00001 // ircproxy -- An intelligent IRC proxy 00002 // 00003 //! @file NickPair.h 00004 //! @brief Header of class NickPair 00005 // 00006 // Copyright (C) 2005 - 2007 by 00007 // 00008 // Carlo Wood, Run on IRC <carlo@alinoe.com> 00009 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt 00010 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61 00011 // 00012 // This file may be distributed under the terms of the Q Public License 00013 // version 1.0 as appearing in the file LICENSE.QPL included in the 00014 // packaging of this file. 00015 00016 #ifndef NICKPAIR_H 00017 #define NICKPAIR_H 00018 00019 #ifndef USE_PCH 00020 #include <iosfwd> 00021 #include <string> 00022 #include <deque> 00023 #endif 00024 00025 //! @brief An input/output nick pair. 00026 // 00027 // When a client changes nick, it has temporarily two nicks: the new one 00028 // for subsequent messages from the client, and the old one for incoming 00029 // messages from the server, until a NICK newnick from the server is 00030 // received. This class keeps track of both nicks. 00031 class NickPair { 00032 private: 00033 std::ostream& M_session; //!< The socket for which this nick pair is being kept. 00034 std::string M_in_nick; //!< The last NICK received from the socket. 00035 std::string M_out_nick; //!< The last NICK sent to the socket. 00036 std::deque<std::string> M_out_nicks; //!< Unconfirmed outgoing nicks. 00037 00038 public: 00039 //! Create a NickPair instance for the session \a session. 00040 NickPair(std::ostream& session) : M_session(session) { } 00041 00042 void send_nick(std::string const& nick); // Write NICK immediately to the socket. 00043 bool nick_received(std::string const& nick);// A new NICK was received from the socket. 00044 void inuse(std::string const& nick); // The requested nick change was refused. 00045 00046 //! Returns the last NICK received. 00047 std::string const& in_nick(void) const { return M_in_nick; } 00048 00049 //! Returns the last NICK sent. 00050 std::string const& out_nick(void) const { return M_out_nick; } 00051 }; 00052 00053 #endif // NICKPAIR_H
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|