From 8e3f1ef77d968d65efc9b0278ace8aa15a2723a0 Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 3 Jun 2008 12:07:49 +0000 Subject: [PATCH] Module query (like *shell) now uses the module name as prefix, not 'znc' This hopefully avoids some ugly stuff. Namely, irssi pretending *status changed its nick to *shell etc because they have the same ident and host and are in no common channel. This patch is based on a patch from SilverLeo. If this breaks it's his fault! git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1084 726aef4b-f618-498e-8847-2d620e286838 --- Modules.cpp | 15 ++++++++++++--- Modules.h | 8 ++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Modules.cpp b/Modules.cpp index 69539398..06e39be2 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -543,13 +543,22 @@ bool CModule::PutStatus(const CString& sLine) { return (m_pUser) ? m_pUser->PutStatus(sLine, m_pClient) : false; } bool CModule::PutModule(const CString& sLine, const CString& sIdent, const CString& sHost) { - return (m_pUser) ? m_pUser->PutUser(":" + GetModNick() + "!" + sIdent + "@" + sHost + " PRIVMSG " + m_pUser->GetCurNick() + " :" + sLine, m_pClient) : false; + if (!m_pUser) + return false; + return m_pUser->PutUser(":" + GetModNick() + "!" + + (sIdent.empty() ? GetModName() : sIdent) + "@" + sHost + + " PRIVMSG " + m_pUser->GetCurNick() + " :" + sLine, + m_pClient); } bool CModule::PutModNotice(const CString& sLine, const CString& sIdent, const CString& sHost) { - return (m_pUser) ? m_pUser->PutUser(":" + GetModNick() + "!" + sIdent + "@" + sHost + " NOTICE " + m_pUser->GetCurNick() + " :" + sLine, m_pClient) : false; + if (!m_pUser) + return false; + return m_pUser->PutUser(":" + GetModNick() + "!" + + (sIdent.empty() ? GetModName() : sIdent) + "@" + sHost + + " NOTICE " + m_pUser->GetCurNick() + " :" + sLine, + m_pClient); } - /////////////////// // CGlobalModule // /////////////////// diff --git a/Modules.h b/Modules.h index 71734aea..e97eff9b 100644 --- a/Modules.h +++ b/Modules.h @@ -144,8 +144,8 @@ public: virtual bool PutIRC(const CString& sLine); virtual bool PutUser(const CString& sLine); virtual bool PutStatus(const CString& sLine); - virtual bool PutModule(const CString& sLine, const CString& sIdent = "znc", const CString& sHost = "znc.com"); - virtual bool PutModNotice(const CString& sLine, const CString& sIdent = "znc", const CString& sHost = "znc.com"); + virtual bool PutModule(const CString& sLine, const CString& sIdent = "", const CString& sHost = "znc.com"); + virtual bool PutModNotice(const CString& sLine, const CString& sIdent = "", const CString& sHost = "znc.com"); // Setters void SetModule(CModule* p); @@ -281,8 +281,8 @@ public: virtual bool PutIRC(const CString& sLine); virtual bool PutUser(const CString& sLine); virtual bool PutStatus(const CString& sLine); - virtual bool PutModule(const CString& sLine, const CString& sIdent = "znc", const CString& sHost = "znc.com"); - virtual bool PutModNotice(const CString& sLine, const CString& sIdent = "znc", const CString& sHost = "znc.com"); + virtual bool PutModule(const CString& sLine, const CString& sIdent = "", const CString& sHost = "znc.com"); + virtual bool PutModNotice(const CString& sLine, const CString& sIdent = "", const CString& sHost = "znc.com"); const CString& GetModName() const { return m_sModName; } // This is where constant module data (e.g. webadmin skins) are saved