aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs352
1 files changed, 173 insertions, 179 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs
index 9f45fd0..3d9477f 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs
@@ -73,19 +73,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
73 private static readonly ILog m_log = 73 private static readonly ILog m_log =
74 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 74 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
75 75
76 private List<Scene> m_SceneList = new List<Scene>(); 76 private List<Scene> m_sceneList = new List<Scene>();
77 77
78 // This only works when running as non-Shared, in shared, there may be multiple IClientAPIs for a single client 78 // This only works when running as non-Shared, in shared, there may be multiple IClientAPIs for a single client
79 private Dictionary<UUID, IClientAPI> m_ActiveClients = new Dictionary<UUID, IClientAPI>(); 79 private Dictionary<UUID, IClientAPI> m_activeClients = new Dictionary<UUID, IClientAPI>();
80 80
81 private IMessageTransferModule m_MsgTransferModule = null; 81 private IMessageTransferModule m_msgTransferModule = null;
82 82
83 private IGroupDataProvider m_groupData = null; 83 private IGroupDataProvider m_groupData = null;
84 84
85 // Configuration settings 85 // Configuration settings
86 private const string m_defaultXmlRpcServiceURL = "http://osflotsam.org/xmlrpc.php"; 86 private const string m_defaultXmlRpcServiceURL = "http://osflotsam.org/xmlrpc.php";
87 private bool m_GroupsEnabled = false; 87 private bool m_groupsEnabled = false;
88 private bool m_GroupNoticesEnabled = true; 88 private bool m_groupNoticesEnabled = true;
89 private bool m_debugEnabled = true; 89 private bool m_debugEnabled = true;
90 90
91 #region IRegionModule Members 91 #region IRegionModule Members
@@ -104,8 +104,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
104 } 104 }
105 else 105 else
106 { 106 {
107 m_GroupsEnabled = groupsConfig.GetBoolean("Enabled", false); 107 m_groupsEnabled = groupsConfig.GetBoolean("Enabled", false);
108 if (!m_GroupsEnabled) 108 if (!m_groupsEnabled)
109 { 109 {
110 m_log.Info("[GROUPS]: Groups disabled in configuration"); 110 m_log.Info("[GROUPS]: Groups disabled in configuration");
111 return; 111 return;
@@ -114,7 +114,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
114 if (groupsConfig.GetString("Module", "Default") != "XmlRpcGroups") 114 if (groupsConfig.GetString("Module", "Default") != "XmlRpcGroups")
115 { 115 {
116 m_log.Info("[GROUPS]: Config Groups Module not set to XmlRpcGroups"); 116 m_log.Info("[GROUPS]: Config Groups Module not set to XmlRpcGroups");
117 m_GroupsEnabled = false; 117 m_groupsEnabled = false;
118 118
119 return; 119 return;
120 } 120 }
@@ -125,7 +125,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
125 m_groupData = new XmlRpcGroupDataProvider(ServiceURL, DisableKeepAlive); 125 m_groupData = new XmlRpcGroupDataProvider(ServiceURL, DisableKeepAlive);
126 m_log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL); 126 m_log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL);
127 127
128 m_GroupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true); 128 m_groupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true);
129 m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); 129 m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true);
130 130
131 } 131 }
@@ -133,30 +133,30 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
133 133
134 public void AddRegion(Scene scene) 134 public void AddRegion(Scene scene)
135 { 135 {
136 if (m_GroupsEnabled) 136 if (m_groupsEnabled)
137 scene.RegisterModuleInterface<IGroupsModule>(this); 137 scene.RegisterModuleInterface<IGroupsModule>(this);
138 } 138 }
139 139
140 public void RegionLoaded(Scene scene) 140 public void RegionLoaded(Scene scene)
141 { 141 {
142 if (!m_GroupsEnabled) 142 if (!m_groupsEnabled)
143 return; 143 return;
144 144
145 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 145 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
146 146
147 m_MsgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>(); 147 m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>();
148 148
149 // No message transfer module, no notices, group invites, rejects, ejects, etc 149 // No message transfer module, no notices, group invites, rejects, ejects, etc
150 if (m_MsgTransferModule == null) 150 if (m_msgTransferModule == null)
151 { 151 {
152 m_GroupsEnabled = false; 152 m_groupsEnabled = false;
153 m_log.Info("[GROUPS]: Could not get MessageTransferModule"); 153 m_log.Info("[GROUPS]: Could not get MessageTransferModule");
154 Close(); 154 Close();
155 return; 155 return;
156 } 156 }
157 157
158 158
159 m_SceneList.Add(scene); 159 m_sceneList.Add(scene);
160 160
161 scene.EventManager.OnNewClient += OnNewClient; 161 scene.EventManager.OnNewClient += OnNewClient;
162 scene.EventManager.OnClientClosed += OnClientClosed; 162 scene.EventManager.OnClientClosed += OnClientClosed;
@@ -166,17 +166,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
166 166
167 public void RemoveRegion(Scene scene) 167 public void RemoveRegion(Scene scene)
168 { 168 {
169 if (!m_GroupsEnabled) 169 if (!m_groupsEnabled)
170 return; 170 return;
171 171
172 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 172 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
173 173
174 m_SceneList.Remove(scene); 174 m_sceneList.Remove(scene);
175 } 175 }
176 176
177 public void Close() 177 public void Close()
178 { 178 {
179 if (!m_GroupsEnabled) 179 if (!m_groupsEnabled)
180 return; 180 return;
181 m_log.Debug("[GROUPS]: Shutting down XmlRpcGroups module."); 181 m_log.Debug("[GROUPS]: Shutting down XmlRpcGroups module.");
182 } 182 }
@@ -185,13 +185,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
185 { 185 {
186 get { return "XmlRpcGroupsModule"; } 186 get { return "XmlRpcGroupsModule"; }
187 } 187 }
188
189 #endregion 188 #endregion
190 189
191 private void UpdateAllClientsWithGroupInfo() 190 private void UpdateAllClientsWithGroupInfo()
192 { 191 {
193 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 192 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
194 foreach (IClientAPI client in m_ActiveClients.Values) 193 foreach (IClientAPI client in m_activeClients.Values)
195 { 194 {
196 UpdateClientWithGroupInfo(client); 195 UpdateClientWithGroupInfo(client);
197 } 196 }
@@ -220,45 +219,43 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
220 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 219 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
221 220
222 221
223 lock (m_ActiveClients) 222 lock (m_activeClients)
224 { 223 {
225 if (!m_ActiveClients.ContainsKey(client.AgentId)) 224 if (!m_activeClients.ContainsKey(client.AgentId))
226 { 225 {
227 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; 226 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
228 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; 227 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
229 client.OnDirFindQuery += OnDirFindQuery; 228 client.OnDirFindQuery += OnDirFindQuery;
230 client.OnInstantMessage += OnInstantMessage; 229 client.OnInstantMessage += OnInstantMessage;
231 230
232 m_ActiveClients.Add(client.AgentId, client); 231 m_activeClients.Add(client.AgentId, client);
233 } 232 }
234 } 233 }
235 234
236 UpdateClientWithGroupInfo(client); 235 UpdateClientWithGroupInfo(client);
237 } 236 }
238 private void OnClientClosed(UUID AgentId) 237
238 private void OnClientClosed(UUID agentId)
239 { 239 {
240 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 240 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
241 241
242 lock (m_ActiveClients) 242 lock (m_activeClients)
243 { 243 {
244 if (m_ActiveClients.ContainsKey(AgentId)) 244 if (m_activeClients.ContainsKey(agentId))
245 { 245 {
246 IClientAPI client = m_ActiveClients[AgentId]; 246 IClientAPI client = m_activeClients[agentId];
247 client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest; 247 client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
248 client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest; 248 client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
249 client.OnDirFindQuery -= OnDirFindQuery; 249 client.OnDirFindQuery -= OnDirFindQuery;
250 client.OnInstantMessage -= OnInstantMessage; 250 client.OnInstantMessage -= OnInstantMessage;
251 251
252 m_ActiveClients.Remove(AgentId); 252 m_activeClients.Remove(agentId);
253 } 253 }
254 else 254 else
255 { 255 {
256 m_log.InfoFormat("[GROUPS] Client closed that wasn't registered here."); 256 m_log.InfoFormat("[GROUPS] Client closed that wasn't registered here.");
257 } 257 }
258
259
260 } 258 }
261
262 } 259 }
263 260
264 261
@@ -266,35 +263,33 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
266 { 263 {
267 if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) 264 if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups)
268 { 265 {
269 m_log.InfoFormat("[GROUPS] {0} called with queryText({1}) queryFlags({2}) queryStart({3})", System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); 266 m_log.InfoFormat("[GROUPS] {0} called with queryText({1}) queryFlags({2}) queryStart({3})",
267 System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart);
270 268
271 remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(queryText).ToArray()); 269 remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(queryText).ToArray());
272 } 270 }
273
274 } 271 }
275 272
276 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, 273 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID agentID, UUID sessionID)
277 UUID AgentID, UUID SessionID)
278 { 274 {
279 m_log.InfoFormat("[GROUPS] {0} called with SessionID :: {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, SessionID); 275 m_log.InfoFormat("[GROUPS] {0} called with SessionID :: {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, sessionID);
280
281 276
282 UUID ActiveGroupID = UUID.Zero; 277 UUID activeGroupID = UUID.Zero;
283 string ActiveGroupTitle = string.Empty; 278 string activeGroupTitle = string.Empty;
284 string ActiveGroupName = string.Empty; 279 string activeGroupName = string.Empty;
285 ulong ActiveGroupPowers = (ulong)GroupPowers.None; 280 ulong activeGroupPowers = (ulong)GroupPowers.None;
286 281
287 GroupMembershipData membership = m_groupData.GetAgentActiveMembership(AgentID); 282 GroupMembershipData membership = m_groupData.GetAgentActiveMembership(agentID);
288 if (membership != null) 283 if (membership != null)
289 { 284 {
290 ActiveGroupID = membership.GroupID; 285 activeGroupID = membership.GroupID;
291 ActiveGroupTitle = membership.GroupTitle; 286 activeGroupTitle = membership.GroupTitle;
292 ActiveGroupPowers = membership.GroupPowers; 287 activeGroupPowers = membership.GroupPowers;
293 } 288 }
294 289
295 string firstname, lastname; 290 string firstname, lastname;
296 IClientAPI agent; 291 IClientAPI agent;
297 if (m_ActiveClients.TryGetValue(AgentID, out agent)) 292 if (m_activeClients.TryGetValue(agentID, out agent))
298 { 293 {
299 firstname = agent.FirstName; 294 firstname = agent.FirstName;
300 lastname = agent.LastName; 295 lastname = agent.LastName;
@@ -303,31 +298,30 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
303 lastname = "Unknown"; 298 lastname = "Unknown";
304 } 299 }
305 300
306 UpdateScenePresenceWithTitle(AgentID, ActiveGroupTitle); 301 UpdateScenePresenceWithTitle(agentID, activeGroupTitle);
307 302
308 remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname, 303 remoteClient.SendAgentDataUpdate(agentID, activeGroupID, firstname,
309 lastname, ActiveGroupPowers, ActiveGroupName, 304 lastname, activeGroupPowers, activeGroupName,
310 ActiveGroupTitle); 305 activeGroupTitle);
311 } 306 }
312 307
313 private void HandleUUIDGroupNameRequest(UUID GroupID,IClientAPI remote_client) 308 private void HandleUUIDGroupNameRequest(UUID groupID, IClientAPI remoteClient)
314 { 309 {
315 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 310 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
316 311
317 string GroupName; 312 string groupName;
318 313
319 GroupRecord group = m_groupData.GetGroupRecord(GroupID, null); 314 GroupRecord group = m_groupData.GetGroupRecord(groupID, null);
320 if (group != null) 315 if (group != null)
321 { 316 {
322 GroupName = group.GroupName; 317 groupName = group.GroupName;
323 } 318 }
324 else 319 else
325 { 320 {
326 GroupName = "Unknown"; 321 groupName = "Unknown";
327 } 322 }
328 323
329 324 remoteClient.SendGroupNameReply(groupID, groupName);
330 remote_client.SendGroupNameReply(GroupID, GroupName);
331 } 325 }
332 326
333 327
@@ -337,11 +331,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
337 331
338 332
339 // Group invitations 333 // Group invitations
340 if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) 334 if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) ||
335 (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
341 { 336 {
342 m_log.WarnFormat("[GROUPS] Received an IIM for {0}.", ((InstantMessageDialog)im.dialog).ToString()); 337 m_log.WarnFormat("[GROUPS] Received an IIM for {0}.", ((InstantMessageDialog)im.dialog).ToString());
343 338
344
345 UUID inviteID = new UUID(im.imSessionID); 339 UUID inviteID = new UUID(im.imSessionID);
346 GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(inviteID); 340 GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(inviteID);
347 341
@@ -359,7 +353,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
359 // and the sessionid is the role 353 // and the sessionid is the role
360 m_groupData.AddAgentToGroup(inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID); 354 m_groupData.AddAgentToGroup(inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID);
361 355
362 if (m_MsgTransferModule != null) 356 if (m_msgTransferModule != null)
363 { 357 {
364 GridInstantMessage msg = new GridInstantMessage(); 358 GridInstantMessage msg = new GridInstantMessage();
365 msg.imSessionID = UUID.Zero.Guid; 359 msg.imSessionID = UUID.Zero.Guid;
@@ -376,7 +370,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
376 msg.RegionID = UUID.Zero.Guid; 370 msg.RegionID = UUID.Zero.Guid;
377 msg.binaryBucket = new byte[0]; 371 msg.binaryBucket = new byte[0];
378 372
379 m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); 373 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
380 } 374 }
381 375
382 UpdateAllClientsWithGroupInfo(); 376 UpdateAllClientsWithGroupInfo();
@@ -391,25 +385,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
391 m_groupData.RemoveAgentToGroupInvite(inviteID); 385 m_groupData.RemoveAgentToGroupInvite(inviteID);
392 386
393 } 387 }
394
395
396 } 388 }
397 } 389 }
398 390
399 // Group notices 391 // Group notices
400 if ((im.dialog == (byte)InstantMessageDialog.GroupNotice)) 392 if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
401 { 393 {
402 if (!m_GroupNoticesEnabled) 394 if (!m_groupNoticesEnabled)
403 { 395 {
404 return; 396 return;
405 } 397 }
406 398
407 UUID GroupID = new UUID(im.toAgentID); 399 UUID groupID = new UUID(im.toAgentID);
408 if (m_groupData.GetGroupRecord(GroupID, null) != null) 400 if (m_groupData.GetGroupRecord(groupID, null) != null)
409 { 401 {
410 UUID NoticeID = UUID.Random(); 402 UUID noticeID = UUID.Random();
411 string Subject = im.message.Substring(0, im.message.IndexOf('|')); 403 string subject = im.message.Substring(0, im.message.IndexOf('|'));
412 string Message = im.message.Substring(Subject.Length + 1); 404 string message = im.message.Substring(subject.Length + 1);
413 405
414 byte[] bucket; 406 byte[] bucket;
415 407
@@ -418,7 +410,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
418 bucket = new byte[19]; 410 bucket = new byte[19];
419 bucket[0] = 0; //dunno 411 bucket[0] = 0; //dunno
420 bucket[1] = 0; //dunno 412 bucket[1] = 0; //dunno
421 GroupID.ToBytes(bucket, 2); 413 groupID.ToBytes(bucket, 2);
422 bucket[18] = 0; //dunno 414 bucket[18] = 0; //dunno
423 } 415 }
424 else 416 else
@@ -438,33 +430,30 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
438 bucket = new byte[19]; 430 bucket = new byte[19];
439 bucket[0] = 0; //dunno 431 bucket[0] = 0; //dunno
440 bucket[1] = 0; //dunno 432 bucket[1] = 0; //dunno
441 GroupID.ToBytes(bucket, 2); 433 groupID.ToBytes(bucket, 2);
442 bucket[18] = 0; //dunno 434 bucket[18] = 0; //dunno
443 } 435 }
444 436
445 437
446 m_groupData.AddGroupNotice(GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); 438 m_groupData.AddGroupNotice(groupID, noticeID, im.fromAgentName, subject, message, bucket);
447 if (OnNewGroupNotice != null) 439 if (OnNewGroupNotice != null)
448 { 440 {
449 OnNewGroupNotice(GroupID, NoticeID); 441 OnNewGroupNotice(groupID, noticeID);
450 } 442 }
451 443
452 // Build notice IIM 444 // Build notice IIM
453 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); 445 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, noticeID,
446 (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
454 447
455 // Send notice out to everyone that wants notices 448 // Send notice out to everyone that wants notices
456 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GroupID)) 449 foreach (GroupMembersData member in m_groupData.GetGroupMembers(groupID))
457 { 450 {
458 if (member.AcceptNotices) 451 if (member.AcceptNotices)
459 { 452 {
460 msg.toAgentID = member.AgentID.Guid; 453 msg.toAgentID = member.AgentID.Guid;
461 m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); 454 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) {});
462
463 } 455 }
464 } 456 }
465
466
467
468 } 457 }
469 } 458 }
470 459
@@ -473,30 +462,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
473 // TODO:FIXME: Use a presense server of some kind to find out where the 462 // TODO:FIXME: Use a presense server of some kind to find out where the
474 // client actually is, and try contacting that region directly to notify them, 463 // client actually is, and try contacting that region directly to notify them,
475 // or provide the notification via xmlrpc update queue 464 // or provide the notification via xmlrpc update queue
476 if ((im.dialog == 210)) 465 if (im.dialog == 210)
477 { 466 {
478 // This is sent from the region that the ejectee was ejected from 467 // This is sent from the region that the ejectee was ejected from
479 // if it's being delivered here, then the ejectee is here 468 // if it's being delivered here, then the ejectee is here
480 // so we need to send local updates to the agent. 469 // so we need to send local updates to the agent.
481 470 if (m_msgTransferModule != null)
482
483 if (m_MsgTransferModule != null)
484 { 471 {
485 im.dialog = (byte)InstantMessageDialog.MessageFromAgent; 472 im.dialog = (byte)InstantMessageDialog.MessageFromAgent;
486 m_MsgTransferModule.SendInstantMessage(im, delegate(bool success) { }); 473 m_msgTransferModule.SendInstantMessage(im, delegate(bool success) {});
487 } 474 }
488 475
489 UUID ejecteeID = new UUID(im.toAgentID); 476 UUID ejecteeID = new UUID(im.toAgentID);
490 UUID groupID = new UUID(im.toAgentID); 477 UUID groupID = new UUID(im.toAgentID);
491 if (m_ActiveClients.ContainsKey(ejecteeID)) 478 if (m_activeClients.ContainsKey(ejecteeID))
492 { 479 {
493 m_ActiveClients[ejecteeID].SendAgentDropGroup(groupID); 480 m_activeClients[ejecteeID].SendAgentDropGroup(groupID);
494 } 481 }
495
496 } 482 }
497
498
499
500 } 483 }
501 484
502 private void OnGridInstantMessage(GridInstantMessage msg) 485 private void OnGridInstantMessage(GridInstantMessage msg)
@@ -506,7 +489,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
506 // Trigger the above event handler 489 // Trigger the above event handler
507 OnInstantMessage(null, msg); 490 OnInstantMessage(null, msg);
508 491
509
510 // If a message from a group arrives here, it may need to be forwarded to a local client 492 // If a message from a group arrives here, it may need to be forwarded to a local client
511 if (msg.fromGroup == true) 493 if (msg.fromGroup == true)
512 { 494 {
@@ -515,32 +497,30 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
515 case (byte)InstantMessageDialog.GroupInvitation: 497 case (byte)InstantMessageDialog.GroupInvitation:
516 case (byte)InstantMessageDialog.GroupNotice: 498 case (byte)InstantMessageDialog.GroupNotice:
517 UUID toAgentID = new UUID(msg.toAgentID); 499 UUID toAgentID = new UUID(msg.toAgentID);
518 if (m_ActiveClients.ContainsKey(toAgentID)) 500 if (m_activeClients.ContainsKey(toAgentID))
519 { 501 {
520 m_ActiveClients[toAgentID].SendInstantMessage(msg); 502 m_activeClients[toAgentID].SendInstantMessage(msg);
521 } 503 }
522 break; 504 break;
523 } 505 }
524 } 506 }
525 507
526 } 508 }
527
528
529 #endregion 509 #endregion
530 510
531 511 private void UpdateScenePresenceWithTitle(UUID agentID, string title)
532 private void UpdateScenePresenceWithTitle(UUID AgentID, string Title)
533 { 512 {
534 m_log.DebugFormat("[GROUPS] Updating scene title for {0} with title: {1}", AgentID, Title); 513 m_log.DebugFormat("[GROUPS] Updating scene title for {0} with title: {1}", agentID, title);
514
535 ScenePresence presence = null; 515 ScenePresence presence = null;
536 lock (m_SceneList) 516 lock (m_sceneList)
537 { 517 {
538 foreach (Scene scene in m_SceneList) 518 foreach (Scene scene in m_sceneList)
539 { 519 {
540 presence = scene.GetScenePresence(AgentID); 520 presence = scene.GetScenePresence(agentID);
541 if (presence != null) 521 if (presence != null)
542 { 522 {
543 presence.Grouptitle = Title; 523 presence.Grouptitle = title;
544 524
545 // FixMe: Ter suggests a "Schedule" method that I can't find. 525 // FixMe: Ter suggests a "Schedule" method that I can't find.
546 presence.SendFullUpdateToAllClients(); 526 presence.SendFullUpdateToAllClients();
@@ -554,9 +534,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
554 534
555 public event NewGroupNotice OnNewGroupNotice; 535 public event NewGroupNotice OnNewGroupNotice;
556 536
557 public GroupRecord GetGroupRecord(UUID GroupID) 537 public GroupRecord GetGroupRecord(UUID groupID)
558 { 538 {
559 return m_groupData.GetGroupRecord(GroupID, null); 539 return m_groupData.GetGroupRecord(groupID, null);
560 } 540 }
561 541
562 public void ActivateGroup(IClientAPI remoteClient, UUID groupID) 542 public void ActivateGroup(IClientAPI remoteClient, UUID groupID)
@@ -608,7 +588,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
608 } 588 }
609 589
610 return data; 590 return data;
611
612 } 591 }
613 592
614 public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID) 593 public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID)
@@ -623,7 +602,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
623 } 602 }
624 603
625 return data; 604 return data;
626
627 } 605 }
628 606
629 public List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID) 607 public List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID)
@@ -638,8 +616,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
638 } 616 }
639 617
640 return data; 618 return data;
641
642
643 } 619 }
644 620
645 public GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID) 621 public GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID)
@@ -677,27 +653,30 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
677 return profile; 653 return profile;
678 } 654 }
679 655
680 public GroupMembershipData[] GetMembershipData(UUID UserID) 656 public GroupMembershipData[] GetMembershipData(UUID userID)
681 { 657 {
682 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 658 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
683 659
684 return m_groupData.GetAgentGroupMemberships(UserID).ToArray(); 660 return m_groupData.GetAgentGroupMemberships(userID).ToArray();
685 } 661 }
686 662
687 public GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID) 663 public GroupMembershipData GetMembershipData(UUID groupID, UUID userID)
688 { 664 {
689 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 665 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
690 666
691 return m_groupData.GetAgentGroupMembership(UserID, GroupID); 667 return m_groupData.GetAgentGroupMembership(userID, groupID);
692 } 668 }
693 669
694 public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) 670 public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter,
671 bool showInList, UUID insigniaID, int membershipFee,
672 bool openEnrollment, bool allowPublish, bool maturePublish)
695 { 673 {
696 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 674 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
697 675
698 // TODO: Security Check? 676 // TODO: Security Check?
699 677
700 m_groupData.UpdateGroup(groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish); 678 m_groupData.UpdateGroup(groupID, charter, showInList, insigniaID, membershipFee,
679 openEnrollment, allowPublish, maturePublish);
701 } 680 }
702 681
703 public void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile) 682 public void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile)
@@ -708,7 +687,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
708 m_groupData.SetAgentGroupInfo(remoteClient.AgentId, groupID, acceptNotices, listInProfile); 687 m_groupData.SetAgentGroupInfo(remoteClient.AgentId, groupID, acceptNotices, listInProfile);
709 } 688 }
710 689
711 public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) 690 public UUID CreateGroup(IClientAPI remoteClient, string name, string charter,
691 bool showInList, UUID insigniaID, int membershipFee,
692 bool openEnrollment, bool allowPublish, bool maturePublish)
712 { 693 {
713 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 694 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
714 695
@@ -718,22 +699,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
718 return UUID.Zero; 699 return UUID.Zero;
719 } 700 }
720 701
721 UUID GroupID = m_groupData.CreateGroup(name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, remoteClient.AgentId); 702 UUID groupID = m_groupData.CreateGroup(name, charter, showInList, insigniaID, membershipFee,
703 openEnrollment, allowPublish, maturePublish, remoteClient.AgentId);
722 704
723 remoteClient.SendCreateGroupReply(GroupID, true, "Group created successfullly"); 705 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");
724 706
725 UpdateClientWithGroupInfo(remoteClient); 707 UpdateClientWithGroupInfo(remoteClient);
726 708
727 return GroupID; 709 return groupID;
728 } 710 }
729 711
730 public GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID) 712 public GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID groupID)
731 { 713 {
732 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 714 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
733 715
734 // ToDo: check if agent is a member of group and is allowed to see notices? 716 // ToDo: check if agent is a member of group and is allowed to see notices?
735 717
736 return m_groupData.GetGroupNotices(GroupID).ToArray(); 718 return m_groupData.GetGroupNotices(groupID).ToArray();
737 } 719 }
738 720
739 /// <summary> 721 /// <summary>
@@ -754,17 +736,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
754 /// <summary> 736 /// <summary>
755 /// Change the current Active Group Role for Agent 737 /// Change the current Active Group Role for Agent
756 /// </summary> 738 /// </summary>
757 public void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID) 739 public void GroupTitleUpdate(IClientAPI remoteClient, UUID groupID, UUID titleRoleID)
758 { 740 {
759 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 741 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
760 742
761 m_groupData.SetAgentActiveGroupRole(remoteClient.AgentId, GroupID, TitleRoleID); 743 m_groupData.SetAgentActiveGroupRole(remoteClient.AgentId, groupID, titleRoleID);
762 744
763 UpdateAllClientsWithGroupInfo(); 745 UpdateAllClientsWithGroupInfo();
764 } 746 }
765 747
766 748
767 public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, byte updateType) 749 public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID,
750 string name, string description, string title, ulong powers, byte updateType)
768 { 751 {
769 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 752 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
770 753
@@ -829,7 +812,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
829 812
830 if (data != null) 813 if (data != null)
831 { 814 {
832 if (m_MsgTransferModule != null) 815 if (m_msgTransferModule != null)
833 { 816 {
834 GridInstantMessage msg = new GridInstantMessage(); 817 GridInstantMessage msg = new GridInstantMessage();
835 msg.imSessionID = UUID.Zero.Guid; 818 msg.imSessionID = UUID.Zero.Guid;
@@ -846,7 +829,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
846 msg.RegionID = UUID.Zero.Guid; 829 msg.RegionID = UUID.Zero.Guid;
847 msg.binaryBucket = data.BinaryBucket; 830 msg.binaryBucket = data.BinaryBucket;
848 831
849 m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); 832 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
850 } 833 }
851 } 834 }
852 835
@@ -899,32 +882,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
899 UpdateClientWithGroupInfo(remoteClient); 882 UpdateClientWithGroupInfo(remoteClient);
900 } 883 }
901 884
902 public void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID) 885 public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID)
903 { 886 {
904 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 887 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
905 888
906 m_groupData.RemoveAgentFromGroup(remoteClient.AgentId, GroupID); 889 m_groupData.RemoveAgentFromGroup(remoteClient.AgentId, groupID);
907 890
908 remoteClient.SendLeaveGroupReply(GroupID, true); 891 remoteClient.SendLeaveGroupReply(groupID, true);
909 892
910 remoteClient.SendAgentDropGroup(GroupID); 893 remoteClient.SendAgentDropGroup(groupID);
911 894
912 UpdateClientWithGroupInfo(remoteClient); 895 UpdateClientWithGroupInfo(remoteClient);
913 } 896 }
914 897
915 public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID) 898 public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID)
916 { 899 {
917 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 900 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
918 901
919 // Todo: Security check? 902 // Todo: Security check?
920 m_groupData.RemoveAgentFromGroup(EjecteeID, GroupID); 903 m_groupData.RemoveAgentFromGroup(ejecteeID, groupID);
921 904
922 remoteClient.SendEjectGroupMemberReply(remoteClient.AgentId, GroupID, true); 905 remoteClient.SendEjectGroupMemberReply(remoteClient.AgentId, groupID, true);
923 906
924 if (m_MsgTransferModule != null) 907 if (m_msgTransferModule != null)
925 { 908 {
926 GroupRecord groupInfo = m_groupData.GetGroupRecord(GroupID, null); 909 GroupRecord groupInfo = m_groupData.GetGroupRecord(groupID, null);
927 UserProfileData userProfile = m_SceneList[0].CommsManager.UserService.GetUserProfile(EjecteeID); 910 UserProfileData userProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(ejecteeID);
928 911
929 if ((groupInfo == null) || (userProfile == null)) 912 if ((groupInfo == null) || (userProfile == null))
930 { 913 {
@@ -938,7 +921,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
938 msg.imSessionID = UUID.Zero.Guid; 921 msg.imSessionID = UUID.Zero.Guid;
939 msg.fromAgentID = remoteClient.AgentId.Guid; 922 msg.fromAgentID = remoteClient.AgentId.Guid;
940 // msg.fromAgentID = info.GroupID; 923 // msg.fromAgentID = info.GroupID;
941 msg.toAgentID = EjecteeID.Guid; 924 msg.toAgentID = ejecteeID.Guid;
942 //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); 925 //msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
943 msg.timestamp = 0; 926 msg.timestamp = 0;
944 msg.fromAgentName = remoteClient.Name; 927 msg.fromAgentName = remoteClient.Name;
@@ -950,7 +933,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
950 msg.Position = Vector3.Zero; 933 msg.Position = Vector3.Zero;
951 msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; 934 msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid;
952 msg.binaryBucket = new byte[0]; 935 msg.binaryBucket = new byte[0];
953 m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { m_log.DebugFormat("[GROUPS] Message Sent Success: {0}", success,ToString()); }); 936 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success)
937 {
938 m_log.DebugFormat("[GROUPS] Message Sent Success: {0}",
939 success,ToString());
940 });
954 941
955 942
956 // Message to ejector 943 // Message to ejector
@@ -968,11 +955,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
968 msg.fromAgentName = remoteClient.Name; 955 msg.fromAgentName = remoteClient.Name;
969 if (userProfile != null) 956 if (userProfile != null)
970 { 957 {
971 msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, userProfile.Name); 958 msg.message = string.Format("{2} has been ejected from '{1}' by {0}.",
959 remoteClient.Name, groupInfo.GroupName, userProfile.Name);
972 } 960 }
973 else 961 else
974 { 962 {
975 msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, "Unknown member"); 963 msg.message = string.Format("{2} has been ejected from '{1}' by {0}.",
964 remoteClient.Name, groupInfo.GroupName, "Unknown member");
976 } 965 }
977 msg.dialog = (byte)210; //interop 966 msg.dialog = (byte)210; //interop
978 msg.fromGroup = false; 967 msg.fromGroup = false;
@@ -981,41 +970,42 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
981 msg.Position = Vector3.Zero; 970 msg.Position = Vector3.Zero;
982 msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; 971 msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid;
983 msg.binaryBucket = new byte[0]; 972 msg.binaryBucket = new byte[0];
984 m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { m_log.DebugFormat("[GROUPS] Message Sent Success: {0}", success, ToString()); }); 973 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success)
985 974 {
986 975 m_log.DebugFormat("[GROUPS] Message Sent Success: {0}",
987 976 success, ToString());
977 });
988 } 978 }
989 979
990
991 UpdateAllClientsWithGroupInfo(); 980 UpdateAllClientsWithGroupInfo();
992 } 981 }
993 982
994 public void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InvitedAgentID, UUID RoleID) 983 public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID)
995 { 984 {
996 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 985 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
997 m_log.WarnFormat("[GROUPS] GID {0}, AID {1}, RID {2} ", GroupID, InvitedAgentID, RoleID); 986 m_log.WarnFormat("[GROUPS] GID {0}, AID {1}, RID {2} ", groupID, invitedAgentID, roleID);
998 987
999 // Todo: Security check, probably also want to send some kind of notification 988 // Todo: Security check, probably also want to send some kind of notification
1000 UUID InviteID = UUID.Random(); 989 UUID inviteID = UUID.Random();
1001 m_log.WarnFormat("[GROUPS] Invite ID: {0}", InviteID); 990 m_log.WarnFormat("[GROUPS] Invite ID: {0}", inviteID);
1002 m_groupData.AddAgentToGroupInvite(InviteID, GroupID, RoleID, InvitedAgentID); 991 m_groupData.AddAgentToGroupInvite(inviteID, groupID, roleID, invitedAgentID);
1003 992
1004 if (m_MsgTransferModule != null) 993 if (m_msgTransferModule != null)
1005 { 994 {
1006 Guid inviteUUID = InviteID.Guid; 995 Guid inviteUUID = inviteID.Guid;
1007 996
1008 GridInstantMessage msg = new GridInstantMessage(); 997 GridInstantMessage msg = new GridInstantMessage();
1009 998
1010 msg.imSessionID = inviteUUID; 999 msg.imSessionID = inviteUUID;
1011 1000
1012 // msg.fromAgentID = remoteClient.AgentId.Guid; 1001 // msg.fromAgentID = remoteClient.AgentId.Guid;
1013 msg.fromAgentID = GroupID.Guid; 1002 msg.fromAgentID = groupID.Guid;
1014 msg.toAgentID = InvitedAgentID.Guid; 1003 msg.toAgentID = invitedAgentID.Guid;
1015 //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); 1004 //msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
1016 msg.timestamp = 0; 1005 msg.timestamp = 0;
1017 msg.fromAgentName = remoteClient.Name; 1006 msg.fromAgentName = remoteClient.Name;
1018 msg.message = string.Format("{0} has invited you to join a group. There is no cost to join this group.", remoteClient.Name); 1007 msg.message = string.Format("{0} has invited you to join a group. There is no cost to join this group.",
1008 remoteClient.Name);
1019 msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupInvitation; 1009 msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupInvitation;
1020 msg.fromGroup = true; 1010 msg.fromGroup = true;
1021 msg.offline = (byte)0; 1011 msg.offline = (byte)0;
@@ -1024,7 +1014,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1024 msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; 1014 msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid;
1025 msg.binaryBucket = new byte[20]; 1015 msg.binaryBucket = new byte[20];
1026 1016
1027 m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { m_log.DebugFormat("[GROUPS] Message Sent Success: {0}", success,ToString()); }); 1017 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success)
1018 {
1019 m_log.DebugFormat("[GROUPS] Message Sent Success: {0}", success,ToString());
1020 });
1028 } 1021 }
1029 } 1022 }
1030 1023
@@ -1034,42 +1027,43 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1034 { 1027 {
1035 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1028 if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1036 1029
1037 OSDArray AgentData = new OSDArray(1); 1030 OSDArray agentData = new OSDArray(1);
1038 OSDMap AgentDataMap = new OSDMap(1); 1031 OSDMap agentDataMap = new OSDMap(1);
1039 AgentDataMap.Add("AgentID", OSD.FromUUID(remoteClient.AgentId)); 1032 agentDataMap.Add("AgentID", OSD.FromUUID(remoteClient.AgentId));
1040 AgentData.Add(AgentDataMap); 1033 agentData.Add(agentDataMap);
1041 1034
1042 1035
1043 OSDArray GroupData = new OSDArray(data.Length); 1036 OSDArray groupData = new OSDArray(data.Length);
1044 OSDArray NewGroupData = new OSDArray(data.Length); 1037 OSDArray newGroupData = new OSDArray(data.Length);
1045 1038
1046 foreach (GroupMembershipData membership in data) 1039 foreach (GroupMembershipData membership in data)
1047 { 1040 {
1048 OSDMap GroupDataMap = new OSDMap(6); 1041 OSDMap groupDataMap = new OSDMap(6);
1049 OSDMap NewGroupDataMap = new OSDMap(1); 1042 OSDMap newGroupDataMap = new OSDMap(1);
1050 1043
1051 GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID)); 1044 groupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID));
1052 GroupDataMap.Add("GroupPowers", OSD.FromBinary(membership.GroupPowers)); 1045 groupDataMap.Add("GroupPowers", OSD.FromBinary(membership.GroupPowers));
1053 GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices)); 1046 groupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices));
1054 GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture)); 1047 groupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture));
1055 GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution)); 1048 groupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution));
1056 GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName)); 1049 groupDataMap.Add("GroupName", OSD.FromString(membership.GroupName));
1057 NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile)); 1050 newGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile));
1058 1051
1059 GroupData.Add(GroupDataMap); 1052 groupData.Add(groupDataMap);
1060 NewGroupData.Add(NewGroupDataMap); 1053 newGroupData.Add(newGroupDataMap);
1061 } 1054 }
1062 1055
1063 OSDMap llDataStruct = new OSDMap(3); 1056 OSDMap llDataStruct = new OSDMap(3);
1064 llDataStruct.Add("AgentData", AgentData); 1057 llDataStruct.Add("AgentData", agentData);
1065 llDataStruct.Add("GroupData", GroupData); 1058 llDataStruct.Add("GroupData", groupData);
1066 llDataStruct.Add("NewGroupData", NewGroupData); 1059 llDataStruct.Add("NewGroupData", newGroupData);
1067 1060
1068 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); 1061 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
1069 1062
1070 if (queue != null) 1063 if (queue != null)
1071 { 1064 {
1072 queue.Enqueue(EventQueueHelper.buildEvent("AgentGroupDataUpdate", llDataStruct), remoteClient.AgentId); 1065 queue.Enqueue(EventQueueHelper.buildEvent("AgentGroupDataUpdate", llDataStruct),
1066 remoteClient.AgentId);
1073 } 1067 }
1074 1068
1075 } 1069 }