1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
package org.apache.camel.component.irc; |
19 |
|
|
20 |
|
import org.apache.camel.RuntimeCamelException; |
21 |
|
|
22 |
|
import java.net.URI; |
23 |
|
|
24 |
|
public class IrcConfiguration implements Cloneable { |
25 |
|
String target; |
26 |
|
String hostname; |
27 |
|
String password; |
28 |
|
String nickname; |
29 |
|
String realname; |
30 |
|
String username; |
31 |
0 |
boolean persistent = true; |
32 |
0 |
boolean colors = true; |
33 |
0 |
boolean onNick = true; |
34 |
0 |
boolean onQuit = true; |
35 |
0 |
boolean onJoin = true; |
36 |
0 |
boolean onKick = true; |
37 |
0 |
boolean onMode = true; |
38 |
0 |
boolean onPart = true; |
39 |
0 |
boolean onTopic = true; |
40 |
0 |
boolean onPrivmsg = true; |
41 |
0 |
int[] ports = {6667, 6668, 6669}; |
42 |
|
|
43 |
0 |
public IrcConfiguration() { |
44 |
0 |
} |
45 |
|
|
46 |
0 |
public IrcConfiguration(String hostname, String nickname, String displayname, String target) { |
47 |
0 |
this.target = target; |
48 |
0 |
this.hostname = hostname; |
49 |
0 |
this.nickname = nickname; |
50 |
0 |
this.username = nickname; |
51 |
0 |
this.realname = displayname; |
52 |
0 |
} |
53 |
|
|
54 |
0 |
public IrcConfiguration(String hostname, String username, String password, String nickname, String displayname, String target) { |
55 |
0 |
this.target = target; |
56 |
0 |
this.hostname = hostname; |
57 |
0 |
this.username = username; |
58 |
0 |
this.password = password; |
59 |
0 |
this.nickname = nickname; |
60 |
0 |
this.realname = displayname; |
61 |
0 |
} |
62 |
|
|
63 |
|
public IrcConfiguration copy() { |
64 |
|
try { |
65 |
0 |
return (IrcConfiguration) clone(); |
66 |
|
} |
67 |
0 |
catch (CloneNotSupportedException e) { |
68 |
0 |
throw new RuntimeCamelException(e); |
69 |
|
} |
70 |
|
} |
71 |
|
|
72 |
|
public String getCacheKey() { |
73 |
0 |
return hostname + ":" + nickname; |
74 |
|
} |
75 |
|
|
76 |
|
public void configure(URI uri) { |
77 |
0 |
setNickname(uri.getUserInfo()); |
78 |
0 |
setUsername(uri.getUserInfo()); |
79 |
0 |
setRealname(uri.getUserInfo()); |
80 |
0 |
setHostname(uri.getHost()); |
81 |
0 |
setTarget(uri.getPath().substring(1)); |
82 |
0 |
} |
83 |
|
|
84 |
|
public String getHostname() { |
85 |
0 |
return hostname; |
86 |
|
} |
87 |
|
|
88 |
|
public void setHostname(String hostname) { |
89 |
0 |
this.hostname = hostname; |
90 |
0 |
} |
91 |
|
|
92 |
|
public String getPassword() { |
93 |
0 |
return password; |
94 |
|
} |
95 |
|
|
96 |
|
public void setPassword(String password) { |
97 |
0 |
this.password = password; |
98 |
0 |
} |
99 |
|
|
100 |
|
public String getNickname() { |
101 |
0 |
return nickname; |
102 |
|
} |
103 |
|
|
104 |
|
public void setNickname(String nickname) { |
105 |
0 |
this.nickname = nickname; |
106 |
0 |
} |
107 |
|
|
108 |
|
public String getRealname() { |
109 |
0 |
return realname; |
110 |
|
} |
111 |
|
|
112 |
|
public void setRealname(String realname) { |
113 |
0 |
this.realname = realname; |
114 |
0 |
} |
115 |
|
|
116 |
|
public String getUsername() { |
117 |
0 |
return username; |
118 |
|
} |
119 |
|
|
120 |
|
public void setUsername(String username) { |
121 |
0 |
this.username = username; |
122 |
0 |
} |
123 |
|
|
124 |
|
public int[] getPorts() { |
125 |
0 |
return ports; |
126 |
|
} |
127 |
|
|
128 |
|
public void setPorts(int[] ports) { |
129 |
0 |
this.ports = ports; |
130 |
0 |
} |
131 |
|
|
132 |
|
public String getTarget() { |
133 |
0 |
return target; |
134 |
|
} |
135 |
|
|
136 |
|
public void setTarget(String target) { |
137 |
0 |
this.target = target; |
138 |
0 |
} |
139 |
|
|
140 |
|
public boolean isPersistent() { |
141 |
0 |
return persistent; |
142 |
|
} |
143 |
|
|
144 |
|
public void setPersistent(boolean persistent) { |
145 |
0 |
this.persistent = persistent; |
146 |
0 |
} |
147 |
|
|
148 |
|
public boolean isColors() { |
149 |
0 |
return colors; |
150 |
|
} |
151 |
|
|
152 |
|
public void setColors(boolean colors) { |
153 |
0 |
this.colors = colors; |
154 |
0 |
} |
155 |
|
|
156 |
|
public boolean isOnNick() { |
157 |
0 |
return onNick; |
158 |
|
} |
159 |
|
|
160 |
|
public void setOnNick(boolean onNick) { |
161 |
0 |
this.onNick = onNick; |
162 |
0 |
} |
163 |
|
|
164 |
|
public boolean isOnQuit() { |
165 |
0 |
return onQuit; |
166 |
|
} |
167 |
|
|
168 |
|
public void setOnQuit(boolean onQuit) { |
169 |
0 |
this.onQuit = onQuit; |
170 |
0 |
} |
171 |
|
|
172 |
|
public boolean isOnJoin() { |
173 |
0 |
return onJoin; |
174 |
|
} |
175 |
|
|
176 |
|
public void setOnJoin(boolean onJoin) { |
177 |
0 |
this.onJoin = onJoin; |
178 |
0 |
} |
179 |
|
|
180 |
|
public boolean isOnKick() { |
181 |
0 |
return onKick; |
182 |
|
} |
183 |
|
|
184 |
|
public void setOnKick(boolean onKick) { |
185 |
0 |
this.onKick = onKick; |
186 |
0 |
} |
187 |
|
|
188 |
|
public boolean isOnMode() { |
189 |
0 |
return onMode; |
190 |
|
} |
191 |
|
|
192 |
|
public void setOnMode(boolean onMode) { |
193 |
0 |
this.onMode = onMode; |
194 |
0 |
} |
195 |
|
|
196 |
|
public boolean isOnPart() { |
197 |
0 |
return onPart; |
198 |
|
} |
199 |
|
|
200 |
|
public void setOnPart(boolean onPart) { |
201 |
0 |
this.onPart = onPart; |
202 |
0 |
} |
203 |
|
|
204 |
|
public boolean isOnTopic() { |
205 |
0 |
return onTopic; |
206 |
|
} |
207 |
|
|
208 |
|
public void setOnTopic(boolean onTopic) { |
209 |
0 |
this.onTopic = onTopic; |
210 |
0 |
} |
211 |
|
|
212 |
|
public boolean isOnPrivmsg() { |
213 |
0 |
return onPrivmsg; |
214 |
|
} |
215 |
|
|
216 |
|
public void setOnPrivmsg(boolean onPrivmsg) { |
217 |
0 |
this.onPrivmsg = onPrivmsg; |
218 |
0 |
} |
219 |
|
|
220 |
|
public String toString() { |
221 |
0 |
return "IrcConfiguration{" + |
222 |
|
"target='" + target + '\'' + |
223 |
|
", hostname='" + hostname + '\'' + |
224 |
|
", password='" + password + '\'' + |
225 |
|
", nickname='" + nickname + '\'' + |
226 |
|
", realname='" + realname + '\'' + |
227 |
|
", username='" + username + '\'' + |
228 |
|
", persistent=" + persistent + |
229 |
|
", colors=" + colors + |
230 |
|
", onNick=" + onNick + |
231 |
|
", onQuit=" + onQuit + |
232 |
|
", onJoin=" + onJoin + |
233 |
|
", onKick=" + onKick + |
234 |
|
", onMode=" + onMode + |
235 |
|
", onPart=" + onPart + |
236 |
|
", onTopic=" + onTopic + |
237 |
|
", onPrivmsg=" + onPrivmsg + |
238 |
|
", ports=" + ports + |
239 |
|
'}'; |
240 |
|
} |
241 |
|
} |