IFriendsModule.cs 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System.Collections.Generic;
  28. using OpenMetaverse;
  29. using OpenSim.Framework;
  30. using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
  31. namespace OpenSim.Region.Framework.Interfaces
  32. {
  33. public interface IFriendsModule
  34. {
  35. /// <summary>
  36. /// Are friends cached on this simulator for a particular user?
  37. /// </summary>
  38. /// <param name="userID"></param>
  39. /// <returns></returns>
  40. bool AreFriendsCached(UUID userID);
  41. /// <summary>
  42. /// Get friends from local cache only
  43. /// </summary>
  44. /// <param name="userID"></param>
  45. /// <returns>
  46. /// An empty array if the user has no friends or friends have not been cached.
  47. /// </returns>
  48. FriendInfo[] GetFriendsFromCache(UUID userID);
  49. /// <summary>
  50. /// Add a friendship between two users.
  51. /// </summary>
  52. /// <remarks>
  53. /// Ultimately, it would be more useful to take in a user account here rather than having to have a user
  54. /// present in the scene.
  55. /// </remarks>
  56. /// <param name="client"></param>
  57. /// <param name="friendID"></param>
  58. void AddFriendship(IClientAPI client, UUID friendID);
  59. /// <summary>
  60. /// Remove a friendship between two users.
  61. /// </summary>
  62. /// <remarks>
  63. /// Ultimately, it would be more useful to take in a user account here rather than having to have a user
  64. /// present in the scene.
  65. /// </remarks>
  66. /// <param name="client"></param>
  67. /// <param name="exFriendID"></param>
  68. void RemoveFriendship(IClientAPI client, UUID exFriendID);
  69. /// <summary>
  70. /// Get permissions granted by a friend.
  71. /// </summary>
  72. /// <param name="userID">The user.</param>
  73. /// <param name="friendID">The friend that granted.</param>
  74. /// <returns>The permissions. These come from the FriendRights enum.</returns>
  75. int GetRightsGrantedByFriend(UUID userID, UUID friendID);
  76. /// <summary>
  77. /// Grant permissions for a friend.
  78. /// </summary>
  79. /// <remarks>
  80. /// This includes giving them the ability to see when the user is online and permission to edit the user's
  81. /// objects.
  82. /// Granting lower permissions than the friend currently has will rescind the extra permissions.
  83. /// </remarks>
  84. /// <param name="remoteClient">The user granting the permissions.</param>
  85. /// <param name="friendID">The friend.</param>
  86. /// <param name="perms">These come from the FriendRights enum.</param>
  87. void GrantRights(IClientAPI remoteClient, UUID friendID, int perms);
  88. bool SendFriendsOnlineIfNeeded(IClientAPI client);
  89. }
  90. }