Browse Source

Add away reason to ClientInfo

Change-Id: Id43956b2fad628754196aea3782d4892f3b768a5
Reviewed-on: http://gerrit.dmdirc.com/2537
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.7rc1
Greg Holmes 11 years ago
parent
commit
09768c378f

+ 22
- 3
src/com/dmdirc/parser/common/AwayState.java View File

@@ -29,10 +29,29 @@ package com.dmdirc.parser.common;
29 29
  * @since 0.6.3
30 30
  */
31 31
 public enum AwayState {
32
+
32 33
     /** State is unknown. */
33
-    UNKNOWN,
34
+    UNKNOWN("Unknown"),
34 35
     /** User is here. */
35
-    HERE,
36
+    HERE("Here"),
36 37
     /** User is away. */
37
-    AWAY;
38
+    AWAY("Away");
39
+
40
+    /** Friendly name for the state. */
41
+    private final String friendlyName;
42
+
43
+    /**
44
+     * Adds a friendly name to the away state.
45
+     * <p/>
46
+     * @param friendlyName Friendly name
47
+     */
48
+    AwayState(final String friendlyName) {
49
+        this.friendlyName = friendlyName;
50
+    }
51
+
52
+    /** {@inheritDoc} */
53
+    @Override
54
+    public String toString() {
55
+        return friendlyName;
56
+    }
38 57
 }

+ 6
- 0
src/com/dmdirc/parser/common/BaseClientInfo.java View File

@@ -137,4 +137,10 @@ public abstract class BaseClientInfo implements ClientInfo {
137 137
         return getNickname();
138 138
     }
139 139
 
140
+    /** {@inheritDoc} */
141
+    @Override
142
+    public String getAwayReason() {
143
+        return "";
144
+    }
145
+
140 146
 }

+ 7
- 0
src/com/dmdirc/parser/interfaces/ClientInfo.java View File

@@ -76,6 +76,13 @@ public interface ClientInfo {
76 76
      */
77 77
     AwayState getAwayState();
78 78
 
79
+    /**
80
+     * Get the Away Reason for this user.
81
+     *
82
+     * @return Known away reason for user.
83
+     */
84
+     String getAwayReason();
85
+
79 86
     /**
80 87
      * Retrieves a {@link Map} which can be used to store arbitrary data
81 88
      * about the client.

+ 2
- 5
src/com/dmdirc/parser/irc/IRCClientInfo.java View File

@@ -252,11 +252,8 @@ public class IRCClientInfo implements LocalClientInfo {
252 252
         return away;
253 253
     }
254 254
 
255
-    /**
256
-     * Get the Away Reason for this user.
257
-     *
258
-     * @return Known away reason for user.
259
-     */
255
+    /** {@inheritDoc} */
256
+    @Override
260 257
     public String getAwayReason() {
261 258
         return awayReason;
262 259
     }

Loading…
Cancel
Save