|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjerklib.Session
public class Session
Session contains methods to manage an IRC connection.
Like 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
ConnectionManager.requestConnection(String)
,
ConnectionManager.requestConnection(String, int)
,
ConnectionManager.requestConnection(String, int, Profile)
Nested Class Summary | |
---|---|
static class |
Session.State
|
Method Summary | |
---|---|
void |
action(String target,
String actionText)
Send ctcp action |
void |
addIRCEventListener(IRCEventListener listener)
Adds an IRCEventListener to the Session. |
void |
changeNick(String newNick)
Send nick change request |
void |
chanList()
Get a List of Channels from server. |
void |
chanList(String channel)
Get information on a secific channel |
void |
close(String quitMessage)
Disconnect from server and destroy Session |
void |
ctcp(String target,
String request)
Send a ctcp request |
boolean |
equals(Object o)
|
Channel |
getChannel(String channelName)
Gets a Channel by name |
List<Channel> |
getChannels()
Get a List of Channels Session is currently in |
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 |
Collection<IRCEventListener> |
getIRCEventListeners()
Get a collection of all IRCEventListeners attached to Session |
String |
getNick()
Nick used for Session |
RequestedConnection |
getRequestedConnection()
Get RequestedConnection for Session |
ServerInformation |
getServerInformation()
Get ServerInformation for Session |
void |
getServerVersion()
Send server version query |
void |
getServerVersion(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. |
List<ModeAdjustment> |
getUserModes()
returns a List of UserModes for this Session |
int |
hashCode()
|
void |
invite(String nick,
Channel chan)
Invite a user to a channel |
boolean |
isAway()
Is this Session marked away? |
boolean |
isChannelToken(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 |
isProfileUpdating()
Profile is updating when a new nick is requested but has not been approved from server yet. |
boolean |
isRejoinOnKick()
Should this Session rejoin channels it is Kicked from? Default is true. |
void |
join(String channel)
Join a Channel |
void |
join(String channel,
String pass)
Join a password protected Channel |
void |
mode(String target,
String mode)
Set a mode |
void |
notice(String target,
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 |
List<Channel> |
removeNickFromAllChannels(String nick)
Removes a nick from all channels |
void |
removeTask(Task t)
Removes a Task from the Session. |
void |
sayChannel(Channel channel,
String msg)
Speak in a Channel |
void |
sayChannel(String msg,
Channel channel)
Speak in a channel |
void |
sayPrivate(String nick,
String msg)
Send a private message |
void |
sayRaw(String data)
Send raw text to server |
void |
setAway(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 yo try alternate nicks on connection if a nick in use event is received , or not. |
void |
unsetAway()
Unset away |
void |
unSetAway()
Unset away |
void |
who(String who)
Send Who request |
void |
whois(String nick)
Send a whois query |
void |
whoWas(String nick)
Send WhoWas query |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
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 List<ModeAdjustment> getUserModes()
public void sayChannel(Channel channel, 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(String quitMessage)
quitMessage
- public String getNick()
public void changeNick(String newNick)
public boolean isProfileUpdating()
public boolean isAway()
public void setAway(String message)
public void unsetAway()
public ServerInformation getServerInformation()
ServerInformation
public RequestedConnection getRequestedConnection()
RequestedConnection
public String getConnectedHostName()
getRequestedConnection()
,
RequestedConnection.getHostName()
public void addIRCEventListener(IRCEventListener listener)
listener
- public boolean removeIRCEventListener(IRCEventListener listener)
listener
-
public Collection<IRCEventListener> getIRCEventListeners()
public void onEvent(Task task)
task
- Task
,
TaskImpl
public void onEvent(Task task, IRCEvent.Type... types)
task
- - task to runtypes
- - types of events task should run onTask
,
TaskImpl
public void removeTask(Task t)
t
- public List<Channel> getChannels()
Channel
public Channel getChannel(String channelName)
channelName
-
public List<Channel> removeNickFromAllChannels(String nick)
nick
-
public boolean isChannelToken(String token)
token
-
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
public void who(String who)
who
- public void whois(String nick)
nick
- - target of whoispublic void whoWas(String nick)
nick
- public void invite(String nick, Channel chan)
nick
- chan
- public void chanList()
public void chanList(String channel)
channel
- public void join(String channel)
channel
- public void join(String channel, String pass)
channel
- pass
- public void ctcp(String target, String request)
target
- request
- public void notice(String target, String msg)
target
- msg
- public void unSetAway()
public void getServerVersion()
public void getServerVersion(String hostPattern)
hostPattern
- public void mode(String target, String mode)
target
- mode
- public void action(String target, String actionText)
target
- actionText
- public void sayChannel(String msg, Channel channel)
msg
- channel
- Channel.say(String)
public void sayPrivate(String nick, String msg)
nick
- msg
- public void sayRaw(String data)
data
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |