route_replies: Handle channel lists

This adds support for querying the channel ban, exempt and invex lists to
route_replies. It doesn't differentiate between the replies since there should
only ever be one of these requests in-flight.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2035 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-06-20 15:47:07 +00:00
parent d38953f02c
commit af5ae4b877
+50 -1
View File
@@ -112,6 +112,21 @@ static const struct {
{"266", true},
{NULL, true},
}},
// This is just a list of all possible /mode replies stuffed together.
// Since there should never be more than one of these going on, this
// should work fine and makes the code simpler.
{"MODE", {
// MODE I
{"346", false},
{"347", true},
// MODE b
{"367", false},
{"368", true},
// MODE e
{"348", false},
{"349", true},
{NULL, true},
}},
// END (last item!)
{NULL, {{NULL, true}}}
};
@@ -235,9 +250,43 @@ public:
if (!m_pUser->GetIRCSock())
return CONTINUE;
if (sCmd.Equals("MODE")) {
// Check if this is a mode request that needs to be handled
// If there are arguments to a mode change,
// we must not route it.
if (!sLine.Token(3, true).empty())
return CONTINUE;
// Grab the mode change parameter
CString sMode = sLine.Token(2);
// If this is a channel mode request, znc core replies to it
if (sMode.empty())
return CONTINUE;
// Check if this is a mode change or a specific
// mode request (the later needs to be routed).
sMode.TrimPrefix("+");
if (sMode.length() != 1)
return CONTINUE;
// Now just check if it's one of the supported modes
switch (sMode[0]) {
case 'I':
case 'b':
case 'e':
break;
default:
return CONTINUE;
}
// Ok, this looks like we should route it.
// Fall through to the next loop
}
for (size_t i = 0; vRouteReplies[i].szRequest != NULL; i++) {
if (vRouteReplies[i].szRequest == sCmd) {
struct queued_req req = {
sLine, vRouteReplies[i].vReplies
};