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