Extract message into its own variable.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 9 Apr 2013 20:52:26 +0000 (22:52 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 9 Apr 2013 20:56:53 +0000 (22:56 +0200)
src/main/java/net/pterodactylus/irc/Connection.java

index ba4e283..2619204 100644 (file)
@@ -260,10 +260,11 @@ public class Connection extends AbstractExecutionThreadService implements Servic
                                /* most common events. */
                                if (command.equalsIgnoreCase("PRIVMSG")) {
                                        String recipient = parameters.get(0);
+                                       String message = parameters.get(1);
                                        if (!channelTypes.contains(recipient.charAt(0))) {
-                                               eventBus.post(new PrivateMessageReceived(this, reply.source().get(), parameters.get(1)));
+                                               eventBus.post(new PrivateMessageReceived(this, reply.source().get(), message));
                                        } else {
-                                               eventBus.post(new ChannelMessageReceived(this, recipient, reply.source().get(), parameters.get(1)));
+                                               eventBus.post(new ChannelMessageReceived(this, recipient, reply.source().get(), message));
                                        }
 
                                /* replies 001-004 don’t hold information but they have to be sent on a successful connection. */