diff --git a/include/znc/Message.h b/include/znc/Message.h index eb3f5cb4..b9bde632 100644 --- a/include/znc/Message.h +++ b/include/znc/Message.h @@ -30,6 +30,14 @@ #define ZNC_LVREFQUAL #endif +#ifdef SWIG +#define ZNC_MSG_DEPRECATED(msg, repl) +#elif defined(__clang__) +#define ZNC_MSG_DEPRECATED(msg, repl) __attribute__((deprecated(msg, repl))) +#else +#define ZNC_MSG_DEPRECATED(msg, repl) __attribute__((deprecated(msg))) +#endif + #include #include #include @@ -55,7 +63,8 @@ class CIRCNetwork; * - `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(). + * leading colon (:). If you don't want to remove the colon, use + * GetParamsColon(). * * For certain events, like a PRIVMSG, convienience commands like GetChan() and * GetNick() are available, this is not true for all CMessage extensions. @@ -114,9 +123,15 @@ class CMessage { void SetCommand(const CString& sCommand); const VCString& GetParams() const { return m_vsParams; } - CString GetParams(unsigned int uIdx, unsigned int uLen = -1) const; void SetParams(const VCString& vsParams); + /// @deprecated use GetParamsColon() instead. + CString GetParams(unsigned int uIdx, unsigned int uLen = -1) const + ZNC_MSG_DEPRECATED("Use GetParamsColon() instead", "GetParamsColon") { + return GetParamsColon(uIdx, uLen); + } + CString GetParamsColon(unsigned int uIdx, unsigned int uLen = -1) const; + CString GetParam(unsigned int uIdx) const; void SetParam(unsigned int uIdx, const CString& sParam); diff --git a/src/Message.cpp b/src/Message.cpp index d0696ffa..1beed063 100644 --- a/src/Message.cpp +++ b/src/Message.cpp @@ -48,7 +48,7 @@ void CMessage::SetCommand(const CString& sCommand) { InitType(); } -CString CMessage::GetParams(unsigned int uIdx, unsigned int uLen) const { +CString CMessage::GetParamsColon(unsigned int uIdx, unsigned int uLen) const { if (m_vsParams.empty() || uLen == 0) { return ""; }