Implement chghost capability

Interaction with extended-join doesn't yet work correctly, because ZNC
doesn't keep track of everyone's real names
This commit is contained in:
Alexey Sokolov
2024-10-15 11:29:36 +01:00
parent 25b19bb889
commit d49399bbca
7 changed files with 161 additions and 3 deletions
+2
View File
@@ -119,6 +119,7 @@ class CClient : public CIRCSocket {
bool HasExtendedJoin() const { return m_bExtendedJoin; }
bool HasNamesx() const { return m_bNamesx; }
bool HasUHNames() const { return m_bUHNames; }
bool HasChgHost() const { return m_bChgHost; }
bool IsAway() const { return m_bAway; }
bool HasServerTime() const { return m_bServerTime; }
bool HasBatch() const { return m_bBatch; }
@@ -289,6 +290,7 @@ class CClient : public CIRCSocket {
bool m_bExtendedJoin;
bool m_bNamesx;
bool m_bUHNames;
bool m_bChgHost;
bool m_bAway;
bool m_bServerTime;
bool m_bBatch;
+2
View File
@@ -131,6 +131,7 @@ class CIRCSock : public CIRCSocket {
unsigned int GetMaxNickLen() const { return m_uMaxNickLen; }
EChanModeArgs GetModeType(char cMode) const;
char GetPermFromMode(char cMode) const;
char GetModeFromPerm(char cPerm) const;
const std::map<char, EChanModeArgs>& GetChanModes() const {
return m_mceChanModes;
}
@@ -177,6 +178,7 @@ class CIRCSock : public CIRCSocket {
bool OnActionMessage(CActionMessage& Message);
bool OnAwayMessage(CMessage& Message);
bool OnCapabilityMessage(CMessage& Message);
bool OnChgHostMessage(CChgHostMessage& Message);
bool OnCTCPMessage(CCTCPMessage& Message);
bool OnErrorMessage(CMessage& Message);
bool OnInviteMessage(CMessage& Message);
+11
View File
@@ -67,6 +67,7 @@ class CMessage {
Action,
Away,
Capability,
ChgHost,
CTCP,
Error,
Invite,
@@ -121,6 +122,7 @@ class CMessage {
*/
VCString GetParamsSplit(unsigned int uIdx, unsigned int uLen = -1) const;
void SetParams(const VCString& vsParams);
void SetParams(VCString&& vsParams);
/// @deprecated use GetParamsColon() instead.
CString GetParams(unsigned int uIdx, unsigned int uLen = -1) const
@@ -333,4 +335,13 @@ class CTopicMessage : public CTargetMessage {
};
REGISTER_ZNC_MESSAGE(CTopicMessage);
class CChgHostMessage : public CMessage {
public:
CString GetNewIdent() const { return GetParam(0); }
void SetNewIdent(const CString& sIdent) { SetParam(0, sIdent); }
CString GetNewHost() const { return GetParam(1); }
void SetNewHost(const CString& sHost) { SetParam(1, sHost); }
};
REGISTER_ZNC_MESSAGE(CChgHostMessage);
#endif // !ZNC_MESSAGE_H