Add method to determine whether a connection represents a given source.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 10 Apr 2013 05:21:10 +0000 (07:21 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 10 Apr 2013 05:21:10 +0000 (07:21 +0200)
src/main/java/net/pterodactylus/irc/Connection.java

index 239f0a2..c7d5428 100644 (file)
@@ -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