Java IRC bot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ServerInfo.java 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*
  2. * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc.parser.irc;
  23. /**
  24. * Contains Server information.
  25. *
  26. * @author Shane Mc Cormack
  27. * @author Chris Smith
  28. * @see IRCParser
  29. */
  30. public class ServerInfo {
  31. /**
  32. * A version number for this class. It should be changed whenever the class
  33. * structure is changed (or anything else that would prevent serialized
  34. * objects being unserialized with the new class).
  35. */
  36. private static final long serialVersionUID = 1;
  37. /** Server to connect to (Default: "irc.quakenet.org"). */
  38. private String host = "irc.quakenet.org";
  39. /** Port server listens on for client connections (Default: 6667). */
  40. private int port = 6667;
  41. /** Optional password needed to connect to server (Default: ""). */
  42. private String password = "";
  43. /** Is this an ssl-enabled server (Default: false). */
  44. private boolean isSSL = false;
  45. /** Are we using a socks proxy (Default: false). */
  46. private boolean useSocksProxy = false;
  47. /** Proxy server to connect to (Default: "127.0.0.1"). */
  48. private String proxyHost = "127.0.0.1";
  49. /** Port server listens on for client connections (Default: 8080). */
  50. private int proxyPort = 1080;
  51. /** Proxy username if required. */
  52. private String proxyUser = "";
  53. /** Proxy password if required. */
  54. private String proxyPass = "";
  55. /** Constructor using Default values. */
  56. public ServerInfo () { }
  57. /**
  58. * Constructor using specifed host, port and password, SSL/Proxy must be specifed separately.
  59. *
  60. * @param serverHost Host to use
  61. * @param serverPort Port to use
  62. * @param serverPass Password to use
  63. */
  64. public ServerInfo (final String serverHost, final int serverPort, final String serverPass) {
  65. host = serverHost;
  66. port = serverPort;
  67. password = serverPass;
  68. }
  69. /**
  70. * Set the hostname.
  71. *
  72. * @param newValue Value to set to.
  73. */
  74. public void setHost(final String newValue) { host = newValue; }
  75. /**
  76. * Get the hostname.
  77. *
  78. * @return Current hostname
  79. */
  80. public String getHost() { return host; }
  81. /**
  82. * Set the port.
  83. *
  84. * @param newValue Value to set to.
  85. */
  86. public void setPort(final int newValue) { port = newValue; }
  87. /**
  88. * Get the port.
  89. *
  90. * @return Current port
  91. */
  92. public int getPort() { return port; }
  93. /**
  94. * Set the password.
  95. *
  96. * @param newValue Value to set to.
  97. */
  98. public void setPassword(final String newValue) { password = newValue; }
  99. /**
  100. * Get the password.
  101. *
  102. * @return Current Password
  103. */
  104. public String getPassword() { return password; }
  105. /**
  106. * Set if the server uses ssl.
  107. *
  108. * @param newValue true if server uses ssl, else false
  109. */
  110. public void setSSL(final boolean newValue) { isSSL = newValue; }
  111. /**
  112. * Get if the server uses ssl.
  113. *
  114. * @return true if server uses ssl, else false
  115. */
  116. public boolean getSSL() { return isSSL; }
  117. /**
  118. * Set if we are connecting via a socks proxy.
  119. *
  120. * @param newValue true if we are using socks, else false
  121. */
  122. public void setUseSocks(final boolean newValue) { useSocksProxy = newValue; }
  123. /**
  124. * Get if we are connecting via a socks proxy.
  125. *
  126. * @return true if we are using socks, else false
  127. */
  128. public boolean getUseSocks() { return useSocksProxy; }
  129. /**
  130. * Set the Proxy hostname.
  131. *
  132. * @param newValue Value to set to.
  133. */
  134. public void setProxyHost(final String newValue) { proxyHost = newValue; }
  135. /**
  136. * Get the Proxy hostname.
  137. *
  138. * @return Current Proxy hostname
  139. */
  140. public String getProxyHost() { return proxyHost; }
  141. /**
  142. * Set the Proxy port.
  143. *
  144. * @param newValue Value to set to.
  145. */
  146. public void setProxyPort(final int newValue) { proxyPort = newValue; }
  147. /**
  148. * Get the Proxy port.
  149. *
  150. * @return Current Proxy port
  151. */
  152. public int getProxyPort() { return proxyPort; }
  153. /**
  154. * Set the Proxy username.
  155. *
  156. * @param newValue Value to set to.
  157. */
  158. public void setProxyUser(final String newValue) { proxyUser = newValue; }
  159. /**
  160. * Get the Proxy username.
  161. *
  162. * @return Current Proxy username
  163. */
  164. public String getProxyUser() { return proxyUser; }
  165. /**
  166. * Set the Proxy password.
  167. *
  168. * @param newValue Value to set to.
  169. */
  170. public void setProxyPass(final String newValue) { proxyPass = newValue; }
  171. /**
  172. * Get the Proxy password.
  173. *
  174. * @return Current Proxy password
  175. */
  176. public String getProxyPass() { return proxyPass; }
  177. }