00001
00002
00003
00004 #ifndef __MESSAGE_H__
00005 #define __MESSAGE_H__
00006
00007 #include <string>
00008 #include <boost/signal.hpp>
00009 #include "command.h"
00010 #include "entity.h"
00011 #include "user.h"
00012 #include "channel.h"
00013
00014 namespace ircpp {
00015 class session;
00016
00028 class message
00029 {
00030
00031 public:
00032
00033 explicit message(session& parent);
00034 ~message();
00035
00036
00037 const session& parent() const;
00038
00039
00040 const std::string& raw_line() const;
00041 const command& cmd() const;
00042 const user& from() const;
00043 const entity& to() const;
00044 const entity& target() const;
00045 const size_t num_params(bool allparams = false) const;
00046 const std::string& param(size_t num, bool strip = true, bool allparams = false) const;
00047 const std::string& params(size_t num = 0, bool strip = true, bool allparams = false) const;
00048
00049
00050 user& from_internal();
00051 entity& to_internal();
00052 entity& target_internal();
00053
00054
00055 bool is_ctcp() const;
00056
00057
00058 public:
00059 static int ircstrcasecmp(const std::string &s1, const std::string &s2);
00060 static void strip(std::string& str);
00061
00062
00063 private:
00064 session& s;
00065 std::string _raw_line;
00066 command _command;
00067 user* _from;
00068 entity* _to;
00069 entity *_target;
00070 std::vector<size_t> param_positions;
00071 std::vector<std::string> _param;
00072 std::vector<std::string> _param_stripped;
00073 mutable std::vector<std::string *> _params;
00074 mutable std::vector<std::string *> _params_stripped;
00075 size_t _params_start;
00076 const static std::string _empty;
00077
00078
00079 friend class parser;
00080 };
00081
00082 }
00083
00084 #endif