public interface Client extends ClientLinked
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(@NonNull String channel,
@NonNull String key)
Adds a key-protected channel to this client.
|
static @NonNull Client.Builder |
builder()
Creates a
Client.Builder to build clients. |
@NonNull Client.Commands |
commands()
Provides access to
Command s. |
void |
connect()
Begin connecting to the server.
|
@NonNull AuthManager |
getAuthManager()
Gets the authentication manager.
|
@NonNull CapabilityManager |
getCapabilityManager()
Gets the capability manager.
|
@NonNull Optional<Channel> |
getChannel(@NonNull String name)
Gets a snapshot of known information about a named channel, if the
channel is being tracked by the client.
|
@NonNull Set<Channel> |
getChannels()
Gets the channels in which the client is currently present.
|
@NonNull Set<Channel> |
getChannels(@NonNull Collection<String> channels)
Gets the channels on the given collection in which the client is
currently present.
|
default @NonNull Client |
getClient()
Gets the Client to which this belongs.
|
@NonNull DefaultMessageMap |
getDefaultMessageMap()
Gets the message manager for default messages to reply with
when certain messages are being sent.
|
@NonNull EventManager |
getEventManager()
Gets the client's event manager.
|
@NonNull Listener<Exception> |
getExceptionListener()
Gets the exception listener.
|
@NonNull String |
getIntendedNick()
Gets the nickname the client intends to possess.
|
@NonNull ISupportManager |
getISupportManager()
Gets the manager of ISUPPORT info.
|
@NonNull Cutter |
getMessageCutter()
Gets the current message cutter for multi-line messages.
|
@NonNull Function<Client.WithManagement,? extends MessageSendingQueue> |
getMessageSendingQueueSupplier()
Gets the message sending queue supplier.
|
@NonNull MessageTagManager |
getMessageTagManager()
Gets the message tag manager.
|
@NonNull String |
getName()
Gets the client name.
|
@NonNull String |
getNick()
Gets the current nickname the client has.
|
@NonNull ServerInfo |
getServerInfo()
Gets information about the server to which the client is currently
connected.
|
@NonNull Optional<StsMachine> |
getStsMachine()
Gets the STS machine instance, if one is in use.
|
@NonNull Optional<User> |
getUser()
Gets the User that the client is represented by.
|
@NonNull Optional<ModeStatusList<UserMode>> |
getUserModes()
Gets the user's modes.
|
default boolean |
isUser(@Nullable User user)
Checks to see if this client is the same as the given user.
|
void |
knockChannel(@NonNull 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(@Nullable String reason)
Triggers a reconnect, quitting with the given reason.
|
void |
removeChannel(@NonNull String channel)
Removes a channel from the client, leaving as necessary.
|
void |
removeChannel(@NonNull String channel,
@Nullable String reason)
Removes a channel from the client, leaving as necessary.
|
default void |
sendCtcpMessage(@NonNull MessageReceiver target,
@NonNull String message)
Sends a CTCP message to a target user or channel.
|
void |
sendCtcpMessage(@NonNull String target,
@NonNull String message)
Sends a CTCP message to a target user or channel.
|
default void |
sendCtcpReply(@NonNull MessageReceiver target,
@NonNull String message)
Sends a CTCP reply to a target user or channel.
|
void |
sendCtcpReply(@NonNull String target,
@NonNull String message)
Sends a CTCP reply to a target user or channel.
|
default void |
sendMessage(@NonNull MessageReceiver target,
@NonNull String message)
Sends a message to a target user or channel.
|
void |
sendMessage(@NonNull String target,
@NonNull String message)
Sends a message to a target user or channel.
|
default void |
sendMultiLineMessage(@NonNull MessageReceiver target,
@NonNull String message)
Sends a potentially multi-line message to a target user or channel
using the client's current
Cutter . |
default void |
sendMultiLineMessage(@NonNull MessageReceiver target,
@NonNull String message,
@NonNull Cutter cutter)
Sends a potentially multi-line message to a target user or channel
using the defined
Cutter . |
default void |
sendMultiLineMessage(@NonNull String target,
@NonNull String message)
Sends a potentially multi-line message to a target user or channel
using the client's current
Cutter . |
void |
sendMultiLineMessage(@NonNull String target,
@NonNull String message,
@NonNull Cutter cutter)
Sends a potentially multi-line message to a target user or channel
using the defined
Cutter . |
default void |
sendMultiLineNotice(@NonNull MessageReceiver target,
@NonNull String message)
Sends a potentially multi-line notice to a target user or channel
using the client's current
Cutter . |
default void |
sendMultiLineNotice(@NonNull MessageReceiver target,
@NonNull String message,
@NonNull Cutter cutter)
Sends a potentially multi-line notice to a target user or channel
using the defined
Cutter . |
default void |
sendMultiLineNotice(@NonNull String target,
@NonNull String message)
Sends a potentially multi-line notice to a target user or channel
using the client's current
Cutter . |
void |
sendMultiLineNotice(@NonNull String target,
@NonNull String message,
@NonNull Cutter cutter)
Sends a potentially multi-line notice to a target user or channel
using the defined
Cutter . |
default void |
sendNotice(@NonNull MessageReceiver target,
@NonNull String message)
Sends a notice to a target user or channel.
|
void |
sendNotice(@NonNull String target,
@NonNull String message)
Sends a notice to a target user or channel.
|
void |
sendRawLine(@NonNull String message)
Sends a raw IRC message.
|
void |
sendRawLineAvoidingDuplication(@NonNull String message)
Sends a raw IRC message, unless the exact same message is already in
the queue of messages not yet sent.
|
void |
sendRawLineImmediately(@NonNull String message)
Sends a raw IRC message, disregarding message delays and all sanity.
|
void |
setDefaultMessageMap(@NonNull DefaultMessageMap defaults)
Sets the message manager for default messages to reply with
when certain messages are being sent.
|
void |
setExceptionListener(@Nullable Consumer<Exception> listener)
Sets a listener for all thrown exceptions on this client.
|
void |
setInputListener(@Nullable Consumer<String> listener)
Sets a listener for all incoming messages from the server.
|
void |
setMessageCutter(@NonNull Cutter cutter)
Sets the default message cutter to use for multi-line messages.
|
void |
setMessageSendingQueueSupplier(@NonNull Function<Client.WithManagement,? extends MessageSendingQueue> supplier)
Sets the message sending queue supplier.
|
void |
setNick(@NonNull String nick)
Sets the nick the client wishes to use.
|
void |
setOutputListener(@Nullable 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(@Nullable String reason)
Shuts down the client.
|
static @NonNull Client.Builder builder()
Client.Builder
to build clients.void addChannel(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(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()
void shutdown(@Nullable String reason)
reason
- quit message to senddefault @NonNull Client getClient()
ClientLinked
getClient
in interface ClientLinked
Copyright © 2013–2021 Kitteh. All rights reserved.