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.

User.java 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * Copyright (c) 2006-2014 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 java.util.Collection;
  24. import java.util.Optional;
  25. /**
  26. * Holds information about a {@link User} on a {@link Connection}
  27. */
  28. public interface User {
  29. /**
  30. * Retrieves the nickname or display name used by this client.
  31. *
  32. * @return This client's nickname
  33. */
  34. String getNickname();
  35. /**
  36. * Sets the nickname for this client.
  37. *
  38. * @param nickname New nickname for this client
  39. */
  40. void setNickname(final String nickname);
  41. /**
  42. * Retrieves the username or ident used by this client.
  43. *
  44. * @return This client's username
  45. */
  46. Optional<String> getUsername();
  47. /**
  48. * Sets the username for this client.
  49. *
  50. * @param username New username
  51. */
  52. void setUsername(final Optional<String> username);
  53. /**
  54. * Retrieves the hostname that this client is connecting from.
  55. *
  56. * @return This client's hostname
  57. */
  58. Optional<String> getHostname();
  59. /**
  60. * Sets the hostname for this client.
  61. *
  62. * @param hostname New hostname
  63. */
  64. void setHostname(final Optional<String> hostname);
  65. /**
  66. * Retrieves the full/real name of the client.
  67. *
  68. * @return This client's real name
  69. */
  70. Optional<String> getRealname();
  71. /**
  72. * Sets the realname for the client.
  73. *
  74. * @param realname New realname
  75. */
  76. void setRealname(final Optional<String> realname);
  77. /**
  78. * Retries the {@link GroupChat}s the client is a member of.
  79. *
  80. * @return Collection of {@link GroupChat}s, may be empty
  81. */
  82. Collection<GroupChat> getGroupChats();
  83. /**
  84. * Adds a {@link GroupChat} to the list of {@link GroupChat}s this user is on.
  85. *
  86. * @param groupChat GroupChat to add
  87. */
  88. void addGroupChat(final GroupChat groupChat);
  89. /**
  90. * Deletes a {@link GroupChat} from the list of {@link GroupChat}s this user is on.
  91. *
  92. * @param groupChat GroupChat to add
  93. */
  94. void delGroupChat(final GroupChat groupChat);
  95. /**
  96. * Returns the away message for the client, if the away message is empty the user is not away.
  97. *
  98. * @return Optional.empty if the user is not away, wrapped away reason if they are
  99. */
  100. Optional<String> getAwayMessage();
  101. /**
  102. * Sets the away message for the client.
  103. *
  104. * @param awayMessage Optional.empty if the user is not away, wrapped away reason if they are
  105. */
  106. void setAwayMessage(final Optional<String> awayMessage);
  107. /**
  108. * Gets the {@link Connection} for this client.
  109. *
  110. * @return Non-Null connection for this connection
  111. */
  112. Connection getConnection();
  113. }