2
* Copyright (C) 2004-2011 See the AUTHORS file for details.
2
* Copyright (C) 2004-2012 See the AUTHORS file for details.
4
4
* This program is free software; you can redistribute it and/or modify it
5
5
* under the terms of the GNU General Public License version 2 as published
6
6
* by the Free Software Foundation.
10
#include <znc/IRCNetwork.h>
11
#include <znc/IRCSock.h>
14
14
const char *szReply;
18
18
// TODO this list is far from complete, no errors are handled
19
19
static const struct {
20
20
const char *szRequest;
21
struct reply vReplies[10];
21
struct reply vReplies[16];
22
22
} vRouteReplies[] = {
24
{"402", true}, /* rfc1459 ERR_NOSUCHSERVER */
25
{"352", false}, /* rfc1459 RPL_WHOREPLY */
26
{"315", true}, /* rfc1459 RPL_ENDOFWHO */
25
27
{"354", false}, // e.g. Quaknet uses this for WHO #chan %n
26
28
{"403", true}, // No such chan
32
{"402", true}, /* rfc1459 ERR_NOSUCHSERVER */
33
{"321", false}, /* rfc1459 RPL_LISTSTART */
34
{"322", false}, /* rfc1459 RPL_LIST */
35
{"323", true}, /* rfc1459 RPL_LISTEND */
39
{"353", false}, /* rfc1459 RPL_NAMREPLY */
40
{"366", true}, /* rfc1459 RPL_ENDOFNAMES */
39
41
// No such nick/channel
46
{"251", false}, /* rfc1459 RPL_LUSERCLIENT */
47
{"252", false}, /* rfc1459 RPL_LUSEROP */
48
{"253", false}, /* rfc1459 RPL_LUSERUNKNOWN */
49
{"254", false}, /* rfc1459 RPL_LUSERCHANNELS */
50
{"255", false}, /* rfc1459 RPL_LUSERME */
51
53
// We don't handle 250 here since some IRCds don't sent it
58
{"311", false}, /* rfc1459 RPL_WHOISUSER */
59
{"312", false}, /* rfc1459 RPL_WHOISSERVER */
60
{"313", false}, /* rfc1459 RPL_WHOISOPERATOR */
61
{"317", false}, /* rfc1459 RPL_WHOISIDLE */
62
{"319", false}, /* rfc1459 RPL_WHOISCHANNELS */
59
63
// "<ip> :actually using host"
62
// No such nick/channel
65
{"301", false}, /* rfc1459 RPL_AWAY */
66
{"318", true}, /* rfc1459 RPL_ENDOFWHOIS */
67
{"401", true}, /* rfc1459 ERR_NOSUCHNICK */
68
{"402", true}, /* rfc1459 ERR_NOSUCHSERVER */
69
{"431", true}, /* rfc1459 ERR_NONICKNAMEGIVEN */
74
{"402", true}, /* rfc1459 ERR_NOSUCHSERVER */
75
{"409", true}, /* rfc1459 ERR_NOORIGIN */
80
{"461", true}, /* rfc1459 ERR_NEEDMOREPARAMS */
84
{"391", true}, /* rfc1459 RPL_TIME */
85
{"402", true}, /* rfc1459 ERR_NOSUCHSERVER */
89
{"406", false}, /* rfc1459 ERR_WASNOSUCHNICK */
90
{"312", false}, /* rfc1459 RPL_WHOISSERVER */
91
{"314", false}, /* rfc1459 RPL_WHOWASUSER */
92
{"369", true}, /* rfc1459 RPL_ENDOFWHOWAS */
93
{"431", true}, /* rfc1459 ERR_NONICKNAMEGIVEN */
97
{"303", true}, /* rfc1459 RPL_ISON */
98
{"461", true}, /* rfc1459 ERR_NEEDMOREPARAMS */
102
{"364", false}, /* rfc1459 RPL_LINKS */
103
{"365", true}, /* rfc1459 RPL_ENDOFLINKS */
104
{"402", true}, /* rfc1459 ERR_NOSUCHSERVER */
115
{"481", true}, /* rfc1459 ERR_NOPRIVILEGES */
119
{"200", false}, /* rfc1459 RPL_TRACELINK */
120
{"201", false}, /* rfc1459 RPL_TRACECONNECTING */
121
{"202", false}, /* rfc1459 RPL_TRACEHANDSHAKE */
122
{"203", false}, /* rfc1459 RPL_TRACEUNKNOWN */
123
{"204", false}, /* rfc1459 RPL_TRACEOPERATOR */
124
{"205", false}, /* rfc1459 RPL_TRACEUSER */
125
{"206", false}, /* rfc1459 RPL_TRACESERVER */
126
{"208", false}, /* rfc1459 RPL_TRACENEWTYPE */
127
{"261", false}, /* rfc1459 RPL_TRACELOG */
129
{"402", true}, /* rfc1459 ERR_NOSUCHSERVER */
135
{"392", false}, /* rfc1459 RPL_USERSSTART */
136
{"393", false}, /* rfc1459 RPL_USERS */
137
{"394", true}, /* rfc1459 RPL_ENDOFUSERS */
138
{"395", false}, /* rfc1459 RPL_NOUSERS */
139
{"402", true}, /* rfc1459 ERR_NOSUCHSERVER */
140
{"424", true}, /* rfc1459 ERR_FILEERROR */
141
{"446", true}, /* rfc1459 ERR_USERSDISABLED */
116
144
// This is just a list of all possible /mode replies stuffed together.
159
{"467", true}, /* rfc1459 ERR_KEYSET */
160
{"472", true}, /* rfc1459 ERR_UNKNOWNMODE */
161
{"501", true}, /* rfc1459 ERR_UMODEUNKNOWNFLAG */
162
{"502", true}, /* rfc1459 ERR_USERSDONTMATCH */
133
165
// END (last item!)
389
425
it->second.erase(it->second.begin());
392
virtual void OnModCommand(const CString& sCommand) {
393
const CString sCmd = sCommand.Token(0);
394
const CString sArgs = sCommand.Token(1, true);
428
void SilentCommand(const CString& sLine) {
429
const CString sValue = sLine.Token(1);
396
if (sCmd.Equals("silent")) {
397
if (sArgs.Equals("yes")) {
398
SetNV("silent_timeouts", "yes");
399
PutModule("Disabled timeout messages");
400
} else if (sArgs.Equals("no")) {
401
DelNV("silent_timeouts");
402
PutModule("Enabled timeout messages");
403
} else if (sArgs.empty()) {
404
if (GetNV("silent_timeouts") == "yes")
405
PutModule("Timeout messages are disabled");
407
PutModule("Timeout message are enabled");
409
PutModule("Invalid argument");
411
PutModule("Available commands: silent [yes/no], silent");
431
if (!sValue.empty()) {
432
SetNV("silent_timeouts", sValue);
435
CString sPrefix = GetNV("silent_timeouts").ToBool() ? "dis" : "en";
436
PutModule("Timeout messages are " + sPrefix + "abled.");
415
439
CClient *m_pDoing;