IXGroupData.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 System.Collections.Generic;
  29. using OpenMetaverse;
  30. using OpenSim.Framework;
  31. namespace OpenSim.Data
  32. {
  33. public class XGroup
  34. {
  35. public UUID groupID;
  36. public UUID ownerRoleID;
  37. public string name;
  38. public string charter;
  39. public bool showInList;
  40. public UUID insigniaID;
  41. public int membershipFee;
  42. public bool openEnrollment;
  43. public bool allowPublish;
  44. public bool maturePublish;
  45. public UUID founderID;
  46. public ulong everyonePowers;
  47. public ulong ownersPowers;
  48. public Dictionary<UUID, XGroupMember> members = new Dictionary<UUID, XGroupMember>();
  49. public Dictionary<UUID, XGroupNotice> notices = new Dictionary<UUID, XGroupNotice>();
  50. public XGroup Clone()
  51. {
  52. XGroup clone = (XGroup)MemberwiseClone();
  53. clone.members = new Dictionary<UUID, XGroupMember>();
  54. clone.notices = new Dictionary<UUID, XGroupNotice>();
  55. foreach (KeyValuePair<UUID, XGroupMember> kvp in members)
  56. clone.members[kvp.Key] = kvp.Value.Clone();
  57. foreach (KeyValuePair<UUID, XGroupNotice> kvp in notices)
  58. clone.notices[kvp.Key] = kvp.Value.Clone();
  59. return clone;
  60. }
  61. }
  62. public class XGroupMember
  63. {
  64. public UUID agentID;
  65. public UUID groupID;
  66. public UUID roleID;
  67. public bool acceptNotices = true;
  68. public bool listInProfile = true;
  69. public XGroupMember Clone()
  70. {
  71. return (XGroupMember)MemberwiseClone();
  72. }
  73. }
  74. public class XGroupNotice
  75. {
  76. public UUID groupID;
  77. public UUID noticeID;
  78. public uint timestamp;
  79. public string fromName;
  80. public string subject;
  81. public string message;
  82. public byte[] binaryBucket;
  83. public bool hasAttachment;
  84. public int assetType;
  85. public XGroupNotice Clone()
  86. {
  87. XGroupNotice clone = (XGroupNotice)MemberwiseClone();
  88. clone.binaryBucket = (byte[])binaryBucket.Clone();
  89. return clone;
  90. }
  91. }
  92. /// <summary>
  93. /// Early stub interface for groups data, not final.
  94. /// </summary>
  95. /// <remarks>
  96. /// Currently in-use only for regression test purposes.
  97. /// </remarks>
  98. public interface IXGroupData
  99. {
  100. bool StoreGroup(XGroup group);
  101. XGroup GetGroup(UUID groupID);
  102. Dictionary<UUID, XGroup> GetGroups();
  103. bool DeleteGroup(UUID groupID);
  104. }
  105. }