From: David ‘Bombe’ Roden Date: Wed, 10 Apr 2013 05:21:10 +0000 (+0200) Subject: Add method to determine whether a connection represents a given source. X-Git-Url: https://git.pterodactylus.net/?p=xudocci.git;a=commitdiff_plain;h=2a62474cbd0e3ac9eb30dc4153faf91edf8e1453 Add method to determine whether a connection represents a given source. --- diff --git a/src/main/java/net/pterodactylus/irc/Connection.java b/src/main/java/net/pterodactylus/irc/Connection.java index 239f0a2..c7d5428 100644 --- a/src/main/java/net/pterodactylus/irc/Connection.java +++ b/src/main/java/net/pterodactylus/irc/Connection.java @@ -201,6 +201,19 @@ public class Connection extends AbstractExecutionThreadService implements Servic // /** + * Checks whether the given source is the client represented by this + * connection. + * + * @param source + * The source to check + * @return {@code true} if this connection represents the given source, {@code + * false} otherwise + */ + public boolean isSource(Source source) { + return source.nick().isPresent() && source.nick().get().equals(nickname); + } + + /** * Joins the given channel. * * @param channel