Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

include Module when instantiating CAttachMatch

This allows for the use of stuff like %nick% through ExpandString in the
search feature.
  • Loading branch information...
commit 77e4ae540816c6319f09e7566e85852834d284c3 1 parent addd047
@gtmanfred gtmanfred authored
Showing with 8 additions and 6 deletions.
  1. +8 −6 modules/autoattach.cpp
View
14 modules/autoattach.cpp
@@ -14,8 +14,9 @@ using std::vector;
class CAttachMatch {
public:
- CAttachMatch(const CString& sChannels, const CString& sSearch, const CString& sHostmasks, bool bNegated)
+ CAttachMatch(CModule *pModule, const CString& sChannels, const CString& sSearch, const CString& sHostmasks, bool bNegated)
{
+ m_pModule = pModule;
m_sChannelWildcard = sChannels;
m_sSearchWildcard = sSearch;
m_sHostmaskWildcard = sHostmasks;
@@ -29,7 +30,7 @@ class CAttachMatch {
m_sHostmaskWildcard = "*!*@*";
}
- bool IsMatch(const CString& sChan, const CString& sHost, const CString& sMessage) const {
+ bool IsMatch(const CString& sChan, const CString& sHost, const CString& sMessage, const CModule *pModule) const {
if (!sHost.WildCmp(m_sHostmaskWildcard))
return false;
if (!sChan.WildCmp(m_sChannelWildcard))
@@ -69,10 +70,10 @@ class CAttachMatch {
private:
bool m_bNegated;
+ CModule *m_pModule;
CString m_sChannelWildcard;
CString m_sSearchWildcard;
CString m_sHostmaskWildcard;
- CModules* m_pModule;
};
class CChanAttach : public CModule {
@@ -189,6 +190,7 @@ class CChanAttach : public CModule {
const CString& sChan = Channel.GetName();
const CString& sHost = Nick.GetHostMask();
const CString& sMessage = Message;
+ const CModule* pModule = this;
VAttachIter it;
if (!Channel.IsDetached())
@@ -196,13 +198,13 @@ class CChanAttach : public CModule {
// Any negated match?
for (it = m_vMatches.begin(); it != m_vMatches.end(); ++it) {
- if (it->IsNegated() && it->IsMatch(sChan, sHost, sMessage))
+ if (it->IsNegated() && it->IsMatch(sChan, sHost, sMessage, pModule))
return;
}
// Now check for a positive match
for (it = m_vMatches.begin(); it != m_vMatches.end(); ++it) {
- if (!it->IsNegated() && it->IsMatch(sChan, sHost, sMessage)) {
+ if (!it->IsNegated() && it->IsMatch(sChan, sHost, sMessage, pModule)) {
Channel.JoinUser();
return;
}
@@ -239,7 +241,7 @@ class CChanAttach : public CModule {
}
bool Add(bool bNegated, const CString& sChan, const CString& sSearch, const CString& sHost) {
- CAttachMatch attach(sChan, sSearch, sHost, bNegated);
+ CAttachMatch attach(this, sChan, sSearch, sHost, bNegated);
// Check for duplicates
VAttachIter it = m_vMatches.begin();

0 comments on commit 77e4ae5

Please sign in to comment.
Something went wrong with that request. Please try again.