opensim – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 eva 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  
28 using System;
29 using System.Collections;
30 using System.Collections.Generic;
31 using System.Reflection;
32 using log4net;
33 using Mono.Addins;
34 using Nini.Config;
35 using OpenMetaverse;
36 using OpenSim.Data;
37 using OpenSim.Data.Null;
38 using OpenSim.Framework;
39 using OpenSim.Region.Framework.Interfaces;
40 using OpenSim.Region.Framework.Scenes;
41 using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
42  
43 namespace OpenSim.Tests.Common.Mock
44 {
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
46 public class MockGroupsServicesConnector : ISharedRegionModule, IGroupsServicesConnector
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49  
50 IXGroupData m_data = new NullXGroupData(null, null);
51  
52 public string Name
53 {
54 get { return "MockGroupsServicesConnector"; }
55 }
56  
57 public Type ReplaceableInterface
58 {
59 get { return null; }
60 }
61  
62 public void Initialise(IConfigSource config)
63 {
64 }
65  
66 public void Close()
67 {
68 }
69  
70 public void AddRegion(Scene scene)
71 {
72 m_log.DebugFormat("[MOCK GROUPS SERVICES CONNECTOR]: Adding to region {0}", scene.RegionInfo.RegionName);
73 scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
74 }
75  
76 public void RemoveRegion(Scene scene)
77 {
78 }
79  
80 public void RegionLoaded(Scene scene)
81 {
82 }
83  
84 public void PostInitialise()
85 {
86 }
87  
88 public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID,
89 int membershipFee, bool openEnrollment, bool allowPublish,
90 bool maturePublish, UUID founderID)
91 {
92 XGroup group = new XGroup()
93 {
94 groupID = UUID.Random(),
95 ownerRoleID = UUID.Random(),
96 name = name,
97 charter = charter,
98 showInList = showInList,
99 insigniaID = insigniaID,
100 membershipFee = membershipFee,
101 openEnrollment = openEnrollment,
102 allowPublish = allowPublish,
103 maturePublish = maturePublish,
104 founderID = founderID,
105 everyonePowers = (ulong)XmlRpcGroupsServicesConnectorModule.DefaultEveryonePowers,
106 ownersPowers = (ulong)XmlRpcGroupsServicesConnectorModule.DefaultOwnerPowers
107 };
108  
109 if (m_data.StoreGroup(group))
110 {
111 m_log.DebugFormat("[MOCK GROUPS SERVICES CONNECTOR]: Created group {0} {1}", group.name, group.groupID);
112 return group.groupID;
113 }
114 else
115 {
116 m_log.ErrorFormat("[MOCK GROUPS SERVICES CONNECTOR]: Failed to create group {0}", name);
117 return UUID.Zero;
118 }
119 }
120  
121 public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList,
122 UUID insigniaID, int membershipFee, bool openEnrollment,
123 bool allowPublish, bool maturePublish)
124 {
125 }
126  
127 public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
128 string title, ulong powers)
129 {
130 }
131  
132 public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID)
133 {
134 }
135  
136 public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
137 string title, ulong powers)
138 {
139 }
140  
141 public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID groupID, string groupName)
142 {
143 m_log.DebugFormat(
144 "[MOCK GROUPS SERVICES CONNECTOR]: Processing GetGroupRecord() for groupID {0}, name {1}",
145 groupID, groupName);
146  
147 XGroup[] groups;
148 string field, val;
149  
150 if (groupID != UUID.Zero)
151 {
152 field = "groupID";
153 val = groupID.ToString();
154 }
155 else
156 {
157 field = "name";
158 val = groupName;
159 }
160  
161 groups = m_data.GetGroups(field, val);
162  
163 if (groups.Length == 0)
164 return null;
165  
166 XGroup xg = groups[0];
167  
168 GroupRecord gr = new GroupRecord()
169 {
170 GroupID = xg.groupID,
171 GroupName = xg.name,
172 AllowPublish = xg.allowPublish,
173 MaturePublish = xg.maturePublish,
174 Charter = xg.charter,
175 FounderID = xg.founderID,
176 // FIXME: group picture storage location unknown
177 MembershipFee = xg.membershipFee,
178 OpenEnrollment = xg.openEnrollment,
179 OwnerRoleID = xg.ownerRoleID,
180 ShowInList = xg.showInList
181 };
182  
183 return gr;
184 }
185  
186 public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID)
187 {
188 return default(GroupProfileData);
189 }
190  
191 public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
192 {
193 }
194  
195 public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
196 {
197 }
198  
199 public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile)
200 {
201 }
202  
203 public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID)
204 {
205 }
206  
207 public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
208 {
209 return null;
210 }
211  
212 public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
213 {
214 }
215  
216 public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
217 {
218 }
219  
220 public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
221 {
222 }
223  
224 public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
225 {
226 }
227  
228 public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
229 {
230 }
231  
232 public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search)
233 {
234 return null;
235 }
236  
237 public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID)
238 {
239 return null;
240 }
241  
242 public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID)
243 {
244 return null;
245 }
246  
247 public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID)
248 {
249 return new List<GroupMembershipData>();
250 }
251  
252 public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID)
253 {
254 return null;
255 }
256  
257 public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID)
258 {
259 return null;
260 }
261  
262 public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID)
263 {
264 return null;
265 }
266  
267 public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
268 {
269 return null;
270 }
271  
272 public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID)
273 {
274 return null;
275 }
276  
277 public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
278 {
279 return null;
280 }
281  
282 public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
283 {
284 }
285  
286 public void ResetAgentGroupChatSessions(UUID agentID)
287 {
288 }
289  
290 public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID)
291 {
292 return false;
293 }
294  
295 public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID)
296 {
297 return false;
298 }
299  
300 public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID)
301 {
302 }
303  
304 public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID)
305 {
306 }
307 }
308 }