From 4fa581ea125ebbfd46571171a96abb988a9ea0c3 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 6 Sep 2008 13:21:35 +0000 Subject: Optional use of user object git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10410 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/u_listmode.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'include') 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] == ':') -- cgit v1.2.3