f00f.net.irc.martyr.commands
Class CtcpNotice

java.lang.Object
  extended by f00f.net.irc.martyr.commands.AbstractInCommand
      extended by f00f.net.irc.martyr.commands.AbstractCommand
          extended by f00f.net.irc.martyr.commands.NoticeCommand
              extended by f00f.net.irc.martyr.commands.CtcpNotice
All Implemented Interfaces:
Command, InCommand, OutCommand

public class CtcpNotice
extends NoticeCommand

This facilitates the sending and receiving of CTCP messages. Upon receiving a message, MessageCommand checks to see if it is a CTCP, and if it is, it instantiates this class instead of a MessageCommand. You can then use the getAction() and getMessage() methods to retreive the action and payload, respectively.

See Also:
NoticeCommand

Field Summary
 
Fields inherited from class f00f.net.irc.martyr.commands.AbstractInCommand
attributes
 
Constructor Summary
protected CtcpNotice(FullNick from, java.lang.String dest, java.lang.String message)
          This is only to be called by MessageCommand, as a way of receiving a Ctcp message.
  CtcpNotice(java.lang.String dest, java.lang.String message)
          Use this to send a CTCP message.
  CtcpNotice(java.lang.String dest, java.lang.String action, java.lang.String message)
           
 
Method Summary
 java.lang.String getAction()
          Returns the action of this CTCP.
static java.lang.String getActionStr(java.lang.String msg)
          Given a stripped CTCP message, returns the ctcp action string.
static java.lang.String getMessageStr(java.lang.String msg)
           
static boolean isCtcpString(java.lang.String msg)
          If the string is wrapped with CTCP signal chars (\001) returns true.
static java.lang.String stripCtcpWrapper(java.lang.String msg)
          Strips a CTCP wrapper, if there is one.
 
Methods inherited from class f00f.net.irc.martyr.commands.NoticeCommand
getDest, getFrom, getIrcIdentifier, getNotice, getState, isPrivateToUs, parse, renderParams
 
Methods inherited from class f00f.net.irc.martyr.commands.AbstractCommand
render
 
Methods inherited from class f00f.net.irc.martyr.commands.AbstractInCommand
getAttribute, getAttributeKeys, getIntParameter, getParameter, getSourceString, selfRegister, setAttribute, setSourceString, updateClientState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CtcpNotice

public CtcpNotice(java.lang.String dest,
                  java.lang.String message)
Use this to send a CTCP message. This simply wraps the string with the CTCP tags, \001.

Parameters:
dest - Target of CTCP message
message - Actual CTCP message

CtcpNotice

public CtcpNotice(java.lang.String dest,
                  java.lang.String action,
                  java.lang.String message)

CtcpNotice

protected CtcpNotice(FullNick from,
                     java.lang.String dest,
                     java.lang.String message)
This is only to be called by MessageCommand, as a way of receiving a Ctcp message. It strips the \001's off and holds the message left over.

Parameters:
from - Nick that sent the message
dest - Target of the CTCP message
message - Actual CTCP message
Method Detail

getAction

public java.lang.String getAction()
Returns the action of this CTCP. Use getMessage() to retreive the payload of the action.

Returns:
The action specified by the CTCP message

getActionStr

public static java.lang.String getActionStr(java.lang.String msg)
Given a stripped CTCP message, returns the ctcp action string.

Parameters:
msg - Message to be parsed into an action
Returns:
Action string from message

getMessageStr

public static java.lang.String getMessageStr(java.lang.String msg)

isCtcpString

public static boolean isCtcpString(java.lang.String msg)
If the string is wrapped with CTCP signal chars (\001) returns true.

Parameters:
msg - String to check whether it's a CTCP message or not
Returns:
True or false if it's a CTCP message

stripCtcpWrapper

public static java.lang.String stripCtcpWrapper(java.lang.String msg)
Strips a CTCP wrapper, if there is one.

Parameters:
msg - String to be stripped
Returns:
Stripped string


Copyright © 2000-2007 Ben Damm, Daniel Henninger, et al.