com.leafdigital.irc.api
Class UserCommandListMsg

java.lang.Object
  extended by leafchat.core.api.Msg
      extended by com.leafdigital.irc.api.UserCommandListMsg

public class UserCommandListMsg
extends Msg

Message sent to get a list of available / commands.


Field Summary
static int FREQ_COMMON
          Command is frequently typed by ordinary users.
static int FREQ_OBSCURE
          Command is used only by IRC operators, is normally handled internally by clients, or is normally used only when scripting.
static int FREQ_UNCOMMON
          Command may be typed by ordinary users, but is used less frequently.
 
Fields inherited from class leafchat.core.api.Msg
PRIORITY_AFTERNORMAL, PRIORITY_BEFORENORMAL, PRIORITY_EARLY, PRIORITY_FIRST, PRIORITY_LAST, PRIORITY_LATE, PRIORITY_NORMAL
 
Constructor Summary
UserCommandListMsg()
          Used to retrieve all commands, regardless of whether currently connected to a server or not.
UserCommandListMsg(Server server)
          Used to retrieve commands that are appropriate for current server.
 
Method Summary
 void addCommand(boolean onServer, java.lang.String command, int freq, java.lang.String example, java.lang.String explanation)
          Adds a supported command to the list.
 java.lang.String[] getCommands()
          For use by whoever despatched the message, after its despatch.
 java.lang.String getDescription(java.lang.String command)
          For user by whoever despatched the message, after its despatch.
 Server getServer()
           
 
Methods inherited from class leafchat.core.api.Msg
isHandled, isStopped, markHandled, markStopped, sequenceBefore, setSequence, setSequence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FREQ_COMMON

public static final int FREQ_COMMON
Command is frequently typed by ordinary users.

See Also:
Constant Field Values

FREQ_UNCOMMON

public static final int FREQ_UNCOMMON
Command may be typed by ordinary users, but is used less frequently.

See Also:
Constant Field Values

FREQ_OBSCURE

public static final int FREQ_OBSCURE
Command is used only by IRC operators, is normally handled internally by clients, or is normally used only when scripting.

See Also:
Constant Field Values
Constructor Detail

UserCommandListMsg

public UserCommandListMsg(Server server)
Used to retrieve commands that are appropriate for current server.

Parameters:
server - Server for command (null if none)

UserCommandListMsg

public UserCommandListMsg()
Used to retrieve all commands, regardless of whether currently connected to a server or not.

Method Detail

getServer

public Server getServer()
Returns:
Server that command should run on (null if none)

getCommands

public java.lang.String[] getCommands()
For use by whoever despatched the message, after its despatch. Returns all the commands that were added (as strings without leading /, in common-first order).

Returns:
All the commands

getDescription

public java.lang.String getDescription(java.lang.String command)
For user by whoever despatched the message, after its despatch. Returns the description of a given command, or null if it isn't known. The description is in XML format ready for output.

Parameters:
command - Command (must be lower-case with no slash)
Returns:
Description or null if none

addCommand

public void addCommand(boolean onServer,
                       java.lang.String command,
                       int freq,
                       java.lang.String example,
                       java.lang.String explanation)
Adds a supported command to the list. The frequency value relates to the chance of an ordinary user typing this command.

Parameters:
onServer - True if command only applies when connected to a server
command - Command (not including /)
freq - Frequency (FREQ_xx constant)
example - Example command (plain text)
explanation - Explanation of what the example command does (XML)


Copyright © 2011 Samuel Marshall. All rights reserved.