f00f.net.irc.martyr.commands
Class CtcpMessage

java.lang.Object
  |
  +--f00f.net.irc.martyr.commands.GenericInCommand
        |
        +--f00f.net.irc.martyr.commands.GenericCommand
              |
              +--f00f.net.irc.martyr.commands.MessageCommand
                    |
                    +--f00f.net.irc.martyr.commands.CtcpMessage
All Implemented Interfaces:
Command, InCommand, OutCommand
Direct Known Subclasses:
ActionCtcp

public class CtcpMessage
extends MessageCommand

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:
MessageCommand

Fields inherited from class f00f.net.irc.martyr.commands.GenericInCommand
attributes
 
Constructor Summary
protected CtcpMessage(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.
  CtcpMessage(java.lang.String dest, java.lang.String message)
          Use this to send a CTCP message.
  CtcpMessage(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.MessageCommand
getDest, getIrcIdentifier, getMessage, getSource, isPrivateToUs, parse, renderParams
 
Methods inherited from class f00f.net.irc.martyr.commands.GenericCommand
render
 
Methods inherited from class f00f.net.irc.martyr.commands.GenericInCommand
getAttribute, getAttributeKeys, getIntParameter, getParameter, getSourceString, getState, selfRegister, setAttribute, setSourceString, updateClientState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CtcpMessage

public CtcpMessage(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.

CtcpMessage

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

CtcpMessage

protected CtcpMessage(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.
Method Detail

getAction

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

getActionStr

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

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.

stripCtcpWrapper

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


Copyright © 2000,2001,2002,2003 f00f networks.