Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

ChannelInfo.java 6.3KB

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