ircproxy The Ultimate Cyborg |
00001 // ircproxy -- An IRC bouncer. 00002 // 00003 //! @file QuestionTarget.h 00004 //! @brief This file contains the declaration of class QuestionTarget. 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 QUESTIONTARGET_H 00017 #define QUESTIONTARGET_H 00018 00019 #ifndef USE_PCH 00020 #include "debug.h" 00021 #endif 00022 00023 #include "Target.h" 00024 #include "UserAnswer.h" 00025 #include "PrivateTarget.h" 00026 00027 class ClientMessageIn; 00028 00029 /*! @brief A fake channel that is used for communication between user and ircproxy. 00030 * 00031 * The application can ask questions to the user. Doing so will cause the user 00032 * to join a new channel where the question will be displayed. Answering the question 00033 * has to be done on this channel as a public message. 00034 * 00035 * Those public messages will end up being sent to this QuestionTarget object. 00036 * Also any queries about the channel by the client will end up being sent to this target. 00037 */ 00038 class QuestionTarget : public PrivateTarget { 00039 private: 00040 boost::shared_ptr<UserQuestion> M_user_question; //!< Shared pointer to the associated UserQuestion. 00041 00042 public: 00043 //! Construct a QuestionTarget with name \a target_name, defined uniquely for 00044 // network \a network, (first) requested by \a client_session. 00045 QuestionTarget(ClientSession& client_session, std::string const& target_name, Network& network) : 00046 PrivateTarget(client_session, target_name, network) 00047 { Dout(dc::objects, "Constructing QuestionTarget(" << 00048 client_session << ", \"" << target_name << "\", " << network << ")"); } 00049 #ifdef CWDEBUG 00050 //! Destructor. 00051 ~QuestionTarget() { Dout(dc::objects, "Destructing QuestionTarget " << *this); } 00052 //! Copy-constructor. 00053 QuestionTarget(QuestionTarget const& question_target) : PrivateTarget(question_target) 00054 { Dout(dc::objects, "Copy-constructing QuestionTarget from " << question_target); } 00055 #endif 00056 00057 //! Assign the corresponding UserQuestion to this object. 00058 //! Called by UserAnswerEventRequestBase::UserAnswerEventRequestBase. 00059 void set_user_question(boost::shared_ptr<UserQuestion> const& user_question) { M_user_question = user_question; } 00060 //! Disconnect UserQuestion from this object again. 00061 //! Called by UserAnswerEventRequestBase::~UserAnswerEventRequestBase. 00062 void reset_user_question(void) { M_user_question.reset(); } 00063 00064 void create_channel_and_ask_question(void); 00065 00066 // Called when a new message is received. 00067 virtual void new_client_message_received(ClientMessageIn const& msg); 00068 }; 00069 00070 #endif // QUESTIONTARGET_H
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|