IGroupsMessagingModule.cs 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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;
  28. using OpenMetaverse;
  29. using OpenSim.Framework;
  30. namespace OpenSim.Region.Framework.Interfaces
  31. {
  32. /// <summary>
  33. /// Provide mechanisms for messaging groups.
  34. /// </summary>
  35. ///
  36. /// TODO: Provide a mechanism for receiving group messages as well as sending them
  37. ///
  38. public interface IGroupsMessagingModule
  39. {
  40. /// <summary>
  41. /// Start a group chat session.
  42. /// </summary>
  43. /// You must call this before calling SendMessageToGroup(). If a chat session for this group is already taking
  44. /// place then the agent will added to that session.
  45. /// <param name="agentID">
  46. /// A UUID that represents the agent being added. If you are agentless (e.g. you are
  47. /// a region module), then you can use any random ID.
  48. /// </param>
  49. /// <param name="groupID">
  50. /// The ID for the group to join. Currently, the session ID used is identical to the
  51. /// group ID.
  52. /// </param>
  53. /// <returns>
  54. /// True if the chat session was started successfully, false otherwise.
  55. /// </returns>
  56. bool StartGroupChatSession(UUID agentID, UUID groupID);
  57. /// <summary>
  58. /// Send a message to each member of a group whose chat session is active.
  59. /// </summary>
  60. /// <param name="im">
  61. /// The message itself. The fields that must be populated are
  62. ///
  63. /// imSessionID - Populate this with the group ID (session ID and group ID are currently identical)
  64. /// fromAgentName - Populate this with whatever arbitrary name you want to show up in the chat dialog
  65. /// message - The message itself
  66. /// dialog - This must be (byte)InstantMessageDialog.SessionSend
  67. /// </param>
  68. /// <param name="groupID"></param>
  69. void SendMessageToGroup(GridInstantMessage im, UUID groupID);
  70. /// <summary>
  71. /// Send a message to all the members of a group that fulfill a condition.
  72. /// </summary>
  73. /// <param name="im">
  74. /// The message itself. The fields that must be populated are
  75. ///
  76. /// imSessionID - Populate this with the group ID (session ID and group ID are currently identical)
  77. /// fromAgentName - Populate this with whatever arbitrary name you want to show up in the chat dialog
  78. /// message - The message itself
  79. /// dialog - This must be (byte)InstantMessageDialog.SessionSend
  80. /// </param>
  81. /// <param name="groupID"></param>
  82. /// <param name="sendingAgentForGroupCalls">
  83. /// The requesting agent to use when querying the groups service. Sometimes this is different from
  84. /// im.fromAgentID, with group notices, for example.
  85. /// </param>
  86. /// <param name="sendCondition">
  87. /// The condition that must be met by a member for the message to be sent. If null then the message is sent
  88. /// if the chat session is active.
  89. /// </param>
  90. void SendMessageToGroup(
  91. GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition);
  92. }
  93. }