9 * This source file is subject to the new BSD license that is bundled
10 * with this package in the file LICENSE.
11 * It is also available through the world-wide-web at this URL:
12 * http://phergie.org/license
16 * @author Phergie Development Team <team@phergie.org>
17 * @copyright 2008-2010 Phergie Development Team (http://phergie.org)
18 * @license http://phergie.org/license New BSD License
19 * @link http://pear.phergie.org/package/Phergie
23 * Event originating from the server in response to an event sent by the
28 * @author Phergie Development Team <team@phergie.org>
29 * @license http://phergie.org/license New BSD License
30 * @link http://pear.phergie.org/package/Phergie
31 * @link http://www.irchelp.org/irchelp/rfc/chapter6.html
33 class Phergie_Event_Response extends Phergie_Event_Abstract
36 * <nickname> No such nick/channel
38 * Used to indicate the nickname parameter supplied to a command is currently
41 const ERR_NOSUCHNICK = '401';
44 * <server name> No such server
46 * Used to indicate the server name given currently doesn't exist.
48 const ERR_NOSUCHSERVER = '402';
51 * <channel name> No such channel
53 * Used to indicate the given channel name is invalid.
55 const ERR_NOSUCHCHANNEL = '403';
58 * <channel name> Cannot send to channel
60 * Sent to a user who is either (a) not on a channel which is mode +n or (b) not
61 * a chanop (or mode +v) on a channel which has mode +m set and is trying to send
62 * a PRIVMSG message to that channel.
64 const ERR_CANNOTSENDTOCHAN = '404';
67 * <channel name> You have joined too many channels
69 * Sent to a user when they have joined the maximum number of allowed channels
70 * and they try to join another channel.
72 const ERR_TOOMANYCHANNELS = '405';
75 * <nickname> There was no such nickname
77 * Returned by WHOWAS to indicate there is no history information for that
80 const ERR_WASNOSUCHNICK = '406';
83 * <target> Duplicate recipients. No message delivered
85 * Returned to a client which is attempting to send PRIVMSG/NOTICE using the
86 * user@host destination format and for a user@host which has several
89 const ERR_TOOMANYTARGETS = '407';
94 * PING or PONG message missing the originator parameter which is required since
95 * these commands must work without valid prefixes.
97 const ERR_NOORIGIN = '409';
100 * No recipient given (<command>)
102 const ERR_NORECIPIENT = '411';
107 const ERR_NOTEXTTOSEND = '412';
110 * <mask> No toplevel domain specified
112 const ERR_NOTOPLEVEL = '413';
115 * <mask> Wildcard in toplevel domain
117 * 412 - 414 are returned by PRIVMSG to indicate that the message wasn't
118 * delivered for some reason. ERR_NOTOPLEVEL and ERR_WILDTOPLEVEL are errors that
119 * are returned when an invalid use of "PRIVMSG $<server>" or "PRIVMSG #<host>"
122 const ERR_WILDTOPLEVEL = '414';
125 * <command> Unknown command
127 * Returned to a registered client to indicate that the command sent is unknown
130 const ERR_UNKNOWNCOMMAND = '421';
133 * MOTD File is missing
135 * Server's MOTD file could not be opened by the server.
137 const ERR_NOMOTD = '422';
140 * <server> No administrative info available
142 * Returned by a server in response to an ADMIN message when there is an error in
143 * finding the appropriate information.
145 const ERR_NOADMININFO = '423';
148 * File error doing <file op> on <file>
150 * Generic error message used to report a failed file operation during the
151 * processing of a message.
153 const ERR_FILEERROR = '424';
158 * Returned when a nickname parameter expected for a command and isn't found.
160 const ERR_NONICKNAMEGIVEN = '431';
163 * <nick> Erroneus nickname
165 * Returned after receiving a NICK message which contains characters which do not
166 * fall in the defined set. See section x.x.x for details on valid nicknames.
168 const ERR_ERRONEUSNICKNAME = '432';
171 * <nick> Nickname is already in use
173 * Returned when a NICK message is processed that results in an attempt to change
174 * to a currently existing nickname.
176 const ERR_NICKNAMEINUSE = '433';
179 * <nick> Nickname collision KILL
181 * Returned by a server to a client when it detects a nickname collision
182 * (registered of a NICK that already exists by another server).
184 const ERR_NICKCOLLISION = '436';
187 * <nick> <channel> They aren't on that channel
189 * Returned by the server to indicate that the target user of the command is not
190 * on the given channel.
192 const ERR_USERNOTINCHANNEL = '441';
195 * <channel> You're not on that channel
197 * Returned by the server whenever a client tries to perform a channel effecting
198 * command for which the client isn't a member.
200 const ERR_NOTONCHANNEL = '442';
203 * <user> <channel> is already on channel
205 * Returned when a client tries to invite a user to a channel they are already
208 const ERR_USERONCHANNEL = '443';
211 * <user> User not logged in
213 * Returned by the summon after a SUMMON command for a user was unable to be
214 * performed since they were not logged in.
216 const ERR_NOLOGIN = '444';
219 * SUMMON has been disabled
221 * Returned as a response to the SUMMON command. Must be returned by any server
222 * which does not implement it.
224 const ERR_SUMMONDISABLED = '445';
227 * USERS has been disabled
229 * Returned as a response to the USERS command. Must be returned by any server
230 * which does not implement it.
232 const ERR_USERSDISABLED = '446';
235 * You have not registered
237 * Returned by the server to indicate that the client must be registered before
238 * the server will allow it to be parsed in detail.
240 const ERR_NOTREGISTERED = '451';
243 * <command> Not enough parameters
245 * Returned by the server by numerous commands to indicate to the client that it
246 * didn't supply enough parameters.
248 const ERR_NEEDMOREPARAMS = '461';
251 * You may not reregister
253 * Returned by the server to any link which tries to change part of the
254 * registered details (such as password or user details from second USER
257 const ERR_ALREADYREGISTRED = '462';
260 * Your host isn't among the privileged
262 * Returned to a client which attempts to register with a server which does not
263 * been setup to allow connections from the host the attempted connection is
266 const ERR_NOPERMFORHOST = '463';
271 * Returned to indicate a failed attempt at registering a connection for which a
272 * password was required and was either not given or incorrect.
274 const ERR_PASSWDMISMATCH = '464';
277 * You are banned from this server
279 * Returned after an attempt to connect and register yourself with a server which
280 * has been setup to explicitly deny connections to you.
282 const ERR_YOUREBANNEDCREEP = '465';
285 * <channel> Channel key already set
287 const ERR_KEYSET = '467';
290 * <channel> Cannot join channel (+l)
292 const ERR_CHANNELISFULL = '471';
295 * <char> is unknown mode char to me
297 const ERR_UNKNOWNMODE = '472';
300 * <channel> Cannot join channel (+i)
302 const ERR_INVITEONLYCHAN = '473';
305 * <channel> Cannot join channel (+b)
307 const ERR_BANNEDFROMCHAN = '474';
310 * <channel> Cannot join channel (+k)
312 const ERR_BADCHANNELKEY = '475';
315 * Permission Denied- You're not an IRC operator
317 * Any command requiring operator privileges to operate must return this error to
318 * indicate the attempt was unsuccessful.
320 const ERR_NOPRIVILEGES = '481';
323 * <channel> You're not channel operator
325 * Any command requiring 'chanop' privileges (such as MODE messages) must return
326 * this error if the client making the attempt is not a chanop on the specified
329 const ERR_CHANOPRIVSNEEDED = '482';
332 * You cant kill a server!
334 * Any attempts to use the KILL command on a server are to be refused and this
335 * error returned directly to the client.
337 const ERR_CANTKILLSERVER = '483';
340 * No O-lines for your host
342 * If a client sends an OPER message and the server has not been configured to
343 * allow connections from the client's host as an operator, this error must be
346 const ERR_NOOPERHOST = '491';
351 * Returned by the server to indicate that a MODE message was sent with a
352 * nickname parameter and that the a mode flag sent was not recognized.
354 const ERR_UMODEUNKNOWNFLAG = '501';
357 * Cant change mode for other users
359 * Error sent to any user trying to view or change the user mode for a user other
362 const ERR_USERSDONTMATCH = '502';
365 * Dummy reply number. Not used.
367 const RPL_NONE = '300';
370 * [<reply>{<space><reply>}]
372 * Reply format used by USERHOST to list replies to the query list. The reply
373 * string is composed as follows <reply> = <nick>['*'] '=' <'+'|'-'><hostname>
374 * The '*' indicates whether the client has registered as an Operator. The '-' or
375 * '+' characters represent whether the client has set an AWAY message or not
378 const RPL_USERHOST = '302';
381 * [<nick> {<space><nick>}]
383 * Reply format used by ISON to list replies to the query list.
385 const RPL_ISON = '303';
388 * <nick> <away message>
390 const RPL_AWAY = '301';
393 * You are no longer marked as being away
395 const RPL_UNAWAY = '305';
398 * You have been marked as being away
400 * These replies are used with the AWAY command (if allowed). RPL_AWAY is sent to
401 * any client sending a PRIVMSG to a client which is away. RPL_AWAY is only sent
402 * by the server to which the client is connected. Replies RPL_UNAWAY and
403 * RPL_NOWAWAY are sent when the client removes and sets an AWAY message.
405 const RPL_NOWAWAY = '306';
408 * <nick> <user> <host> * <real name>
410 const RPL_WHOISUSER = '311';
413 * <nick> <server> <server info>
415 const RPL_WHOISSERVER = '312';
418 * <nick> is an IRC operator
420 const RPL_WHOISOPERATOR = '313';
423 * <nick> <integer> seconds idle
425 const RPL_WHOISIDLE = '317';
428 * <nick> End of /WHOIS list
430 const RPL_ENDOFWHOIS = '318';
433 * <nick> {[@|+]<channel><space>}
435 * Replies 311 - 313, 317 - 319 are all replies generated in response to a WHOIS
436 * message. Given that there are enough parameters present, the answering server
437 * must either formulate a reply out of the above numerics (if the query nick is
438 * found) or return an error reply. The '*' in RPL_WHOISUSER is there as the
439 * literal character and not as a wild card. For each reply set, only
440 * RPL_WHOISCHANNELS may appear more than once (for long lists of channel names).
441 * The '@' and '+' characters next to the channel name indicate whether a client
442 * is a channel operator or has been granted permission to speak on a moderated
443 * channel. The RPL_ENDOFWHOIS reply is used to mark the end of processing a
446 const RPL_WHOISCHANNELS = '319';
449 * <nick> <user> <host> * <real name>
451 const RPL_WHOWASUSER = '314';
454 * <nick> End of WHOWAS
456 * When replying to a WHOWAS message, a server must use the replies
457 * RPL_WHOWASUSER, RPL_WHOISSERVER or ERR_WASNOSUCHNICK for each nickname in the
458 * presented list. At the end of all reply batches, there must be RPL_ENDOFWHOWAS
459 * (even if there was only one reply and it was an error).
461 const RPL_ENDOFWHOWAS = '369';
466 const RPL_LISTSTART = '321';
469 * <channel> <# visible> <topic>
471 const RPL_LIST = '322';
476 * Replies RPL_LISTSTART, RPL_LIST, RPL_LISTEND mark the start, actual replies
477 * with data and end of the server's response to a LIST command. If there are no
478 * channels available to return, only the start and end reply must be sent.
480 const RPL_LISTEND = '323';
483 * <channel> <mode> <mode params>
485 const RPL_CHANNELMODEIS = '324';
488 * <channel> No topic is set
490 const RPL_NOTOPIC = '331';
495 * When sending a TOPIC message to determine the channel topic, one of two
496 * replies is sent. If the topic is set, RPL_TOPIC is sent back else RPL_NOTOPIC.
498 const RPL_TOPIC = '332';
503 * Returned by the server to indicate that the attempted INVITE message was
504 * successful and is being passed onto the end client.
506 const RPL_INVITING = '341';
509 * <user> Summoning user to IRC
511 * Returned by a server answering a SUMMON message to indicate that it is
512 * summoning that user.
514 const RPL_SUMMONING = '342';
517 * <version>.<debuglevel> <server> <comments>
519 * Reply by the server showing its version details. The <version> is the version
520 * of the software being used (including any patchlevel revisions) and the
521 * <debuglevel> is used to indicate if the server is running in "debug mode". The
522 * "comments" field may contain any comments about the version or further version
525 const RPL_VERSION = '351';
528 * <channel> <user> <host> <server> <nick> <H|G>[*][@|+] <hopcount> <real name>
530 const RPL_WHOREPLY = '352';
533 * <name> End of /WHO list
535 * The RPL_WHOREPLY and RPL_ENDOFWHO pair are used to answer a WHO message. The
536 * RPL_WHOREPLY is only sent if there is an appropriate match to the WHO query.
537 * If there is a list of parameters supplied with a WHO message, a RPL_ENDOFWHO
538 * must be sent after processing each list item with <name> being the item.
540 const RPL_ENDOFWHO = '315';
543 * <channel> [[@|+]<nick> [[@|+]<nick> [...]]]
545 const RPL_NAMREPLY = '353';
548 * <channel> End of /NAMES list
550 * To reply to a NAMES message, a reply pair consisting of RPL_NAMREPLY and
551 * RPL_ENDOFNAMES is sent by the server back to the client. If there is no
552 * channel found as in the query, then only RPL_ENDOFNAMES is returned. The
553 * exception to this is when a NAMES message is sent with no parameters and all
554 * visible channels and contents are sent back in a series of RPL_NAMEREPLY
555 * messages with a RPL_ENDOFNAMES to mark the end.
557 const RPL_ENDOFNAMES = '366';
560 * <mask> <server> <hopcount> <server info>
562 const RPL_LINKS = '364';
565 * <mask> End of /LINKS list
567 * In replying to the LINKS message, a server must send replies back using the
568 * RPL_LINKS numeric and mark the end of the list using an RPL_ENDOFLINKS reply.v
570 const RPL_ENDOFLINKS = '365';
575 const RPL_BANLIST = '367';
578 * <channel> End of channel ban list
580 * When listing the active 'bans' for a given channel, a server is required to
581 * send the list back using the RPL_BANLIST and RPL_ENDOFBANLIST messages. A
582 * separate RPL_BANLIST is sent for each active banid. After the banids have been
583 * listed (or if none present) a RPL_ENDOFBANLIST must be sent.
585 const RPL_ENDOFBANLIST = '368';
590 const RPL_INFO = '371';
595 * A server responding to an INFO message is required to send all its 'info' in a
596 * series of RPL_INFO messages with a RPL_ENDOFINFO reply to indicate the end of
599 const RPL_ENDOFINFO = '374';
602 * - <server> Message of the day -
604 const RPL_MOTDSTART = '375';
609 const RPL_MOTD = '372';
612 * End of /MOTD command
614 * When responding to the MOTD message and the MOTD file is found, the file is
615 * displayed line by line, with each line no longer than 80 characters, using
616 * RPL_MOTD format replies. These should be surrounded by a RPL_MOTDSTART (before
617 * the RPL_MOTDs) and an RPL_ENDOFMOTD (after).
619 const RPL_ENDOFMOTD = '376';
622 * You are now an IRC operator
624 * RPL_YOUREOPER is sent back to a client which has just successfully issued an
625 * OPER message and gained operator status.
627 const RPL_YOUREOPER = '381';
630 * <config file> Rehashing
632 * If the REHASH option is used and an operator sends a REHASH message, an
633 * RPL_REHASHING is sent back to the operator.
635 const RPL_REHASHING = '382';
638 * <server> <string showing server's local time>
640 * When replying to the TIME message, a server must send the reply using the
641 * RPL_TIME format above. The string showing the time need only contain the
642 * correct day and time there. There is no further requirement for the time
645 const RPL_TIME = '391';
648 * UserID Terminal Host
650 const RPL_USERSSTART = '392';
655 const RPL_USERS = '393';
660 const RPL_ENDOFUSERS = '394';
665 * If the USERS message is handled by a server, the replies RPL_USERSTART,
666 * RPL_USERS, RPL_ENDOFUSERS and RPL_NOUSERS are used. RPL_USERSSTART must be
667 * sent first, following by either a sequence of RPL_USERS or a single
668 * RPL_NOUSER. Following this is RPL_ENDOFUSERS.
670 const RPL_NOUSERS = '395';
673 * Link <version & debug level> <destination> <next server>
675 const RPL_TRACELINK = '200';
678 * Try. <class> <server>
680 const RPL_TRACECONNECTING = '201';
683 * H.S. <class> <server>
685 const RPL_TRACEHANDSHAKE = '202';
688 * ???? <class> [<client IP address in dot form>]
690 const RPL_TRACEUNKNOWN = '203';
693 * Oper <class> <nick>
695 const RPL_TRACEOPERATOR = '204';
698 * User <class> <nick>
700 const RPL_TRACEUSER = '205';
703 * Serv <class> <int>S <int>C <server> <nick!user|*!*>@<host|server>
705 const RPL_TRACESERVER = '206';
708 * <newtype> 0 <client name>
710 const RPL_TRACENEWTYPE = '208';
713 * File <logfile> <debug level>
715 * The RPL_TRACE* are all returned by the server in response to the TRACE
716 * message. How many are returned is dependent on the the TRACE message and
717 * whether it was sent by an operator or not. There is no predefined order for
718 * which occurs first. Replies RPL_TRACEUNKNOWN, RPL_TRACECONNECTING and
719 * RPL_TRACEHANDSHAKE are all used for connections which have not been fully
720 * established and are either unknown, still attempting to connect or in the
721 * process of completing the 'server handshake'. RPL_TRACELINK is sent by any
722 * server which handles a TRACE message and has to pass it on to another server.
723 * The list of RPL_TRACELINKs sent in response to a TRACE command traversing the
724 * IRC network should reflect the actual connectivity of the servers themselves
725 * along that path. RPL_TRACENEWTYPE is to be used for any connection which does
726 * not fit in the other categories but is being displayed anyway.
728 const RPL_TRACELOG = '261';
731 * <linkname> <sendq> <sent messages> <sent bytes> <received messages> <received
734 const RPL_STATSLINKINFO = '211';
739 const RPL_STATSCOMMANDS = '212';
742 * C <host> * <name> <port> <class>
744 const RPL_STATSCLINE = '213';
747 * N <host> * <name> <port> <class>
749 const RPL_STATSNLINE = '214';
752 * I <host> * <host> <port> <class>
754 const RPL_STATSILINE = '215';
757 * K <host> * <username> <port> <class>
759 const RPL_STATSKLINE = '216';
762 * Y <class> <ping frequency> <connect frequency> <max sendq>
764 const RPL_STATSYLINE = '218';
767 * <stats letter> End of /STATS report
769 const RPL_ENDOFSTATS = '219';
772 * L <hostmask> * <servername> <maxdepth>
774 const RPL_STATSLLINE = '241';
777 * Server Up %d days %d%02d%02d
779 const RPL_STATSUPTIME = '242';
782 * O <hostmask> * <name>
784 const RPL_STATSOLINE = '243';
787 * H <hostmask> * <servername>
789 const RPL_STATSHLINE = '244';
794 * To answer a query about a client's own mode, RPL_UMODEIS is sent back.
796 const RPL_UMODEIS = '221';
799 * There are <integer> users and <integer> invisible on <integer> servers
801 const RPL_LUSERCLIENT = '251';
804 * <integer> operator(s) online
806 const RPL_LUSEROP = '252';
809 * <integer> unknown connection(s)
811 const RPL_LUSERUNKNOWN = '253';
814 * <integer> channels formed
816 const RPL_LUSERCHANNELS = '254';
819 * I have <integer> clients and <integer> servers
821 * In processing an LUSERS message, the server sends a set of replies from
822 * RPL_LUSERCLIENT, RPL_LUSEROP, RPL_USERUNKNOWN, RPL_LUSERCHANNELS and
823 * RPL_LUSERME. When replying, a server must send back RPL_LUSERCLIENT and
824 * RPL_LUSERME. The other replies are only sent back if a non-zero count is found
827 const RPL_LUSERME = '255';
830 * <server> Administrative info
832 const RPL_ADMINME = '256';
837 const RPL_ADMINLOC1 = '257';
842 const RPL_ADMINLOC2 = '258';
847 * When replying to an ADMIN message, a server is expected to use replies
848 * RLP_ADMINME through to RPL_ADMINEMAIL and provide a text message with each.
849 * For RPL_ADMINLOC1 a description of what city, state and country the server is
850 * in is expected, followed by details of the university and department
851 * (RPL_ADMINLOC2) and finally the administrative contact for the server (an
852 * email address here is required) in RPL_ADMINEMAIL.
854 const RPL_ADMINEMAIL = '259';
857 * Reply code sent by the server, which can be compared to the ERR_* and
865 * Reply code description sent by the server.
869 protected $description;
872 * Raw data sent by the server
883 protected $type = 'response';
886 * Sets the reply code sent by the server.
888 * @param string $code Reply code
890 * @return Phergie_Event_Response Provides a fluent interface
892 public function setCode($code)
899 * Returns the reply code sent by the server.
903 public function getCode()
909 * Sets the reply code description sent by the server.
911 * @param string $description Reply code description
913 * @return Phergie_Event_Response Provides a fluent interface
915 public function setDescription($description)
917 $this->description = $description;
922 * Returns the reply code description sent by the server.
926 public function getDescription()
928 return $this->description;
932 * Sets the raw buffer for the given event
934 * @param string $buffer Raw event buffer
936 * @return Phergie_Event_Response Provides a fluent interface
938 public function setRawData($buffer)
940 $this->rawData = $buffer;
945 * Returns the raw buffer that was sent from the server for that event
949 public function getRawData()
951 return $this->rawData;