Here is a small explanation of how messages on IRC work, and how you can use this class to get useful information from the parsed message. More...
#include <Message.h>
Inheritance diagram for CMessage:Public Types | |
| enum | Type { Type::Unknown, Type::Account, Type::Action, Type::Away, Type::Capability, Type::CTCP, Type::Error, Type::Invite, Type::Join, Type::Kick, Type::Mode, Type::Nick, Type::Notice, Type::Numeric, Type::Part, Type::Ping, Type::Pong, Type::Quit, Type::Text, Type::Topic, Type::Wallops } |
| enum | FormatFlags { IncludeAll = 0x0, ExcludePrefix = 0x1, ExcludeTags = 0x2 } |
Public Member Functions | |
| CMessage (const CString &sMessage="") | |
| CMessage (const CNick &Nick, const CString &sCommand, const VCString &vsParams=VCString(), const MCString &mssTags=MCString::EmptyMap) | |
| Type | GetType () const |
| bool | Equals (const CMessage &Other) const |
| void | Clone (const CMessage &Other) |
| CIRCNetwork * | GetNetwork () const |
| void | SetNetwork (CIRCNetwork *pNetwork) |
| CClient * | GetClient () const |
| void | SetClient (CClient *pClient) |
| CChan * | GetChan () const |
| void | SetChan (CChan *pChan) |
| CNick & | GetNick () |
| const CNick & | GetNick () const |
| void | SetNick (const CNick &Nick) |
| const CString & | GetCommand () const |
| void | SetCommand (const CString &sCommand) |
| const VCString & | GetParams () const |
| CString | GetParams (unsigned int uIdx, unsigned int uLen=-1) const |
| void | SetParams (const VCString &vsParams) |
| CString | GetParam (unsigned int uIdx) const |
| void | SetParam (unsigned int uIdx, const CString &sParam) |
| const timeval & | GetTime () const |
| void | SetTime (const timeval &ts) |
| const MCString & | GetTags () const |
| void | SetTags (const MCString &mssTags) |
| CString | GetTag (const CString &sKey) const |
| void | SetTag (const CString &sKey, const CString &sValue) |
| CString | ToString (unsigned int uFlags=IncludeAll) const |
| void | Parse (CString sMessage) |
| template<typename M > | |
| M & | As () ZNC_LVREFQUAL |
| template<typename M > | |
| const M & | As () const ZNC_LVREFQUAL |
| template<typename M , typename = typename std::enable_if< std::is_base_of<CMessage, M>{}>::type> | |
| operator M & () ZNC_LVREFQUAL | |
| template<typename M , typename = typename std::enable_if< std::is_base_of<CMessage, M>{}>::type> | |
| operator const M & () const ZNC_LVREFQUAL | |
Here is a small explanation of how messages on IRC work, and how you can use this class to get useful information from the parsed message.
The output varies greatly and this advice may not apply to every message type, but this will hopefully help you understand how it works more accurately.
=some-tag :server.network.net 366 something #channel :End of /NAMES list. tags nick cmd 0 1 2
tags is the IRCv3 tags associated with the message, obtained with GetTag("t"). the tag can also be obtained with GetTime(), some messages have other tags with them. Tags may not always be present. Refer to IRCv3 for documentation on tags.nick is the sender, which can be obtained with GetNick()cmd is command, which is obtained via GetCommand()0, 1, ... are parameters, available via GetParam(n), which removes the leading colon (:). If you don't want to remove the colon, use GetParams().For certain events, like a PRIVMSG, convienience commands like GetChan() and GetNick() are available, this is not true for all CMessage extensions.
|
strong |
|
explicit |
| CMessage::CMessage | ( | const CNick & | Nick, |
| const CString & | sCommand, | ||
| const VCString & | vsParams = VCString(), |
||
| const MCString & | mssTags = MCString::EmptyMap |
||
| ) |
|
inline |
|
inline |
| bool CMessage::Equals | ( | const CMessage & | Other | ) | const |
Referenced by CBufLine::Equals(), and GetType().
|
inline |
|
inline |
|
inline |
References SetCommand().
Referenced by CNumericMessage::GetCode(), CBufLine::GetCommand(), and CCTCPMessage::IsReply().
|
inline |
|
inline |
Referenced by CNickMessage::GetOldNick().
|
inline |
| CString CMessage::GetParam | ( | unsigned int | uIdx | ) | const |
Referenced by CJoinMessage::GetKey(), CKickMessage::GetKickedNick(), CNickMessage::GetNewNick(), GetParams(), CKickMessage::GetReason(), CPartMessage::GetReason(), CQuitMessage::GetReason(), CTargetMessage::GetTarget(), CActionMessage::GetText(), CCTCPMessage::GetText(), CNoticeMessage::GetText(), CTextMessage::GetText(), and CTopicMessage::GetTopic().
|
inline |
References GetParam(), SetParam(), and SetParams().
Referenced by CModeMessage::GetModes().
| CString CMessage::GetParams | ( | unsigned int | uIdx, |
| unsigned int | uLen = -1 |
||
| ) | const |
|
inline |
Referenced by CBufLine::GetTags().
|
inline |
Referenced by CBufLine::GetTime().
|
inline |
|
inline |
| void CMessage::Parse | ( | CString | sMessage | ) |
Referenced by CBufLine::SetFormat().
|
inline |
|
inline |
| void CMessage::SetCommand | ( | const CString & | sCommand | ) |
Referenced by GetCommand().
|
inline |
| void CMessage::SetParam | ( | unsigned int | uIdx, |
| const CString & | sParam | ||
| ) |
Referenced by GetParams(), CJoinMessage::SetKey(), CKickMessage::SetKickedNick(), CNickMessage::SetNewNick(), CKickMessage::SetReason(), CPartMessage::SetReason(), CQuitMessage::SetReason(), CTargetMessage::SetTarget(), CActionMessage::SetText(), CCTCPMessage::SetText(), CNoticeMessage::SetText(), CTextMessage::SetText(), and CTopicMessage::SetTopic().
| void CMessage::SetParams | ( | const VCString & | vsParams | ) |
Referenced by GetParams().
|
inline |
References GetTag(), and SetTag().
Referenced by CBufLine::SetTags().
|
inline |
Referenced by CBufLine::SetTime().
| CString CMessage::ToString | ( | unsigned int | uFlags = IncludeAll | ) | const |
Referenced by CBufLine::GetFormat().
1.8.11