/*
* Copyright (c) 2006-2013 DMDirc Developers
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.dmdirc.parser.interfaces;
import com.dmdirc.parser.common.CallbackManager;
import com.dmdirc.parser.common.ChannelJoinRequest;
import com.dmdirc.parser.common.CompositionState;
import com.dmdirc.parser.common.IgnoreList;
import com.dmdirc.parser.common.QueuePriority;
import java.net.URI;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* A parser connects to a back-end chat system and handles all communication
* with it.
*
* @since 0.6.3m2
* @author chris
*/
public interface Parser {
/**
* Connect to server.
*
* @param threadName Name for any parser thread.
*/
void connect();
/**
* Disconnect from server. This method will quit and automatically close the
* socket without waiting for the server.
*
* @param message Reason for quitting.
*/
void disconnect(String message);
/**
*
* Disconnect from server. This method will wait for the server to
* close the socket.
*/
void quit(String message);
/**
* Join a channel with no key.
*
* @param channel Name of channel to join
*/
void joinChannel(String channel);
/**
* Joins a channel with the specified key.
*
* @param channel Name of channel to join
* @param key The key required to join the channel
*/
void joinChannel(String channel, String key);
/**
* Joins the specified channels.
*
* @since 0.6.4
* @param channels The channels to be joined
*/
void joinChannels(ChannelJoinRequest ... channels);
/**
* Retrieves a channel information object for the specified channel.
*
* @param channel Name of the channel to retrieve an information object for
* @return A corresponding channel info object
*/
ChannelInfo getChannel(String channel);
/**
* Retrieves a collection of all known channels.
*
* @return A collection of known channels
*/
Collection extends ChannelInfo> getChannels();
/**
* Get the IP address that this parser will bind to.
*
* @return IP that this parser is bound to ("" for default IP)
*/
String getBindIP();
/**
* Set the IP address that this parser will bind to.
*
* @param ip IP to bind to
*/
void setBindIP(String ip);
/**
* Gets the proxy URI that this parser will use.
*
* @return A URI representing the proxy this parser is configured to use,
* or null if no proxy is set.
* @since 0.6.7
* @see #setProxy(java.net.URI)
*/
URI getProxy();
/**
* Configures the proxy that this parser will use. The URI should consist
* of the following components:
*
*
scheme: the proxy type (socks, http, etc)
*
user-info: optionally, username and password separated by a ':'
*
host: the hostname or IP of the proxy server
*
port: the port to use
*
* e.g.: socks://user:pass@dmdirc.com:123/.
*
* @param proxy A URI representing the proxy this parser should use,
* or null to connect directly.
* @since 0.6.7
* @see #getProxy()
*/
void setProxy(URI proxy);
/**
* Retrieves a {@link Map} which can be used to store arbitrary data
* about the client.
*
* @return A map used for storing arbitrary data
*/
Map