Add method to determine whether a connection represents a given source.
[xudocci.git] / 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