|
@@ -30,130 +30,148 @@ package com.dmdirc.parser.common;
|
30
|
30
|
* @see IRCParser
|
31
|
31
|
*/
|
32
|
32
|
public class MyInfo {
|
33
|
|
-
|
34
|
|
- /** Character to prepend to nickname if in use (Default "_"). */
|
35
|
|
- private char prependChar = '_';
|
36
|
|
- /** Nickname to attempt to use on IRC. */
|
37
|
|
- private String nickname;
|
38
|
|
- /**
|
39
|
|
- * Alternative nickname to attempt to use on IRC.
|
40
|
|
- * If the first nickname is in use, and a NickInUse message is recieved before 001, we
|
41
|
|
- * will attempt to use this nickname instead.<br>
|
42
|
|
- * If this also fails, we will start prepending the prependChar character (_) to the main nickname
|
43
|
|
- */
|
44
|
|
- private String altNickname;
|
45
|
|
- /** Realname string to use */
|
46
|
|
- private String realname;
|
47
|
|
- /** Username to use, this doesn't matter when an ident server is running*/
|
48
|
|
- private String username;
|
49
|
|
-
|
50
|
|
- /**
|
51
|
|
- * Create a new MyInfo object.
|
52
|
|
- */
|
53
|
|
- public MyInfo() {
|
54
|
|
- String result;
|
55
|
|
- try {
|
56
|
|
- result = System.getProperty("user.name");
|
57
|
|
- } catch (SecurityException e) {
|
58
|
|
- result = null;
|
59
|
|
- }
|
60
|
|
- if (result == null || result.isEmpty()) {
|
61
|
|
- nickname = "IRCParser";
|
62
|
|
- username = "IRCParser";
|
63
|
|
- realname = "DMDIrc IRCParser";
|
64
|
|
- altNickname = "IRC-Parser";
|
65
|
|
- } else {
|
66
|
|
- nickname = result;
|
67
|
|
- username = nickname;
|
68
|
|
- realname = nickname+" - DMDIrc";
|
69
|
|
- altNickname = nickname+"-";
|
70
|
|
- }
|
|
33
|
+
|
|
34
|
+ /** Character to prepend to nickname if in use (Default "_"). */
|
|
35
|
+ private char prependChar = '_';
|
|
36
|
+ /** Nickname to attempt to use on IRC. */
|
|
37
|
+ private String nickname;
|
|
38
|
+ /**
|
|
39
|
+ * Alternative nickname to attempt to use on IRC. If the first nickname is
|
|
40
|
+ * in use, and a NickInUse message is recieved before 001, we will attempt
|
|
41
|
+ * to use this nickname instead.<br>
|
|
42
|
+ * If this also fails, we will start prepending the prependChar character
|
|
43
|
+ * (_) to the main nickname
|
|
44
|
+ */
|
|
45
|
+ private String altNickname;
|
|
46
|
+ /** Realname string to use */
|
|
47
|
+ private String realname;
|
|
48
|
+ /** Username to use, this doesn't matter when an ident server is running */
|
|
49
|
+ private String username;
|
|
50
|
+
|
|
51
|
+ /**
|
|
52
|
+ * Create a new MyInfo object.
|
|
53
|
+ */
|
|
54
|
+ public MyInfo() {
|
|
55
|
+ String result;
|
|
56
|
+ try {
|
|
57
|
+ result = System.getProperty("user.name");
|
|
58
|
+ } catch (SecurityException e) {
|
|
59
|
+ result = null;
|
71
|
60
|
}
|
72
|
|
-
|
73
|
|
- /**
|
74
|
|
- * Set the Nickname.
|
75
|
|
- *
|
76
|
|
- * @param newValue Value to set to.
|
77
|
|
- */
|
78
|
|
- public void setNickname(final String newValue) {
|
79
|
|
- if (newValue != null && !newValue.isEmpty()) {
|
80
|
|
- nickname = newValue;
|
81
|
|
- }
|
|
61
|
+ if (result == null || result.isEmpty()) {
|
|
62
|
+ nickname = "IRCParser";
|
|
63
|
+ username = "IRCParser";
|
|
64
|
+ realname = "DMDIrc IRCParser";
|
|
65
|
+ altNickname = "IRC-Parser";
|
|
66
|
+ } else {
|
|
67
|
+ nickname = result;
|
|
68
|
+ username = nickname;
|
|
69
|
+ realname = nickname + " - DMDIrc";
|
|
70
|
+ altNickname = nickname + "-";
|
82
|
71
|
}
|
83
|
|
-
|
84
|
|
- /**
|
85
|
|
- * Get the Nickname.
|
86
|
|
- *
|
87
|
|
- * @return Current Nickname
|
88
|
|
- */
|
89
|
|
- public String getNickname() { return nickname; }
|
90
|
|
-
|
91
|
|
- /**
|
92
|
|
- * Set the Alternative Nickname.
|
93
|
|
- *
|
94
|
|
- * @param newValue Value to set to.
|
95
|
|
- */
|
96
|
|
- public void setAltNickname(final String newValue) {
|
97
|
|
- if (newValue != null && !newValue.isEmpty()) {
|
98
|
|
- altNickname = newValue;
|
99
|
|
- }
|
|
72
|
+ }
|
|
73
|
+
|
|
74
|
+ /**
|
|
75
|
+ * Set the Nickname.
|
|
76
|
+ *
|
|
77
|
+ * @param newValue
|
|
78
|
+ * Value to set to.
|
|
79
|
+ */
|
|
80
|
+ public void setNickname(final String newValue) {
|
|
81
|
+ if (newValue != null && !newValue.isEmpty()) {
|
|
82
|
+ nickname = newValue;
|
100
|
83
|
}
|
101
|
|
-
|
102
|
|
- /**
|
103
|
|
- * Get the Alternative Nickname.
|
104
|
|
- *
|
105
|
|
- * @return Current Nickname
|
106
|
|
- */
|
107
|
|
- public String getAltNickname() { return altNickname; }
|
108
|
|
-
|
109
|
|
- /**
|
110
|
|
- * Set the Realname.
|
111
|
|
- *
|
112
|
|
- * @param newValue Value to set to.
|
113
|
|
- */
|
114
|
|
- public void setRealname(final String newValue) {
|
115
|
|
- if (newValue != null && !newValue.isEmpty()) {
|
116
|
|
- realname = newValue;
|
117
|
|
- }
|
|
84
|
+ }
|
|
85
|
+
|
|
86
|
+ /**
|
|
87
|
+ * Get the Nickname.
|
|
88
|
+ *
|
|
89
|
+ * @return Current Nickname
|
|
90
|
+ */
|
|
91
|
+ public String getNickname() {
|
|
92
|
+ return nickname;
|
|
93
|
+ }
|
|
94
|
+
|
|
95
|
+ /**
|
|
96
|
+ * Set the Alternative Nickname.
|
|
97
|
+ *
|
|
98
|
+ * @param newValue
|
|
99
|
+ * Value to set to.
|
|
100
|
+ */
|
|
101
|
+ public void setAltNickname(final String newValue) {
|
|
102
|
+ if (newValue != null && !newValue.isEmpty()) {
|
|
103
|
+ altNickname = newValue;
|
118
|
104
|
}
|
119
|
|
-
|
120
|
|
- /**
|
121
|
|
- * Get the Realname.
|
122
|
|
- *
|
123
|
|
- * @return Current Realname
|
124
|
|
- */
|
125
|
|
- public String getRealname() { return realname; }
|
126
|
|
-
|
127
|
|
- /**
|
128
|
|
- * Set the Username.
|
129
|
|
- *
|
130
|
|
- * @param newValue Value to set to.
|
131
|
|
- */
|
132
|
|
- public void setUsername(final String newValue) {
|
133
|
|
- if (newValue != null && !newValue.isEmpty()) {
|
134
|
|
- username = newValue;
|
135
|
|
- }
|
|
105
|
+ }
|
|
106
|
+
|
|
107
|
+ /**
|
|
108
|
+ * Get the Alternative Nickname.
|
|
109
|
+ *
|
|
110
|
+ * @return Current Nickname
|
|
111
|
+ */
|
|
112
|
+ public String getAltNickname() {
|
|
113
|
+ return altNickname;
|
|
114
|
+ }
|
|
115
|
+
|
|
116
|
+ /**
|
|
117
|
+ * Set the Realname.
|
|
118
|
+ *
|
|
119
|
+ * @param newValue
|
|
120
|
+ * Value to set to.
|
|
121
|
+ */
|
|
122
|
+ public void setRealname(final String newValue) {
|
|
123
|
+ if (newValue != null && !newValue.isEmpty()) {
|
|
124
|
+ realname = newValue;
|
136
|
125
|
}
|
137
|
|
-
|
138
|
|
- /**
|
139
|
|
- * Get the Username.
|
140
|
|
- *
|
141
|
|
- * @return Current Username
|
142
|
|
- */
|
143
|
|
- public String getUsername() { return username; }
|
144
|
|
-
|
145
|
|
- /**
|
146
|
|
- * Set the Prepend Character.
|
147
|
|
- *
|
148
|
|
- * @param newValue Value to set to.
|
149
|
|
- */
|
150
|
|
- public void setPrependChar(final char newValue) { prependChar = newValue; }
|
151
|
|
-
|
152
|
|
- /**
|
153
|
|
- * Get the Prepend Character.
|
154
|
|
- *
|
155
|
|
- * @return Current Prepend Character
|
156
|
|
- */
|
157
|
|
- public char getPrependChar() { return prependChar; }
|
|
126
|
+ }
|
|
127
|
+
|
|
128
|
+ /**
|
|
129
|
+ * Get the Realname.
|
|
130
|
+ *
|
|
131
|
+ * @return Current Realname
|
|
132
|
+ */
|
|
133
|
+ public String getRealname() {
|
|
134
|
+ return realname;
|
|
135
|
+ }
|
|
136
|
+
|
|
137
|
+ /**
|
|
138
|
+ * Set the Username.
|
|
139
|
+ *
|
|
140
|
+ * @param newValue
|
|
141
|
+ * Value to set to.
|
|
142
|
+ */
|
|
143
|
+ public void setUsername(final String newValue) {
|
|
144
|
+ if (newValue != null && !newValue.isEmpty()) {
|
|
145
|
+ username = newValue;
|
|
146
|
+ }
|
|
147
|
+ }
|
|
148
|
+
|
|
149
|
+ /**
|
|
150
|
+ * Get the Username.
|
|
151
|
+ *
|
|
152
|
+ * @return Current Username
|
|
153
|
+ */
|
|
154
|
+ public String getUsername() {
|
|
155
|
+ return username;
|
|
156
|
+ }
|
|
157
|
+
|
|
158
|
+ /**
|
|
159
|
+ * Set the Prepend Character.
|
|
160
|
+ *
|
|
161
|
+ * @param newValue
|
|
162
|
+ * Value to set to.
|
|
163
|
+ */
|
|
164
|
+ public void setPrependChar(final char newValue) {
|
|
165
|
+ prependChar = newValue;
|
|
166
|
+ }
|
|
167
|
+
|
|
168
|
+ /**
|
|
169
|
+ * Get the Prepend Character.
|
|
170
|
+ *
|
|
171
|
+ * @return Current Prepend Character
|
|
172
|
+ */
|
|
173
|
+ public char getPrependChar() {
|
|
174
|
+ return prependChar;
|
|
175
|
+ }
|
158
|
176
|
|
159
|
177
|
}
|