Bläddra i källkod

Make protocol descriptors check if a URI is secure.

Issue CLIENT-209

Change-Id: I802cf467f0c4f41f6316ddba5451069b0bbaa0c5
Depends-On: Ibf3e3a2f03270089849d9943a535e022245e0f44
Reviewed-on: http://gerrit.dmdirc.com/1998
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.7rc1
Greg Holmes 13 år sedan
förälder
incheckning
97baa9bc6f

+ 13
- 1
src/com/dmdirc/parser/interfaces/ProtocolDescription.java Visa fil

@@ -22,12 +22,13 @@
22 22
 
23 23
 package com.dmdirc.parser.interfaces;
24 24
 
25
+import java.net.URI;
26
+
25 27
 /**
26 28
  * Describes the default properties a protocol handled by a {@link Parser}
27 29
  * instance.
28 30
  *
29 31
  * @since 0.6.4
30
- * @author chris
31 32
  */
32 33
 public interface ProtocolDescription {
33 34
 
@@ -47,4 +48,15 @@ public interface ProtocolDescription {
47 48
      */
48 49
     String[] parseHostmask(String hostmask);
49 50
 
51
+    /**
52
+     * Checks if the specified URI is going via a secure connection or not.
53
+     *
54
+     * @param uri URI to check
55
+     *
56
+     * @return true if the URI is secure false otherwise
57
+     *
58
+     * @since 0.6.6
59
+     */
60
+    boolean isSecure(URI uri);
61
+
50 62
 }

+ 8
- 0
src/com/dmdirc/parser/irc/IRCProtocolDescription.java Visa fil

@@ -24,6 +24,8 @@ package com.dmdirc.parser.irc;
24 24
 
25 25
 import com.dmdirc.parser.interfaces.ProtocolDescription;
26 26
 
27
+import java.net.URI;
28
+
27 29
 /**
28 30
  * Provides a description of the IRC protocol.
29 31
  *
@@ -42,4 +44,10 @@ public class IRCProtocolDescription implements ProtocolDescription {
42 44
     public String[] parseHostmask(final String hostmask) {
43 45
         return IRCClientInfo.parseHostFull(hostmask);
44 46
     }
47
+
48
+    /** {@inheritDoc} */
49
+    @Override
50
+    public boolean isSecure(final URI uri) {
51
+        return uri.getScheme().endsWith("s");
52
+    }
45 53
 }

Laddar…
Avbryt
Spara