mirror of
https://github.com/znc/znc.git
synced 2026-08-09 10:23:14 +02:00
Add CIRCNetwork::ExpandString
This commit is contained in:
@@ -39,6 +39,10 @@ public:
|
||||
SetReply(sReply);
|
||||
}
|
||||
|
||||
if (m_pNetwork) {
|
||||
return m_pNetwork->ExpandString(sReply);
|
||||
}
|
||||
|
||||
return m_pUser->ExpandString(sReply);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
|
||||
// We don't limit this to NICKLEN, because we dont know
|
||||
// NICKLEN yet.
|
||||
sNick = m_sAwayNick = m_pUser->ExpandString(m_sAwayNick);
|
||||
sNick = m_sAwayNick = m_pNetwork->ExpandString(m_sAwayNick);
|
||||
}
|
||||
return CONTINUE;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public:
|
||||
uLen = pIRCSock->GetMaxNickLen();
|
||||
}
|
||||
|
||||
m_sAwayNick = m_pUser->ExpandString(m_sFormat).Left(uLen);
|
||||
m_sAwayNick = m_pNetwork->ExpandString(m_sFormat).Left(uLen);
|
||||
return m_sAwayNick;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
CString sData = m_pUser->ExpandString(GetNV("Format"));
|
||||
CString sData = m_pNetwork->ExpandString(GetNV("Format"));
|
||||
|
||||
// If the format doesn't contain anything expandable, we'll
|
||||
// assume this is an "old"-style format string.
|
||||
|
||||
+8
-2
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "User.h"
|
||||
#include "IRCNetwork.h"
|
||||
#include <algorithm>
|
||||
|
||||
class CPerform : public CModule {
|
||||
@@ -50,7 +51,12 @@ class CPerform : public CModule {
|
||||
Table.SetCell("Id", CString(index));
|
||||
Table.SetCell("Perform", *it);
|
||||
|
||||
sExpanded = GetUser()->ExpandString(*it);
|
||||
if (m_pNetwork) {
|
||||
sExpanded = m_pNetwork->ExpandString(*it);
|
||||
} else {
|
||||
sExpanded = GetUser()->ExpandString(*it);
|
||||
}
|
||||
|
||||
if (sExpanded != *it) {
|
||||
Table.SetCell("Expanded", sExpanded);
|
||||
}
|
||||
@@ -122,7 +128,7 @@ public:
|
||||
|
||||
virtual void OnIRCConnected() {
|
||||
for (VCString::const_iterator it = m_vPerform.begin(); it != m_vPerform.end(); ++it) {
|
||||
PutIRC(GetUser()->ExpandString(*it));
|
||||
PutIRC(m_pNetwork->ExpandString(*it));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -58,7 +58,7 @@ public:
|
||||
}
|
||||
virtual ~CWatchEntry() {}
|
||||
|
||||
bool IsMatch(const CNick& Nick, const CString& sText, const CString& sSource, const CUser* pUser) {
|
||||
bool IsMatch(const CNick& Nick, const CString& sText, const CString& sSource, const CIRCNetwork* pNetwork) {
|
||||
if (IsDisabled()) {
|
||||
return false;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
return false;
|
||||
if (!Nick.GetHostMask().AsLower().WildCmp(m_sHostMask.AsLower()))
|
||||
return false;
|
||||
return (sText.AsLower().WildCmp(pUser->ExpandString(m_sPattern).AsLower()));
|
||||
return (sText.AsLower().WildCmp(pNetwork->ExpandString(m_sPattern).AsLower()));
|
||||
}
|
||||
|
||||
bool operator ==(const CWatchEntry& WatchEntry) {
|
||||
@@ -287,7 +287,7 @@ private:
|
||||
for (list<CWatchEntry>::iterator it = m_lsWatchers.begin(); it != m_lsWatchers.end(); ++it) {
|
||||
CWatchEntry& WatchEntry = *it;
|
||||
|
||||
if (WatchEntry.IsMatch(Nick, sMessage, sSource, m_pUser)) {
|
||||
if (WatchEntry.IsMatch(Nick, sMessage, sSource, m_pNetwork)) {
|
||||
if (m_pNetwork->IsUserAttached()) {
|
||||
m_pNetwork->PutUser(":" + WatchEntry.GetTarget() + "!watch@znc.in PRIVMSG " +
|
||||
m_pNetwork->GetCurNick() + " :" + sMessage);
|
||||
|
||||
Reference in New Issue
Block a user