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.

GroupChatUser.java 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Copyright (c) 2006-2015 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.interfaces;
  23. import com.dmdirc.events.DisplayProperty;
  24. import com.dmdirc.events.DisplayPropertyMap;
  25. import java.util.Comparator;
  26. import java.util.Optional;
  27. /**
  28. * Describes a {@link User} that is present on a {@link GroupChat}.
  29. */
  30. public interface GroupChatUser {
  31. /**
  32. * Retrieves the {@link User} object which this object corresponds
  33. * to.
  34. *
  35. * @return The User object which this object represents
  36. */
  37. User getUser();
  38. /**
  39. * Retrieves the {@link GroupChat} this {@link User} is on.
  40. *
  41. * @return The corresponding GroupChat object
  42. */
  43. GroupChat getGroupChat();
  44. /**
  45. * Returns the most important mode that the client holds in its prefix
  46. * form (e.g. @, +, etc)
  47. *
  48. * @return The most important mode the client holds, or an empty string
  49. */
  50. String getImportantMode();
  51. /**
  52. * Returns a list of all modes known to be held by the client, in their
  53. * textual form (e.g. o, v, etc)
  54. *
  55. * @return All modes the client holds, or an empty string
  56. */
  57. String getAllModes();
  58. /**
  59. * Retrieves the nickname or display name used by this client.
  60. *
  61. * @return This client's nickname
  62. */
  63. String getNickname();
  64. /**
  65. * Retrieves the nickname or display name used by this client, with their most important mode
  66. * prefixed.
  67. *
  68. * @return This client's nickname with their important mode prefixed (if any).
  69. */
  70. String getModePrefixedNickname();
  71. /**
  72. * Retrieves the username or ident used by this client.
  73. *
  74. * @return This client's username
  75. */
  76. Optional<String> getUsername();
  77. /**
  78. * Retrieves the hostname that this client is connecting from.
  79. *
  80. * @return This client's hostname
  81. */
  82. Optional<String> getHostname();
  83. /**
  84. * Retrieves the full/real name of the client.
  85. *
  86. * @return This client's real name
  87. */
  88. Optional<String> getRealname();
  89. /**
  90. * Retrieves a comparator that can compare the important modes of a client.
  91. *
  92. * @return Mode comparator
  93. */
  94. Comparator<String> getModeComparator();
  95. /**
  96. * Sets a property relating to how this {@link GroupChatUser} should be displayed.
  97. *
  98. * @param property The property to be set
  99. * @param value The value of the property
  100. * @param <T> The type of value that the property takes.
  101. */
  102. <T> void setDisplayProperty(final DisplayProperty<T> property, final T value);
  103. /**
  104. * Retrieves a property relating to how this {@link GroupChatUser} should be displayed.
  105. *
  106. * @param property The property to be retrieved.
  107. * @param <T> The type of value that the property takes.
  108. * @return An optional value for the property.
  109. */
  110. <T> Optional<T> getDisplayProperty(final DisplayProperty<T> property);
  111. /**
  112. * Removes a property relating to how this {@link GroupChatUser} should be displayed.
  113. */
  114. <T> void removeDisplayProperty(final DisplayProperty<T> property);
  115. /**
  116. * Gets the map of all display properties for this {@link GroupChatUser}.
  117. *
  118. * @return The map of display properties.
  119. */
  120. DisplayPropertyMap getDisplayProperties();
  121. }