Extract message into its own variable.
[xudocci.git] / 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. */