import javax.net.SocketFactory;
import net.pterodactylus.irc.event.ChannelJoined;
+import net.pterodactylus.irc.event.ChannelMessageReceived;
import net.pterodactylus.irc.event.ChannelNicknames;
import net.pterodactylus.irc.event.ChannelNotJoined;
import net.pterodactylus.irc.event.ChannelNotJoined.Reason;
import net.pterodactylus.irc.event.MotdReceived;
import net.pterodactylus.irc.event.NicknameInUseReceived;
import net.pterodactylus.irc.event.NoNicknameGivenReceived;
+import net.pterodactylus.irc.event.PrivateMessageReceived;
import net.pterodactylus.irc.event.UnknownReplyReceived;
import net.pterodactylus.irc.util.RandomNickname;
String command = reply.command();
List<String> parameters = reply.parameters();
+ /* most common events. */
+ if (command.equalsIgnoreCase("PRIVMSG")) {
+ String recipient = parameters.get(0);
+ if (!channelTypes.contains(recipient.charAt(0))) {
+ eventBus.post(new PrivateMessageReceived(this, reply.source().get(), parameters.get(1)));
+ } else {
+ eventBus.post(new ChannelMessageReceived(this, recipient, reply.source().get(), parameters.get(1)));
+ }
+
/* replies 001-004 don’t hold information but they have to be sent on a successful connection. */
- if (command.equals("001")) {
+ } else if (command.equals("001")) {
connectionStatus |= 0x01;
} else if (command.equals("002")) {
connectionStatus |= 0x02;