diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-09-06 13:21:35 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-09-06 13:21:35 +0000 |
commit | 4fa581ea125ebbfd46571171a96abb988a9ea0c3 (patch) | |
tree | ea1f3802861524cae413735377e96c94cef4e8c5 | |
parent | 5cd6c1a4f08cd8aa3d8b2e5897de3b59d8a3fb48 (diff) |
Optional use of user object
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10410 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/u_listmode.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/include/u_listmode.h b/include/u_listmode.h index 15c139f6b..b81cfbb84 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -55,7 +55,7 @@ class ListModeRequest : public Request { public: User* user; - const std::string literal; + std::string literal; const char extban; Channel* chan; @@ -83,6 +83,18 @@ class ListModeRequest : public Request { } + /** Check if a literal string is on a channel's list, optionally using an extban char. + * The Event::Send() event returns the ban string if the user is on the channel's list, + * or NULL if the user is not on the list. + * @param sender Sending module + * @param target Target module + * @param User to check against, e.g. "Bob!Bobbertson@weeblshouse" + * @param extbanchar Extended ban character to use for the match, or a null char if not using extban + */ + ListModeRequest(Module* sender, Module* target, User* u, char extbanchar, Channel* channel) : Request(sender, target, "LM_CHECKLIST_EX"), user(u), literal(""), extban(extbanchar), chan(channel) + { + } + /** Destructor */ ~ListModeRequest() @@ -487,7 +499,7 @@ class ListModeBase : public ModeHandler LM->chan->GetExt(GetInfoKey(), mlist); if (mlist) { - std::string mask = std::string(LM->user->nick) + "!" + LM->user->ident + "@" + LM->user->GetIPString(); + std::string mask = LM->user->nick + "!" + LM->user->ident + "@" + LM->user->GetIPString(); for (modelist::iterator it = mlist->begin(); it != mlist->end(); ++it) { if (InspIRCd::Match(LM->user->GetFullRealHost(), it->mask) || InspIRCd::Match(LM->user->GetFullHost(), it->mask) || (InspIRCd::MatchCIDR(mask, it->mask))) @@ -502,6 +514,9 @@ class ListModeBase : public ModeHandler LM->chan->GetExt(GetInfoKey(), mlist); if (mlist) { + if (LM->user) + LM->literal = LM->user->nick + "!" + LM->user->ident + "@" + LM->user->GetIPString(); + for (modelist::iterator it = mlist->begin(); it != mlist->end(); it++) { if (LM->extban && it->mask.length() > 1 && it->mask[0] == LM->extban && it->mask[1] == ':') |