From 0afd0cf5dd1b7975c4ea2e86c7d7e29ecb6f4092 Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 8 Apr 2008 08:21:40 +0000 Subject: [PATCH] Support channels other than #chan or &chan Without this e.g. +chans are changed to #+chans in CChan::CChan() because IsChan() pretends it's sure that this can't be a channel. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1019 726aef4b-f618-498e-8847-2d620e286838 --- User.cpp | 11 ++++++++++- User.h | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/User.cpp b/User.cpp index d83d3628..4f84feaf 100644 --- a/User.cpp +++ b/User.cpp @@ -39,7 +39,7 @@ CUser::CUser(const CString& sUserName) { m_bAdmin= false; m_bDenySetVHost= false; m_sStatusPrefix = "*"; - m_sChanPrefixes = "#&"; + m_sChanPrefixes = ""; m_uBufferCount = 50; m_uMaxJoinTries = 0; m_bKeepBuffer = false; @@ -984,6 +984,15 @@ void CUser::SetUserName(const CString& s) { m_sUserName = s; } +bool CUser::IsChan(const CString& sChan) const { + if (sChan.empty()) + return false; // There is no way this is a chan + if (GetChanPrefixes().empty()) + return true; // We can't know, so we allow everything + // Thanks to the above if(empty), we can do sChan[0] + return GetChanPrefixes().find(sChan[0]) != CString::npos; +} + void CUser::SetNick(const CString& s) { m_sNick = s; } void CUser::SetAltNick(const CString& s) { m_sAltNick = s; } void CUser::SetIdent(const CString& s) { m_sIdent = s; } diff --git a/User.h b/User.h index d28cdba4..7094920f 100644 --- a/User.h +++ b/User.h @@ -136,7 +136,7 @@ public: void SetBufferCount(unsigned int u); void SetKeepBuffer(bool b); void SetAutoCycle(bool b); - void SetChanPrefixes(const CString& s) { m_sChanPrefixes = (s.empty()) ? "#&" : s; } + void SetChanPrefixes(const CString& s) { m_sChanPrefixes = s; } void SetBeingDeleted(bool b) { m_bBeingDeleted = b; } void SetTimestampFormat(const CString& s) { m_sTimestampFormat = s; } void SetTimestampAppend(bool b) { m_bAppendTimestamp = b; } @@ -166,7 +166,7 @@ public: bool GetIRCConnectEnabled() const { return m_bIRCConnectEnabled; } const CString& GetChanPrefixes() const { return m_sChanPrefixes; } - bool IsChan(const CString& sChan) const { return (sChan.size() && GetChanPrefixes().find(sChan[0]) != CString::npos); } + bool IsChan(const CString& sChan) const; const CString& GetUserPath() const { if (!CFile::Exists(m_sUserPath)) { CUtils::MakeDir(m_sUserPath); } return m_sUserPath; } const CString& GetDLPath() const { if (!CFile::Exists(m_sDLPath)) { CUtils::MakeDir(m_sDLPath); } return m_sDLPath; }