leafchat.core.api
Class Msg

java.lang.Object
  extended by leafchat.core.api.Msg
Direct Known Subclasses:
ErrorMsg, IgnoreListChangeMsg, IRCActionListMsg, IRCMsg, MinuteMsg, NotificationListMsg, PluginUnloadMsg, PreferencesChangeMsg, ServerMsg, SystemStateMsg, UserCommandListMsg, UserCommandMsg, WatchListChangeMsg, WatchMsg

public abstract class Msg
extends java.lang.Object

Generic object representing communication between plugins. All messages must extend this class.

In addition to the visible API below, user-defined message types may include a public static MessageInfo member called 'info'. This provides information for the scripting system. For example, if a message type isn't appropriate for use as a scripting event, override the MessageInfo to return false to MessageInfo.allowScripting(). Here's a code example.

public static MessageInfo info=new MessageInfo(ErrorIRCMsg.class,"Error",
        "The server sends this event when you quit or are otherwise disconnected.")
{
        protected void listScriptingVariables(Variables v)
        {
                super.listScriptingVariables(v);
                v.add("message");
        }
};


Field Summary
static int PRIORITY_AFTERNORMAL
          Priority constant: Where message should be handled after normal handlers
static int PRIORITY_BEFORENORMAL
          Priority constant: Where message should be handled before normal handlers
static int PRIORITY_EARLY
          Priority constant: Use where message should be handled before most other handlers
static int PRIORITY_FIRST
          Priority constant: Use where message should be handled first
static int PRIORITY_LAST
          Priority constant: Use where message should be handled last
static int PRIORITY_LATE
          Priority constant: Use where message should be handled after most handlers, but not necessarily last
static int PRIORITY_NORMAL
          Priority constant: Use for default message handling or where order does not matter
 
Constructor Summary
Msg()
           
 
Method Summary
 boolean isHandled()
           
 boolean isStopped()
           
 void markHandled()
          Call to mark handled; still processed, but marked as already shown to user
 void markStopped()
          Call to stop further processing
 boolean sequenceBefore(Msg consider)
          Checks whether this message ought to run before the message under consideration.
 void setSequence(Msg relative)
          Indicates that this message should belong to the same sequence as some other message (i.e. this one is presumably being dispatched in response to that one).
 void setSequence(java.lang.String sequenceName, int sequenceNumber)
          Associate this message with a particular sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIORITY_LAST

public static final int PRIORITY_LAST
Priority constant: Use where message should be handled last

See Also:
Constant Field Values

PRIORITY_LATE

public static final int PRIORITY_LATE
Priority constant: Use where message should be handled after most handlers, but not necessarily last

See Also:
Constant Field Values

PRIORITY_AFTERNORMAL

public static final int PRIORITY_AFTERNORMAL
Priority constant: Where message should be handled after normal handlers

See Also:
Constant Field Values

PRIORITY_NORMAL

public static final int PRIORITY_NORMAL
Priority constant: Use for default message handling or where order does not matter

See Also:
Constant Field Values

PRIORITY_BEFORENORMAL

public static final int PRIORITY_BEFORENORMAL
Priority constant: Where message should be handled before normal handlers

See Also:
Constant Field Values

PRIORITY_EARLY

public static final int PRIORITY_EARLY
Priority constant: Use where message should be handled before most other handlers

See Also:
Constant Field Values

PRIORITY_FIRST

public static final int PRIORITY_FIRST
Priority constant: Use where message should be handled first

See Also:
Constant Field Values
Constructor Detail

Msg

public Msg()
Method Detail

isStopped

public boolean isStopped()
Returns:
True if message processing has been stopped

markStopped

public void markStopped()
Call to stop further processing


isHandled

public boolean isHandled()
Returns:
True if message has already been 'handled' (usually 'displayed to user')

markHandled

public void markHandled()
Call to mark handled; still processed, but marked as already shown to user


setSequence

public void setSequence(java.lang.String sequenceName,
                        int sequenceNumber)
Associate this message with a particular sequence. There can be any number of sequences, each with an arbitrary name. A message with number N in a sequence S will only be dispatched once there are no messages with number M
Parameters:
sequenceName - Arbitrary sequence name
sequenceNumber - Position in sequence

setSequence

public void setSequence(Msg relative)
Indicates that this message should belong to the same sequence as some other message (i.e. this one is presumably being dispatched in response to that one).

Parameters:
relative - Message whose sequence details will be copied.

sequenceBefore

public boolean sequenceBefore(Msg consider)
Checks whether this message ought to run before the message under consideration.

Parameters:
consider - Message being considered
Returns:
True if this message should run earlier than the considered one


Copyright © 2011 Samuel Marshall. All rights reserved.