public class Session
extends java.lang.Object
changeNick(String)
, setRejoinOnKick(boolean)
, getUserModes()
etc.
Session is where Tasks and Listeners should be added to be notified of IRCEvents coming from the connected server.
You can override the default parsing and internal event handling
of a Session with setInternalEventHandler(IRCEventListener)
and
setInternalParser(InternalEventParser)
.
New Session instances are obtained by requesting a connection with the ConnectionManager
Modifier and Type | Class and Description |
---|---|
static class |
Session.State |
Modifier and Type | Method and Description |
---|---|
void |
action(java.lang.String target,
java.lang.String actionText)
Send ctcp action
|
void |
addIRCEventListener(IRCEventListener listener)
Adds an IRCEventListener to the Session.
|
void |
changeNick(java.lang.String newNick)
Send nick change request
|
void |
chanList()
Get a List of Channels from server.
|
void |
chanList(java.lang.String channel)
Get information on a secific channel
|
void |
close(java.lang.String quitMessage)
Disconnect from server and destroy Session
|
void |
ctcp(java.lang.String target,
java.lang.String request)
Send a ctcp request
|
boolean |
equals(java.lang.Object o) |
Channel |
getChannel(java.lang.String channelName)
Gets a Channel by name
|
java.util.List<Channel> |
getChannels()
Get a List of Channels Session is currently in
|
java.lang.String |
getConnectedHostName()
Returns host name this Session is connected to.
|
IRCEventListener |
getInternalEventHandler()
Returns the internal event handler this Session is using
|
InternalEventParser |
getInternalEventParser()
Gets the InternalEventParser this Session uses for event parsing
|
java.util.Collection<IRCEventListener> |
getIRCEventListeners()
Get a collection of all IRCEventListeners attached to Session
|
java.lang.String |
getNick()
Nick used for Session
|
RequestedConnection |
getRequestedConnection()
Get RequestedConnection for Session
|
int |
getRetries() |
ServerInformation |
getServerInformation()
Get ServerInformation for Session
|
void |
getServerVersion()
Send server version query
|
void |
getServerVersion(java.lang.String hostPattern)
Send server version query for specific hostmask pattern
|
boolean |
getShouldUseAltNicks()
Returns if Session should try alternate nicks
on connection if a nick in use event is received.
|
Session.State |
getState()
Get the State of the Session
|
java.util.List<ModeAdjustment> |
getUserModes()
returns a List of UserModes for this Session
|
int |
hashCode() |
void |
invite(java.lang.String nick,
Channel chan)
Invite a user to a channel
|
boolean |
isAway()
Is this Session marked away?
|
boolean |
isChannelToken(java.lang.String token)
Test if a String starts with a known channel prefix
|
boolean |
isConnected()
Is this Session currently connected to an IRC server?
|
boolean |
isLoggedIn()
Returns true if the Session has an active Connection and
has successfully logged on to the Connection.
|
boolean |
isRejoinOnKick()
Should this Session rejoin channels it is Kicked from?
Default is true.
|
void |
join(java.lang.String channel)
Join a Channel
|
void |
join(java.lang.String channel,
java.lang.String pass)
Join a password protected Channel
|
void |
mode(java.lang.String target,
java.lang.String mode)
Set a mode
|
void |
notice(java.lang.String target,
java.lang.String msg)
Send a notice
|
void |
onEvent(Task task)
Add a task to be ran when any IRCEvent is received
|
void |
onEvent(Task task,
IRCEvent.Type... types)
Add a task to be ran when any of the given Types
of IRCEvents are received
|
boolean |
removeIRCEventListener(IRCEventListener listener)
Remove IRCEventListner from Session
|
java.util.List<Channel> |
removeNickFromAllChannels(java.lang.String nick)
Removes a nick from all channels
|
void |
removeTask(Task t)
Removes a Task from the Session.
|
void |
sayChannel(Channel channel,
java.lang.String msg)
Speak in a Channel
|
void |
sayChannel(java.lang.String msg,
Channel channel)
Speak in a channel
|
void |
sayPrivate(java.lang.String nick,
java.lang.String msg)
Send a private message
|
void |
sayRaw(java.lang.String data)
Send raw text to server
|
void |
setAway(java.lang.String message)
Set self away
|
void |
setInternalEventHandler(IRCEventListener handler)
Sets the internal event handler this Session should use
|
void |
setInternalParser(InternalEventParser parser)
Sets the InternalEventParser this Session should use for
event parsing
|
void |
setRejoinOnKick(boolean rejoin)
Sets that this Sessions should or should not rejoin Channels
kiced from
|
void |
setShouldUseAltNicks(boolean use)
Set Session to try alternate nicks
on connection if a nick inuse event is received , or not.
|
void |
unsetAway()
Unset away
|
void |
unSetAway()
Unset away
|
void |
who(java.lang.String who)
Send Who request
|
void |
whois(java.lang.String nick)
Send a whois query
|
void |
whoWas(java.lang.String nick)
Send WhoWas query
|
public InternalEventParser getInternalEventParser()
InternalEventParser
,
DefaultInternalEventParser
,
CommandParser
public void setInternalParser(InternalEventParser parser)
parser
- InternalEventParser
,
DefaultInternalEventParser
,
CommandParser
public void setInternalEventHandler(IRCEventListener handler)
handler
- IRCEventListener
,
DefaultInternalEventHandler
public IRCEventListener getInternalEventHandler()
IRCEventListener
,
DefaultInternalEventHandler
public java.util.List<ModeAdjustment> getUserModes()
public void sayChannel(Channel channel, java.lang.String msg)
channel
- msg
- Channel.say(String)
public boolean isConnected()
public boolean isRejoinOnKick()
public void setRejoinOnKick(boolean rejoin)
rejoin
- public boolean isLoggedIn()
public void setShouldUseAltNicks(boolean use)
use
- public boolean getShouldUseAltNicks()
public void close(java.lang.String quitMessage)
quitMessage
- public java.lang.String getNick()
public void changeNick(java.lang.String newNick)
public boolean isAway()
public void setAway(java.lang.String message)
public void unsetAway()
public ServerInformation getServerInformation()
ServerInformation
public RequestedConnection getRequestedConnection()
RequestedConnection
public java.lang.String getConnectedHostName()
getRequestedConnection()
,
RequestedConnection.getHostName()
public void addIRCEventListener(IRCEventListener listener)
listener
- public boolean removeIRCEventListener(IRCEventListener listener)
listener
- public java.util.Collection<IRCEventListener> getIRCEventListeners()
public void onEvent(Task task)
public void onEvent(Task task, IRCEvent.Type... types)
public void removeTask(Task t)
t
- public java.util.List<Channel> getChannels()
Channel
public Channel getChannel(java.lang.String channelName)
channelName
- public java.util.List<Channel> removeNickFromAllChannels(java.lang.String nick)
nick
- public Session.State getState()
Session.State
public int getRetries()
public boolean isChannelToken(java.lang.String token)
token
- public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void who(java.lang.String who)
who
- public void whois(java.lang.String nick)
nick
- - target of whoispublic void whoWas(java.lang.String nick)
nick
- public void invite(java.lang.String nick, Channel chan)
nick
- chan
- public void chanList()
public void chanList(java.lang.String channel)
channel
- public void join(java.lang.String channel)
channel
- public void join(java.lang.String channel, java.lang.String pass)
channel
- pass
- public void ctcp(java.lang.String target, java.lang.String request)
target
- request
- public void notice(java.lang.String target, java.lang.String msg)
target
- msg
- public void unSetAway()
public void getServerVersion()
public void getServerVersion(java.lang.String hostPattern)
hostPattern
- public void mode(java.lang.String target, java.lang.String mode)
target
- mode
- public void action(java.lang.String target, java.lang.String actionText)
target
- actionText
- public void sayChannel(java.lang.String msg, Channel channel)
msg
- channel
- Channel.say(String)
public void sayPrivate(java.lang.String nick, java.lang.String msg)
nick
- msg
- public void sayRaw(java.lang.String data)
data
-