ircproxy The Ultimate Cyborg |
00001 // ircproxy -- An IRC bouncer. 00002 // 00003 //! @file PrivateTarget.h 00004 //! @brief This file contains the declaration of class PrivateTarget. 00005 // 00006 // Copyright (C) 2006, 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 PRIVATETARGET_H 00017 #define PRIVATETARGET_H 00018 00019 #ifndef USE_PCH 00020 #include "debug.h" 00021 #endif 00022 00023 #include "Target.h" 00024 00025 class ClientMessageIn; 00026 class ServerMessageIn; 00027 00028 /*! @brief A fake channel that is used for communication between user and ircproxy. 00029 * 00030 * Base class for NoticeTarget and QuestionTarget. 00031 */ 00032 class PrivateTarget : public Target { 00033 private: 00034 ClientSession& M_client_session; 00035 std::string const M_name; 00036 00037 public: 00038 //! Construct PrivateTarget instance for client session \a client_session with target name \a target_name on network \a network. 00039 PrivateTarget(ClientSession& client_session, std::string const& target_name, Network& network) : 00040 Target(&network), M_client_session(client_session), M_name(target_name) { } 00041 00042 void do_names_output(void); 00043 void handle_command(ClientMessageIn const& msg); 00044 00045 // Return related client session. 00046 ClientSession& client_session(void) { return M_client_session; } 00047 00048 // Called when a new message is received. 00049 virtual void new_client_message_received(ClientMessageIn const& msg); 00050 00051 // Called when a new WHO message is received. 00052 void handle_who(WhoRequest const& who_request); 00053 00054 private: 00055 // Never called. 00056 virtual void new_server_message_received(ServerMessageIn const&) { } 00057 00058 protected: 00059 //! The channel modes for this target, as sent to the client. 00060 virtual char const* channel_modes(void) { return "nt"; } 00061 00062 virtual std::string in_name(ClientSession const& LIBCW_UNUSED(client_session)) const { return M_name; } 00063 virtual std::string in_name(ServerSession const&) const { DoutFatal(dc::core, "Calling PrivateTarget::in_name(ServerSession&)"); } 00064 virtual std::string out_name(ClientSession const& LIBCW_UNUSED(client_session)) const { return M_name; } 00065 virtual std::string out_name(ServerSession const&) const { DoutFatal(dc::core, "Calling PrivateTarget::out_name(ServerSession&)"); } 00066 }; 00067 00068 #endif // PRIVATETARGET_H
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|