import net.pterodactylus.irc.event.ConnectionFailed;
import net.pterodactylus.irc.event.DccAcceptReceived;
import net.pterodactylus.irc.event.DccSendReceived;
import net.pterodactylus.irc.event.ConnectionFailed;
import net.pterodactylus.irc.event.DccAcceptReceived;
import net.pterodactylus.irc.event.DccSendReceived;
import net.pterodactylus.irc.event.MotdReceived;
import net.pterodactylus.irc.event.NicknameChanged;
import net.pterodactylus.irc.event.NicknameInUseReceived;
import net.pterodactylus.irc.event.MotdReceived;
import net.pterodactylus.irc.event.NicknameChanged;
import net.pterodactylus.irc.event.NicknameInUseReceived;
import com.google.common.primitives.Longs;
import com.google.common.util.concurrent.AbstractExecutionThreadService;
import com.google.common.util.concurrent.Service;
import com.google.common.primitives.Longs;
import com.google.common.util.concurrent.AbstractExecutionThreadService;
import com.google.common.util.concurrent.Service;
/* connect to remote socket. */
try {
Socket socket = socketFactory.createSocket(hostname, port);
/* connect to remote socket. */
try {
Socket socket = socketFactory.createSocket(hostname, port);
connectionHandler = new ConnectionHandler(socket.getInputStream(), socket.getOutputStream());
/* register connection. */
connectionHandler = new ConnectionHandler(socket.getInputStream(), socket.getOutputStream());
/* register connection. */
while (connected) {
Reply reply = connectionHandler.readReply();
eventBus.post(new ReplyReceived(this, reply));
while (connected) {
Reply reply = connectionHandler.readReply();
eventBus.post(new ReplyReceived(this, reply));
eventBus.post(new ChannelNotJoined(this, parameters.get(1), Reason.inviteOnly));
} else if (command.equals("475")) {
eventBus.post(new ChannelNotJoined(this, parameters.get(1), Reason.badChannelKey));
eventBus.post(new ChannelNotJoined(this, parameters.get(1), Reason.inviteOnly));
} else if (command.equals("475")) {
eventBus.post(new ChannelNotJoined(this, parameters.get(1), Reason.badChannelKey));
char modeSymbol = parameter.charAt(closeParen + modeCharacterIndex);
nickPrefixes.put(String.valueOf(modeSymbol), String.valueOf(modeCharacter));
}
char modeSymbol = parameter.charAt(closeParen + modeCharacterIndex);
nickPrefixes.put(String.valueOf(modeSymbol), String.valueOf(modeCharacter));
}
}
} else if (parameter.startsWith("CHANTYPES=")) {
for (int typeIndex = 10; typeIndex < parameter.length(); ++typeIndex) {
channelTypes.add(parameter.charAt(typeIndex));
}
}
} else if (parameter.startsWith("CHANTYPES=")) {
for (int typeIndex = 10; typeIndex < parameter.length(); ++typeIndex) {
channelTypes.add(parameter.charAt(typeIndex));
}
+ } else if (command.equals("KICK")) {
+ eventBus.post(new KickedFromChannel(this, parameters.get(0), reply.source().get(), parameters.get(1), getOptional(parameters, 2)));
+
/* okay, everything else. */
} else {
eventBus.post(new UnknownReplyReceived(this, reply));
/* okay, everything else. */
} else {
eventBus.post(new UnknownReplyReceived(this, reply));
eventBus.post(new ConnectionClosed(this, ioe1));
} catch (RuntimeException re1) {
eventBus.post(new ConnectionClosed(this, ioe1));
} catch (RuntimeException re1) {
if (inetAddress.isPresent() && port.isPresent()) {
eventBus.post(new DccSendReceived(this, client, messageWords[2], inetAddress.get(), port.get(), fileSize));
} else {
if (inetAddress.isPresent() && port.isPresent()) {
eventBus.post(new DccSendReceived(this, client, messageWords[2], inetAddress.get(), port.get(), fileSize));
} else {
}
} else if (messageWords[1].equalsIgnoreCase("ACCEPT")) {
Optional<Integer> port = Optional.fromNullable(Ints.tryParse(messageWords[3]));
}
} else if (messageWords[1].equalsIgnoreCase("ACCEPT")) {
Optional<Integer> port = Optional.fromNullable(Ints.tryParse(messageWords[3]));
if (port.isPresent()) {
eventBus.post(new DccAcceptReceived(this, client, messageWords[2], port.get(), position));
} else {
if (port.isPresent()) {
eventBus.post(new DccAcceptReceived(this, client, messageWords[2], port.get(), position));
} else {
public void close() throws IOException {
Closeables.close(outputStream, true);
Closeables.close(inputStreamReader, true);
public void close() throws IOException {
Closeables.close(outputStream, true);
Closeables.close(inputStreamReader, true);