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.

ChannelInfo.java 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. /*
  2. * Copyright (c) 2006-2017 DMDirc Developers
  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.interfaces;
  23. import com.dmdirc.parser.common.ChannelListModeItem;
  24. import java.util.Collection;
  25. import java.util.Map;
  26. /**
  27. * Holds information about a channel and allows various operations to be
  28. * performed on the channel.
  29. *
  30. * @since 0.6.3m2
  31. */
  32. public interface ChannelInfo {
  33. /**
  34. * Returns the name of this channel.
  35. *
  36. * @return The name of this channel
  37. */
  38. String getName();
  39. /**
  40. * Returns the password for this channel.
  41. *
  42. * @return The password for this channel
  43. */
  44. String getPassword();
  45. /**
  46. * Changes the topic of this channel.
  47. *
  48. * @param topic This channel's new topic
  49. */
  50. void setTopic(String topic);
  51. /**
  52. * Retrieves the current topic or subject of this channel.
  53. *
  54. * @return This channel's topic
  55. */
  56. String getTopic();
  57. /**
  58. * Retrieves the time the current topic was set, as a unix timestamp.
  59. *
  60. * @return The time the current topic was set
  61. */
  62. long getTopicTime();
  63. /**
  64. * Retrieves a textual description of the person or entity that set the
  65. * channel topic.
  66. *
  67. * @return The person that set the current topic
  68. */
  69. String getTopicSetter();
  70. /**
  71. * Retrieves a textual representation of the modes currently set on this
  72. * channel. This includes boolean and parameter modes, but not list modes.
  73. *
  74. * @return The current channel modes
  75. */
  76. String getModes();
  77. /**
  78. * Retrieves the value of the specified mode if it's set.
  79. *
  80. * @param mode The mode to retrieve
  81. * @return The value for the specified mode or an empty string if it's not set
  82. */
  83. String getMode(char mode);
  84. /**
  85. * Retrieves the known values for the specified list mode.
  86. *
  87. * @param mode The list mode to be retrieved
  88. * @return A collection of known list mode items
  89. */
  90. Collection<ChannelListModeItem> getListMode(char mode);
  91. /**
  92. * Sends the specified message to this channel.
  93. *
  94. * @param message The message to be sent
  95. */
  96. void sendMessage(final String message);
  97. /**
  98. * Sends the specified action to this channel.
  99. *
  100. * @param action The action to be sent
  101. */
  102. void sendAction(String action);
  103. /**
  104. * Parts this channel with the specified reason.
  105. *
  106. * @param reason The reason for parting
  107. */
  108. void part(String reason);
  109. /**
  110. * Sends a WHO request to get details about people who are on the channel.
  111. */
  112. void sendWho();
  113. /**
  114. * Adjust the modes on this channel. This method should queue modes to be
  115. * sent in one go, according to the configuration/behaviour of the backend
  116. * system. If fewer modes are altered than the queue accepts, the
  117. * flushModes() method must be called.
  118. *
  119. * @param add Whether to add or remove the specified mode
  120. * @param mode Character The character representation of the mode to be changed
  121. * @param parameter Optional parameter needed to make change
  122. */
  123. void alterMode(boolean add, final Character mode, String parameter);
  124. /**
  125. * Flushes any mode changes that have been queued by the
  126. * {@link #alterMode(boolean, Character, String)} method.
  127. */
  128. void flushModes();
  129. /**
  130. * Ask the server for all the list modes for this channel.
  131. *
  132. * @since 0.6.3
  133. */
  134. void requestListModes();
  135. /**
  136. * Retrieves a channel client information object corresponding to the
  137. * specified client.
  138. *
  139. * @param client The client whose channel client info object is being requested
  140. * @return A {@link ChannelClientInfo} object corresponding to the client
  141. */
  142. ChannelClientInfo getChannelClient(ClientInfo client);
  143. /**
  144. * Retrieves a channel client information object corresponding to the
  145. * specified client.
  146. *
  147. * @param client The name or other textual representation of the client
  148. * @return A {@link ChannelClientInfo} object corresponding to the client,
  149. * or null if none was found
  150. */
  151. ChannelClientInfo getChannelClient(String client);
  152. /**
  153. * Retrieves a channel client information object corresponding to the
  154. * specified client. If the client doesn't exist and the value of
  155. * <code>create</code> is <code>true</code>, a new fake client is created.
  156. *
  157. * @param client The name or other textual representation of the client
  158. * @param create Whether or not to create the client if it doesn't exist
  159. * @return A {@link ChannelClientInfo} object corresponding to the client
  160. */
  161. ChannelClientInfo getChannelClient(String client, boolean create);
  162. /**
  163. * Retrieves a collection of all known clients that are present on the
  164. * channel.
  165. *
  166. * @return A collection of known channel clients
  167. */
  168. Collection<ChannelClientInfo> getChannelClients();
  169. /**
  170. * Retrieves the number of clients known to exist in this channel.
  171. *
  172. * @return The number of clients known in this channel
  173. */
  174. int getChannelClientCount();
  175. /**
  176. * Retrieves a {@link Map} which can be used to store arbitrary data
  177. * about the channel client.
  178. *
  179. * @return A map used for storing arbitrary data
  180. */
  181. Map<Object, Object> getMap();
  182. /**
  183. * Retrieves the parser which created this ChannelInfo.
  184. *
  185. * @return This ChannelInfo's parser
  186. */
  187. Parser getParser();
  188. }