public interface Client
builder()
to create one.Modifier and Type | Interface and Description |
---|---|
static interface |
Client.Builder
Builds
Client s. |
static interface |
Client.Commands
Provides commands.
|
static interface |
Client.WithManagement
A Client with management features.
|
Modifier and Type | Method and Description |
---|---|
void |
addChannel(String... channels)
Adds channels to this client.
|
void |
addKeyProtectedChannel(Pair<String,String>... channelsAndKeys)
Adds key-protected channels to this client.
|
void |
addKeyProtectedChannel(String channel,
String key)
Adds a key-protected channel to this client.
|
static Client.Builder |
builder()
Creates a
Client.Builder to build clients. |
Client.Commands |
commands()
Provides access to
Command s. |
void |
connect()
Begin connecting to the server.
|
AuthManager |
getAuthManager()
Gets the authentication manager.
|
CapabilityManager |
getCapabilityManager()
Gets the capability manager.
|
Optional<Channel> |
getChannel(String name)
Gets the named channel.
|
Set<Channel> |
getChannels()
Gets the channels in which the client is currently present.
|
Set<Channel> |
getChannels(Collection<String> channels)
Gets the channels on the given collection in which the client is
currently present.
|
DefaultMessageMap |
getDefaultMessageMap()
Gets the message manager for default messages to reply with
when certain messages are being sent.
|
EventManager |
getEventManager()
Gets the client's event manager.
|
Listener<Exception> |
getExceptionListener()
Gets the exception listener.
|
String |
getIntendedNick()
Gets the nickname the client intends to possess.
|
ISupportManager |
getISupportManager()
Gets the manager of ISUPPORT info.
|
Cutter |
getMessageCutter()
Gets the current message cutter for multi-line messages.
|
Function<Client.WithManagement,? extends MessageSendingQueue> |
getMessageSendingQueueSupplier()
Gets the message sending queue supplier.
|
MessageTagManager |
getMessageTagManager()
Gets the message tag manager.
|
String |
getName()
Gets the client name.
|
String |
getNick()
Gets the current nickname the client has.
|
ServerInfo |
getServerInfo()
Gets information about the server to which the client is currently
connected.
|
Optional<StsMachine> |
getStsMachine()
Gets the STS machine instance, if one is in use.
|
Optional<User> |
getUser()
Gets the User that the client is represented by.
|
Optional<ModeStatusList<UserMode>> |
getUserModes()
Gets the user's modes.
|
default boolean |
isUser(User user)
Checks to see if this client is the same as the given user.
|
void |
knockChannel(String channelName)
KNOCKs on a +i (but not +p) channel, requesting an INVITE.
|
void |
reconnect()
Triggers a reconnect, quitting with the default
DefaultMessageType.RECONNECT message. |
void |
reconnect(String reason)
Triggers a reconnect, quitting with the given reason.
|
void |
removeChannel(String channel)
Removes a channel from the client, leaving as necessary.
|
void |
removeChannel(String channel,
String reason)
Removes a channel from the client, leaving as necessary.
|
default void |
sendCtcpMessage(MessageReceiver target,
String message)
Sends a CTCP message to a target user or channel.
|
void |
sendCtcpMessage(String target,
String message)
Sends a CTCP message to a target user or channel.
|
default void |
sendCtcpReply(MessageReceiver target,
String message)
Sends a CTCP reply to a target user or channel.
|
void |
sendCtcpReply(String target,
String message)
Sends a CTCP reply to a target user or channel.
|
default void |
sendMessage(MessageReceiver target,
String message)
Sends a message to a target user or channel.
|
void |
sendMessage(String target,
String message)
Sends a message to a target user or channel.
|
default void |
sendMultiLineMessage(MessageReceiver target,
String message)
Sends a potentially multi-line message to a target user or channel
using the client's current
Cutter . |
default void |
sendMultiLineMessage(MessageReceiver target,
String message,
Cutter cutter)
Sends a potentially multi-line message to a target user or channel
using the defined
Cutter . |
default void |
sendMultiLineMessage(String target,
String message)
Sends a potentially multi-line message to a target user or channel
using the client's current
Cutter . |
void |
sendMultiLineMessage(String target,
String message,
Cutter cutter)
Sends a potentially multi-line message to a target user or channel
using the defined
Cutter . |
default void |
sendMultiLineNotice(MessageReceiver target,
String message)
Sends a potentially multi-line notice to a target user or channel
using the client's current
Cutter . |
default void |
sendMultiLineNotice(MessageReceiver target,
String message,
Cutter cutter)
Sends a potentially multi-line notice to a target user or channel
using the defined
Cutter . |
default void |
sendMultiLineNotice(String target,
String message)
Sends a potentially multi-line notice to a target user or channel
using the client's current
Cutter . |
void |
sendMultiLineNotice(String target,
String message,
Cutter cutter)
Sends a potentially multi-line notice to a target user or channel
using the defined
Cutter . |
default void |
sendNotice(MessageReceiver target,
String message)
Sends a notice to a target user or channel.
|
void |
sendNotice(String target,
String message)
Sends a notice to a target user or channel.
|
void |
sendRawLine(String message)
Sends a raw IRC message.
|
void |
sendRawLineAvoidingDuplication(String message)
Sends a raw IRC message, unless the exact same message is already in
the queue of messages not yet sent.
|
void |
sendRawLineImmediately(String message)
Sends a raw IRC message, disregarding message delays and all sanity.
|
void |
setDefaultMessageMap(DefaultMessageMap defaults)
Sets the message manager for default messages to reply with
when certain messages are being sent.
|
void |
setExceptionListener(Consumer<Exception> listener)
Sets a listener for all thrown exceptions on this client.
|
void |
setInputListener(Consumer<String> listener)
Sets a listener for all incoming messages from the server.
|
void |
setMessageCutter(Cutter cutter)
Sets the default message cutter to use for multi-line messages.
|
void |
setMessageSendingQueueSupplier(Function<Client.WithManagement,? extends MessageSendingQueue> supplier)
Sets the message sending queue supplier.
|
void |
setNick(String nick)
Sets the nick the client wishes to use.
|
void |
setOutputListener(Consumer<String> listener)
Sets a listener for all outgoing messages to the server.
|
void |
shutdown()
Shuts down the client without a quit message.
|
void |
shutdown(String reason)
Shuts down the client.
|
@Nonnull static Client.Builder builder()
Client.Builder
to build clients.void addChannel(@Nonnull String... channels)
Joins the channels if already connected.
channels
- channel(s) to addIllegalArgumentException
- if null or invalidRequestedChannelJoinCompleteEvent
,
UnexpectedChannelLeaveEvent
void addKeyProtectedChannel(@Nonnull String channel, @Nonnull String key)
Joins the channels if already connected.
channel
- channel to addkey
- channel keyIllegalArgumentException
- if null or invalidvoid addKeyProtectedChannel(@Nonnull Pair<String,String>... channelsAndKeys)
Joins the channels if already connected.
channelsAndKeys
- pairs of channel, keyIllegalArgumentException
- if null or invalid@Nonnull Client.Commands commands()
Command
s.@Nonnull AuthManager getAuthManager()
@Nonnull CapabilityManager getCapabilityManager()
@Nonnull Optional<Channel> getChannel(@Nonnull String name)
name
- channel nameIllegalArgumentException
- if name is nullgetChannels()
@Nonnull Set<Channel> getChannels()
@Nonnull Set<Channel> getChannels(@Nonnull Collection<String> channels)
channels
- collection of channel names to get@Nonnull DefaultMessageMap getDefaultMessageMap()
@Nonnull EventManager getEventManager()
@Nonnull Listener<Exception> getExceptionListener()
@Nonnull String getIntendedNick()
Use getNick()
for the current nick.
@Nonnull Optional<StsMachine> getStsMachine()
@Nonnull ISupportManager getISupportManager()
@Nonnull Cutter getMessageCutter()
@Nonnull Function<Client.WithManagement,? extends MessageSendingQueue> getMessageSendingQueueSupplier()
SingleDelaySender
with a delay of 1200.@Nonnull MessageTagManager getMessageTagManager()
@Nonnull String getName()
@Nonnull String getNick()
@Nonnull ServerInfo getServerInfo()
ClientNegotiationCompleteEvent
@Nonnull Optional<User> getUser()
Optional.empty()
until the Client is in a Channel for which joining
has completed, meaning full user info is available.@Nonnull Optional<ModeStatusList<UserMode>> getUserModes()
Optional.empty()
until the
Client has queried this information, which is requested after the
connection registration has completed.default boolean isUser(@Nullable User user)
user
- user to check this client againstvoid knockChannel(@Nonnull String channelName)
channelName
- the channel to send the KNOCK for.void reconnect()
DefaultMessageType.RECONNECT
message.void reconnect(@Nullable String reason)
reason
- disconnect reasonvoid removeChannel(@Nonnull String channel)
channel
- channel to leaveIllegalArgumentException
- if arguments are nullvoid removeChannel(@Nonnull String channel, @Nullable String reason)
channel
- channel to leavereason
- part reasonIllegalArgumentException
- if channel is nullvoid sendCtcpMessage(@Nonnull String target, @Nonnull String message)
Note: CTCP replies should not be sent this way. Catch the message
with the PrivateCtcpQueryEvent
and reply there or use
sendCtcpReply(String, String)
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersdefault void sendCtcpMessage(@Nonnull MessageReceiver target, @Nonnull String message)
Note: CTCP replies should not be sent this way. Catch the message
with the PrivateCtcpQueryEvent
and reply there or use
sendCtcpReply(MessageReceiver, String)
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersvoid sendCtcpReply(@Nonnull String target, @Nonnull String message)
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersdefault void sendCtcpReply(@Nonnull MessageReceiver target, @Nonnull String message)
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersvoid sendMessage(@Nonnull String target, @Nonnull String message)
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersdefault void sendMessage(@Nonnull MessageReceiver target, @Nonnull String message)
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersvoid sendNotice(@Nonnull String target, @Nonnull String message)
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersdefault void sendNotice(@Nonnull MessageReceiver target, @Nonnull String message)
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersdefault void sendMultiLineMessage(@Nonnull String target, @Nonnull String message)
Cutter
.
Note that bots may not react appropriately to a message split across multiple lines.
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersvoid sendMultiLineMessage(@Nonnull String target, @Nonnull String message, @Nonnull Cutter cutter)
Cutter
.
Note that bots may not react appropriately to a message split across multiple lines.
target
- the destination of the messagemessage
- the message to sendcutter
- cutter to utilizeIllegalArgumentException
- for null parametersdefault void sendMultiLineMessage(@Nonnull MessageReceiver target, @Nonnull String message)
Cutter
.
Note that bots may not react appropriately to a message split across multiple lines.
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersdefault void sendMultiLineMessage(@Nonnull MessageReceiver target, @Nonnull String message, @Nonnull Cutter cutter)
Cutter
.
Note that bots may not react appropriately to a message split across multiple lines.
target
- the destination of the messagemessage
- the message to sendcutter
- cutter to utilizeIllegalArgumentException
- for null parametersdefault void sendMultiLineNotice(@Nonnull String target, @Nonnull String message)
Cutter
.
Note that bots may not react appropriately to a message split across multiple lines.
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersvoid sendMultiLineNotice(@Nonnull String target, @Nonnull String message, @Nonnull Cutter cutter)
Cutter
.
Note that bots may not react appropriately to a message split across multiple lines.
target
- the destination of the messagemessage
- the message to sendcutter
- cutter to utilizeIllegalArgumentException
- for null parametersdefault void sendMultiLineNotice(@Nonnull MessageReceiver target, @Nonnull String message)
Cutter
.
Note that bots may not react appropriately to a message split across multiple lines.
target
- the destination of the messagemessage
- the message to sendIllegalArgumentException
- for null parametersdefault void sendMultiLineNotice(@Nonnull MessageReceiver target, @Nonnull String message, @Nonnull Cutter cutter)
Cutter
.
Note that bots may not react appropriately to a message split across multiple lines.
target
- the destination of the messagemessage
- the message to sendcutter
- cutter to utilizeIllegalArgumentException
- for null parametersvoid sendRawLine(@Nonnull String message)
message
- message to sendIllegalArgumentException
- if message is nullvoid sendRawLineAvoidingDuplication(@Nonnull String message)
message
- message to sendIllegalArgumentException
- if message is nullvoid sendRawLineImmediately(@Nonnull String message)
message
- message to send dangerously, you monsterIllegalArgumentException
- if message is nullvoid setExceptionListener(@Nullable Consumer<Exception> listener)
All exceptions are passed from a single, separate thread.
listener
- catcher of throwable objectsvoid setDefaultMessageMap(@Nonnull DefaultMessageMap defaults)
defaults
- DefaultMessageMap to setvoid setInputListener(@Nullable Consumer<String> listener)
All messages are passed from a single, separate thread.
listener
- input listenervoid setMessageCutter(@Nonnull Cutter cutter)
cutter
- cutter to setvoid setMessageSendingQueueSupplier(@Nonnull Function<Client.WithManagement,? extends MessageSendingQueue> supplier)
supplier
- the suppliervoid setNick(@Nonnull String nick)
nick
- new nicknameIllegalArgumentException
- if nick is nullvoid setOutputListener(@Nullable Consumer<String> listener)
All messages are passed from a single, separate thread.
listener
- output listenervoid connect()
IllegalStateException
- if the client is already connectingvoid shutdown()
Copyright © 2013–2019 Kitteh. All rights reserved.