From 0859ab67dc0f8b992243115c38024d6427a10598 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 18 Oct 2014 21:37:22 +0200 Subject: [PATCH] Use only a single place to decide if a message is CTCP. --- src/main/java/net/pterodactylus/irc/connection/CtcpHandler.java | 2 +- src/main/java/net/pterodactylus/irc/connection/MessageHandler.java | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/pterodactylus/irc/connection/CtcpHandler.java b/src/main/java/net/pterodactylus/irc/connection/CtcpHandler.java index d5e07cf..8dc6933 100644 --- a/src/main/java/net/pterodactylus/irc/connection/CtcpHandler.java +++ b/src/main/java/net/pterodactylus/irc/connection/CtcpHandler.java @@ -49,7 +49,7 @@ public class CtcpHandler implements Handler { return reply.command().equalsIgnoreCase(command); } - private boolean messageIsCtcp(String message) { + public static boolean messageIsCtcp(String message) { return message.startsWith("\u0001") && message.endsWith("\u0001"); } diff --git a/src/main/java/net/pterodactylus/irc/connection/MessageHandler.java b/src/main/java/net/pterodactylus/irc/connection/MessageHandler.java index 36d1938..3e34767 100644 --- a/src/main/java/net/pterodactylus/irc/connection/MessageHandler.java +++ b/src/main/java/net/pterodactylus/irc/connection/MessageHandler.java @@ -1,5 +1,7 @@ package net.pterodactylus.irc.connection; +import static net.pterodactylus.irc.connection.CtcpHandler.messageIsCtcp; + import java.util.List; import net.pterodactylus.irc.Connection; @@ -40,10 +42,6 @@ public class MessageHandler implements Handler { return reply.command().equalsIgnoreCase(command); } - private boolean messageIsCtcp(String message) { - return message.startsWith("\u0001") && message.endsWith("\u0001"); - } - @Override public void handleReply(Reply reply) { boolean isNotice = commandIs(reply, "NOTICE"); -- 2.7.4