Implement invite-notify

This commit is contained in:
Alexey Sokolov
2025-04-18 22:23:01 +01:00
parent 9ab81d1dad
commit 5befe2f7f8
14 changed files with 95 additions and 16 deletions
+7 -2
View File
@@ -116,6 +116,7 @@ class CClient : public CIRCSocket {
bool HasCapNotify() const { return m_bCapNotify; }
bool HasAwayNotify() const { return m_bAwayNotify; }
bool HasAccountNotify() const { return m_bAccountNotify; }
bool HasInviteNotify() const { return m_bInviteNotify; }
bool HasExtendedJoin() const { return m_bExtendedJoin; }
bool HasNamesx() const { return m_bNamesx; }
bool HasUHNames() const { return m_bUHNames; }
@@ -180,8 +181,10 @@ class CClient : public CIRCSocket {
*
* Message type | Capability
* ------------ | ----------
* \c ACCOUNT | \l CClient::HasAccountNotify() (<a href="http://ircv3.net/specs/extensions/account-notify-3.1.html">account-notify</a>)
* \c AWAY | \l CClient::HasAwayNotify() (<a href="http://ircv3.net/specs/extensions/away-notify-3.1.html">away-notify</a>)
* \c ACCOUNT | \l CClient::HasAccountNotify() (<a href="http://ircv3.net/specs/extensions/account-notify">account-notify</a>)
* \c AWAY | \l CClient::HasAwayNotify() (<a href="http://ircv3.net/specs/extensions/away-notify">away-notify</a>)
* \c INVITE | \l CClient::HasInviteNotify() (<a href="http://ircv3.net/specs/extensions/invite-notify">invite-notify</a>) if someone else is invited; invites sent to this user are not filtered out regardless of any capability.
* \c TAGMSG | \l CClient::HasMessageTagCap() (<a href="http://ircv3.net/specs/extensions/message-tags">message-tags</a>)
*
* ### Message tags
*
@@ -193,6 +196,7 @@ class CClient : public CIRCSocket {
* ----------- | ----------
* \c time | \l CClient::HasServerTime() (<a href="http://ircv3.net/specs/extensions/server-time-3.2.html">server-time</a>)
* \c batch | \l CClient::HasBatch() (<a href="http://ircv3.net/specs/extensions/batch-3.2.html">batch</a>)
* any tag | \l CClient::HasMessageTagCap() (<a href="http://ircv3.net/specs/extensions/message-tags">message-tags</a>)
*
* Additional tags can be added via \l CClient::SetTagSupport().
*
@@ -321,6 +325,7 @@ class CClient : public CIRCSocket {
bool m_bCapNotify;
bool m_bAwayNotify;
bool m_bAccountNotify;
bool m_bInviteNotify;
bool m_bExtendedJoin;
bool m_bNamesx;
bool m_bUHNames;
+1 -1
View File
@@ -180,7 +180,7 @@ class CIRCSock : public CIRCSocket {
bool OnChgHostMessage(CChgHostMessage& Message);
bool OnCTCPMessage(CCTCPMessage& Message);
bool OnErrorMessage(CMessage& Message);
bool OnInviteMessage(CMessage& Message);
bool OnInviteMessage(CInviteMessage& Message);
bool OnJoinMessage(CJoinMessage& Message);
bool OnKickMessage(CKickMessage& Message);
bool OnModeMessage(CModeMessage& Message);
+9
View File
@@ -311,6 +311,15 @@ class CKickMessage : public CTargetMessage {
};
REGISTER_ZNC_MESSAGE(CKickMessage);
class CInviteMessage : public CMessage {
public:
CString GetInvitedNick() const { return GetParam(0); }
void SetInvitedNick(const CString& sNick) { SetParam(0, sNick); }
CString GetChannel() const { return GetParam(1); }
void SetChannel(const CString& sChannel) { SetParam(1, sChannel); }
};
REGISTER_ZNC_MESSAGE(CInviteMessage);
class CPartMessage : public CTargetMessage {
public:
CString GetReason() const { return GetParam(1); }
+11 -2
View File
@@ -751,11 +751,19 @@ class CModule {
virtual void OnPart(const CNick& Nick, CChan& Channel,
const CString& sMessage);
/** Called when user is invited into a channel
/** Called when a user is invited to a channel.
* That includes the case of `invite-notify`.
* @since 1.10.0
* @param Message The message.
*/
virtual EModRet OnInviteMessage(CInviteMessage& Message);
/** Called when user is invited into a channel.
* @note even in case of `invite-notify` this is only called for "you"
* being invited, as this function has no way to tell you whom is
* invited instead.
* @param Nick The nick who invited you.
* @param sChan The channel the user got invited into
* @return See CModule::EModRet.
* @todo Add OnInviteMessage() hook
*/
virtual EModRet OnInvite(const CNick& Nick, const CString& sChan);
@@ -1610,6 +1618,7 @@ class CModules : public std::vector<CModule*>, private CCoreTranslationMixin {
bool OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage);
bool OnPartMessage(CPartMessage& Message);
bool OnInvite(const CNick& Nick, const CString& sChan);
bool OnInviteMessage(CInviteMessage& Message);
bool OnChanBufferStarting(CChan& Chan, CClient& Client);
bool OnChanBufferEnding(CChan& Chan, CClient& Client);