21 #define ZNC_MSG_DEPRECATED(msg)
23 #define ZNC_MSG_DEPRECATED(msg) __attribute__((deprecated(msg)))
26 #include <znc/zncconfig.h>
137 const timeval&
GetTime()
const {
return m_time; }
138 void SetTime(
const timeval& ts) { m_time = ts; }
157 template <
typename M>
159 static_assert(std::is_base_of<CMessage, M>{},
160 "Must be subclass of CMessage");
161 static_assert(
sizeof(M) ==
sizeof(
CMessage),
162 "No data members allowed in CMessage subclasses.");
163 return static_cast<M&
>(*this);
166 template <
typename M>
167 const M&
As() const& {
168 static_assert(std::is_base_of<CMessage, M>{},
169 "Must be subclass of CMessage");
170 static_assert(
sizeof(M) ==
sizeof(
CMessage),
171 "No data members allowed in CMessage subclasses.");
172 return static_cast<const M&
>(*this);
175 template <
typename M,
typename =
typename std::enable_if<
176 std::is_base_of<CMessage, M>{}>::type>
180 template <
typename M,
typename =
typename std::enable_if<
181 std::is_base_of<CMessage, M>{}>::type>
182 operator const M&()
const& {
186 #define REGISTER_ZNC_MESSAGE(M)
190 template <
typename M>
205 CChan* m_pChan =
nullptr;
207 bool m_bColon =
false;
212 template <
typename M,
typename =
typename std::enable_if<
213 std::is_base_of<CMessage, M>{}>::type>
214 inline ::std::ostream& operator<<(::std::ostream& os,
const M& msg) {
237 SetParam(1,
"\001ACTION " + sText +
"\001");
#define REGISTER_ZNC_MESSAGE(M)
Definition: Message.h:186
#define ZNC_MSG_DEPRECATED(msg)
Definition: Message.h:23
std::vector< CString > VCString
Definition: ZNCString.h:38
Definition: Message.h:231
CString GetText() const
Definition: Message.h:233
void SetText(const CString &sText)
Definition: Message.h:236
Definition: Message.h:242
bool IsReply() const
Definition: Message.h:244
CString GetText() const
Definition: Message.h:245
void SetText(const CString &sText)
Definition: Message.h:248
Definition: Message.h:338
void SetNewIdent(const CString &sIdent)
Definition: Message.h:341
CString GetNewIdent() const
Definition: Message.h:340
void SetNewHost(const CString &sHost)
Definition: Message.h:343
CString GetNewHost() const
Definition: Message.h:342
Definition: IRCNetwork.h:40
Definition: Message.h:252
void SetKey(const CString &sKey)
Definition: Message.h:255
CString GetKey() const
Definition: Message.h:254
Definition: Message.h:293
CString GetReason() const
Definition: Message.h:297
void SetKickedNick(const CString &sNick)
Definition: Message.h:296
CString GetKickedNick() const
Definition: Message.h:295
void SetText(const CString &sText)
Definition: Message.h:300
void SetReason(const CString &sReason)
Definition: Message.h:298
CString GetText() const
Definition: Message.h:299
Here is a small explanation of how messages on IRC work, and how you can use this class to get useful...
Definition: Message.h:57
void SetTag(const CString &sKey, const CString &sValue)
FormatFlags
Definition: Message.h:146
@ ExcludePrefix
Definition: Message.h:148
@ ExcludeTags
Definition: Message.h:149
@ IncludeAll
Definition: Message.h:147
Type
Definition: Message.h:64
const timeval & GetTime() const
Definition: Message.h:137
void SetNick(const CNick &Nick)
Definition: Message.h:106
void Clone(const CMessage &Other)
void SetClient(CClient *pClient)
Definition: Message.h:99
void SetTime(const timeval &ts)
Definition: Message.h:138
const MCString & GetTags() const
Definition: Message.h:140
Type GetType() const
Definition: Message.h:88
CString ToString(unsigned int uFlags=IncludeAll) const
CClient * GetClient() const
Definition: Message.h:98
CString GetParamsColon(unsigned int uIdx, unsigned int uLen=-1) const
CNick & GetNick()
Definition: Message.h:104
VCString GetParamsSplit(unsigned int uIdx, unsigned int uLen=-1) const
Get a subset of the message parameters.
CChan * GetChan() const
Definition: Message.h:101
bool Equals(const CMessage &Other) const
CString GetParam(unsigned int uIdx) const
CString GetParams(unsigned int uIdx, unsigned int uLen=-1) const ZNC_MSG_DEPRECATED("Use GetParamsColon() instead")
Definition: Message.h:128
CString GetTag(const CString &sKey) const
const VCString & GetParams() const
Definition: Message.h:111
const CNick & GetNick() const
Definition: Message.h:105
void SetChan(CChan *pChan)
Definition: Message.h:102
M & As() &
Definition: Message.h:158
void SetCommand(const CString &sCommand)
CMessage(const CNick &Nick, const CString &sCommand, const VCString &vsParams=VCString(), const MCString &mssTags=MCString::EmptyMap)
CIRCNetwork * GetNetwork() const
Definition: Message.h:94
void SetParams(VCString &&vsParams)
void SetTags(const MCString &mssTags)
Definition: Message.h:141
const M & As() const &
Definition: Message.h:167
const CString & GetCommand() const
Definition: Message.h:108
CMessage(const CString &sMessage="")
void SetNetwork(CIRCNetwork *pNetwork)
Definition: Message.h:95
void SetParams(const VCString &vsParams)
void SetParam(unsigned int uIdx, const CString &sParam)
void Parse(const CString &sMessage)
Definition: Message.h:259
bool HasModes() const
Definition: Message.h:268
VCString GetModeParams() const
Definition: Message.h:266
CString GetModeList() const
Definition: Message.h:264
CString GetModes() const
Definition: Message.h:262
Definition: Message.h:272
void SetNewNick(const CString &sNick)
Definition: Message.h:276
CString GetNewNick() const
Definition: Message.h:275
CString GetOldNick() const
Definition: Message.h:274
const CString & GetNick() const
Definition: Message.h:280
CString GetText() const
Definition: Message.h:282
void SetText(const CString &sText)
Definition: Message.h:283
Definition: Message.h:287
unsigned int GetCode() const
Definition: Message.h:289
Definition: Message.h:304
void SetText(const CString &sText)
Definition: Message.h:309
void SetReason(const CString &sReason)
Definition: Message.h:307
CString GetReason() const
Definition: Message.h:306
CString GetText() const
Definition: Message.h:308
Definition: Message.h:313
CString GetReason() const
Definition: Message.h:315
void SetText(const CString &sText)
Definition: Message.h:318
CString GetText() const
Definition: Message.h:317
void SetReason(const CString &sReason)
Definition: Message.h:316
String class that is used inside ZNC.
Definition: ZNCString.h:68
unsigned int ToUInt() const
@ EDEBUG
Definition: ZNCString.h:76
CString TrimSuffix_n(const CString &sSuffix) const
Trim a given suffix.
CString TrimPrefix_n(const CString &sPrefix=":") const
Trim a given prefix.
bool Equals(const CString &s, CaseSensitivity cs=CaseInsensitive) const
Check if this string is equal to some other string.
Definition: Message.h:224
CString GetTarget() const
Definition: Message.h:226
void SetTarget(const CString &sTarget)
Definition: Message.h:227
Definition: Message.h:322
void SetText(const CString &sText)
Definition: Message.h:325
CString GetText() const
Definition: Message.h:324
Definition: Message.h:329
void SetTopic(const CString &sTopic)
Definition: Message.h:332
CString GetTopic() const
Definition: Message.h:331
void SetText(const CString &sText)
Definition: Message.h:334
CString GetText() const
Definition: Message.h:333
A dictionary for strings.
Definition: ZNCString.h:595
static const MCString EmptyMap
A static instance of an empty map.
Definition: ZNCString.h:606