00001
00002
00003
00004 #ifndef __CHANNEL_H__
00005 #define __CHANNEL_H__
00006
00007 #include <string>
00008 #include <boost/signals.hpp>
00009 #include "entity.h"
00010 #include "irclist.h"
00011 #include "channeluserlist.h"
00012
00013 namespace ircpp {
00014 class session;
00015 class parser;
00016 class user;
00017 class message;
00018
00023 class channel : public entity
00024 {
00025
00026 public:
00027
00028 channel(session& parent, const std::string& name, bool temporary = false);
00029 ~channel();
00030
00031
00032 bool is_user() const;
00033 bool is_channel() const;
00034
00035
00036 bool cmd_part(const std::string& partmsg = "") const;
00037 bool cmd_topic(const std::string& newtopic) const;
00038 bool cmd_kick(const std::string& nick, const std::string& reason = "") const;
00039 bool cmd_invite(const std::string& nick) const;
00040 bool cmd_names() const;
00041
00042
00043 const std::string& topic() const;
00044 void* ptr() const;
00045 void ptr(void* p) const;
00046
00047
00048 const user& find_user(const std::string& nick) const;
00049 const irclist<user>::iterator userlist_begin() const;
00050 const irclist<user>::iterator userlist_end() const;
00051
00052
00053 using entity::operator==;
00054 operator bool() const;
00055
00056
00057
00058
00062 mutable boost::signal1<void, const message &> sig_join_msg;
00066 mutable boost::signal1<void, const message &> sig_part_msg;
00070 mutable boost::signal1<void, const message &> sig_quit_msg;
00074 mutable boost::signal1<void, const message &> sig_mode_msg;
00088 mutable boost::signal1<void, const message &> sig_singlemode_msg;
00092 mutable boost::signal1<void, const message &> sig_topic_msg;
00096 mutable boost::signal1<void, const message &> sig_kick_msg;
00100 mutable boost::signal1<void, const message &> sig_invite_msg;
00107 mutable boost::signal1<void, const message &> sig_numeric;
00108
00109
00110 private:
00111 void update_data_slot(const message& msg);
00112 boost::signals::connection update_data_connection;
00113 void quit_slot(const message& msg);
00114 boost::signals::connection quit_connection;
00115
00116
00117 private:
00118 channeluserlist _userlist;
00119 std::string _topic;
00120 mutable void* _ptr;
00121
00122
00123 friend class parser;
00124 friend class session;
00125 friend class channellist;
00126 };
00127
00128 }
00129
00130 #endif