Class: IRC::Messages::NoticeMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/irc/messages/notice_message.rb

Overview

4.4.2 Notice

Command: NOTICE Parameters: <nickname> <text>

The NOTICE message is used similarly to PRIVMSG. The difference between NOTICE and PRIVMSG is that automatic replies must never be sent in response to a NOTICE message. This rule applies to servers too - they must not send any error reply back to the client on receipt of a notice. The object of this rule is to avoid loops between a client automatically sending something in response to something it received. This is typically used by automatons (clients with either an AI or other interactive program controlling their actions) which are always seen to be replying lest they end up in a loop with another automaton.

See PRIVMSG for more details on replies and examples.

Constant Summary collapse

CODE =
"NOTICE"

Constants inherited from Message

Message::MESSAGE_FORMAT

Constants included from Codes

Codes::ERR_ALREADYREGISTRED, Codes::ERR_BADCHANMASK, Codes::ERR_BADCHANNAME, Codes::ERR_BADCHANNELKEY, Codes::ERR_BANNEDFROMCHAN, Codes::ERR_CANNOTSENDTOCHAN, Codes::ERR_CANTKILLSERVER, Codes::ERR_CHANNELISFULL, Codes::ERR_CHANOPRIVSNEEDED, Codes::ERR_ERRONEUSNICKNAME, Codes::ERR_FILEERROR, Codes::ERR_INVALIDUSERNAME, Codes::ERR_INVITEONLYCHAN, Codes::ERR_KEYSET, Codes::ERR_LINKCHANNEL, Codes::ERR_NEEDMOREPARAMS, Codes::ERR_NICKCOLLISION, Codes::ERR_NICKNAMEINUSE, Codes::ERR_NOADMININFO, Codes::ERR_NOLOGIN, Codes::ERR_NOMOTD, Codes::ERR_NONICKNAMEGIVEN, Codes::ERR_NOOPERHOST, Codes::ERR_NOORIGIN, Codes::ERR_NOPERMFORHOST, Codes::ERR_NOPRIVILEGES, Codes::ERR_NORECIPIENT, Codes::ERR_NOSERVICEHOST, Codes::ERR_NOSUCHCHANNEL, Codes::ERR_NOSUCHNICK, Codes::ERR_NOSUCHSERVER, Codes::ERR_NOTEXTTOSEND, Codes::ERR_NOTONCHANNEL, Codes::ERR_NOTOPLEVEL, Codes::ERR_NOTREGISTERED, Codes::ERR_PASSWDMISMATCH, Codes::ERR_SECUREONLYCHAN, Codes::ERR_SUMMONDISABLED, Codes::ERR_TARGETTOOFAST, Codes::ERR_TOOMANYCHANNELS, Codes::ERR_TOOMANYTARGETS, Codes::ERR_UMODEUNKNOWNFLAG, Codes::ERR_UNKNOWNCOMMAND, Codes::ERR_UNKNOWNMODE, Codes::ERR_USERNOTINCHANNEL, Codes::ERR_USERONCHANNEL, Codes::ERR_USERSDISABLED, Codes::ERR_USERSDONTMATCH, Codes::ERR_WASNOSUCHNICK, Codes::ERR_WILDTOPLEVEL, Codes::ERR_YOUREBANNEDCREEP, Codes::ERR_YOUWILLBEBANNED, Codes::RPL_ADMINEMAIL, Codes::RPL_ADMINLOC1, Codes::RPL_ADMINLOC2, Codes::RPL_ADMINME, Codes::RPL_AWAY, Codes::RPL_BANLIST, Codes::RPL_BOUNCE, Codes::RPL_CHANNELMODEIS, Codes::RPL_CLOSEEND, Codes::RPL_CLOSING, Codes::RPL_CREATED, Codes::RPL_ENDOFBANLIST, Codes::RPL_ENDOFINFO, Codes::RPL_ENDOFLINKS, Codes::RPL_ENDOFMOTD, Codes::RPL_ENDOFNAMES, Codes::RPL_ENDOFSERVICES, Codes::RPL_ENDOFSTATS, Codes::RPL_ENDOFUSERS, Codes::RPL_ENDOFWHO, Codes::RPL_ENDOFWHOIS, Codes::RPL_ENDOFWHOWAS, Codes::RPL_INFO, Codes::RPL_INFOSTART, Codes::RPL_INVITING, Codes::RPL_ISON, Codes::RPL_ISUPPORT, Codes::RPL_KILLDONE, Codes::RPL_LINKS, Codes::RPL_LIST, Codes::RPL_LISTEND, Codes::RPL_LISTSTART, Codes::RPL_LUSERCHANNELS, Codes::RPL_LUSERCLIENT, Codes::RPL_LUSERME, Codes::RPL_LUSEROP, Codes::RPL_LUSERUNKNOWN, Codes::RPL_MOTD, Codes::RPL_MOTDSTART, Codes::RPL_MYINFO, Codes::RPL_MYPORTIS, Codes::RPL_NAMREPLY, Codes::RPL_NONE, Codes::RPL_NOTOPIC, Codes::RPL_NOUSERS, Codes::RPL_NOWAWAY, Codes::RPL_REHASHING, Codes::RPL_SERVICE, Codes::RPL_SERVICEINFO, Codes::RPL_SERVLIST, Codes::RPL_SERVLISTEND, Codes::RPL_STATSCLINE, Codes::RPL_STATSCOMMANDS, Codes::RPL_STATSHLINE, Codes::RPL_STATSILINE, Codes::RPL_STATSKLINE, Codes::RPL_STATSLINKINFO, Codes::RPL_STATSLLINE, Codes::RPL_STATSNLINE, Codes::RPL_STATSOLINE, Codes::RPL_STATSQLINE, Codes::RPL_STATSUPTIME, Codes::RPL_STATSYLINE, Codes::RPL_SUMMONING, Codes::RPL_TIME, Codes::RPL_TOPIC, Codes::RPL_TOPICINFO, Codes::RPL_TRACECLASS, Codes::RPL_TRACECONNECTING, Codes::RPL_TRACEHANDSHAKE, Codes::RPL_TRACELINK, Codes::RPL_TRACELOG, Codes::RPL_TRACENEWTYPE, Codes::RPL_TRACEOPERATOR, Codes::RPL_TRACESERVER, Codes::RPL_TRACEUNKNOWN, Codes::RPL_TRACEUSER, Codes::RPL_UMODEIS, Codes::RPL_UNAWAY, Codes::RPL_USERHOST, Codes::RPL_USERS, Codes::RPL_USERSSTART, Codes::RPL_VERSION, Codes::RPL_WELCOME, Codes::RPL_WHOISCHANNELS, Codes::RPL_WHOISCHANOP, Codes::RPL_WHOISIDLE, Codes::RPL_WHOISOPERATOR, Codes::RPL_WHOISSERVER, Codes::RPL_WHOISUSER, Codes::RPL_WHOREPLY, Codes::RPL_WHOWASUSER, Codes::RPL_YOUREOPER, Codes::RPL_YOURHOST

Instance Attribute Summary collapse

Attributes inherited from Message

#code, #host, #login, #nick, #raw_message, #server

Instance Method Summary collapse

Methods inherited from Message

#==, #eql?, #initialize, is_valid?, #to_s

Constructor Details

This class inherits a constructor from IRC::Messages::Message

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



52
53
54
# File 'lib/irc/messages/notice_message.rb', line 52

def message
  @message
end

Instance Method Details

#handle(context) ⇒ Object

Notify all connection listeners, that a notice message was received.



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/irc/messages/notice_message.rb', line 55

def handle(context)
  
  # Notify all connection listeners by calling their on_server_response method.
  super(context)
  
  # Notify all connection listeners by calling their on_notice method.
  notify(context) do |connection_listener| 
    connection_listener.on_notice(context, context.lookup_user(nick), message)
  end

end