aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs106
1 files changed, 53 insertions, 53 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
index 4a98622..0be540d 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
@@ -28,8 +28,8 @@ using System;
28using System.Collections; 28using System.Collections;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using libsecondlife; 31using OpenMetaverse;
32using libsecondlife.Packets; 32using OpenMetaverse.Packets;
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
@@ -43,10 +43,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 private Dictionary<LLUUID, List<FriendListItem>> FriendLists = new Dictionary<LLUUID, List<FriendListItem>>(); 46 private Dictionary<UUID, List<FriendListItem>> FriendLists = new Dictionary<UUID, List<FriendListItem>>();
47 private Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>(); 47 private Dictionary<UUID, UUID> m_pendingFriendRequests = new Dictionary<UUID, UUID>();
48 private Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>(); 48 private Dictionary<UUID, ulong> m_rootAgents = new Dictionary<UUID, ulong>();
49 private Dictionary<LLUUID, List<StoredFriendListUpdate>> StoredFriendListUpdates = new Dictionary<LLUUID, List<StoredFriendListUpdate>>(); 49 private Dictionary<UUID, List<StoredFriendListUpdate>> StoredFriendListUpdates = new Dictionary<UUID, List<StoredFriendListUpdate>>();
50 50
51 private List<Scene> m_scene = new List<Scene>(); 51 private List<Scene> m_scene = new List<Scene>();
52 52
@@ -98,16 +98,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
98 98
99 if (requestData.ContainsKey("agent_id") && requestData.ContainsKey("notify_id") && requestData.ContainsKey("status")) 99 if (requestData.ContainsKey("agent_id") && requestData.ContainsKey("notify_id") && requestData.ContainsKey("status"))
100 { 100 {
101 LLUUID notifyAgentId = LLUUID.Zero; 101 UUID notifyAgentId = UUID.Zero;
102 LLUUID notifyAboutAgentId = LLUUID.Zero; 102 UUID notifyAboutAgentId = UUID.Zero;
103 bool notifyOnlineStatus = false; 103 bool notifyOnlineStatus = false;
104 104
105 if ((string)requestData["status"] == "TRUE") 105 if ((string)requestData["status"] == "TRUE")
106 notifyOnlineStatus = true; 106 notifyOnlineStatus = true;
107 107
108 Helpers.TryParse((string)requestData["notify_id"], out notifyAgentId); 108 UUID.TryParse((string)requestData["notify_id"], out notifyAgentId);
109 109
110 Helpers.TryParse((string)requestData["agent_id"], out notifyAboutAgentId); 110 UUID.TryParse((string)requestData["agent_id"], out notifyAboutAgentId);
111 m_log.InfoFormat("[PRESENCE]: Got presence update for {0}, and we're telling {1}, with a status {2}", notifyAboutAgentId.ToString(), notifyAgentId.ToString(), notifyOnlineStatus.ToString()); 111 m_log.InfoFormat("[PRESENCE]: Got presence update for {0}, and we're telling {1}, with a status {2}", notifyAboutAgentId.ToString(), notifyAgentId.ToString(), notifyOnlineStatus.ToString());
112 ScenePresence avatar = GetPresenceFromAgentID(notifyAgentId); 112 ScenePresence avatar = GetPresenceFromAgentID(notifyAgentId);
113 if (avatar != null) 113 if (avatar != null)
@@ -189,7 +189,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
189 189
190 } 190 }
191 191
192 private void doFriendListUpdateOnline(LLUUID AgentId) 192 private void doFriendListUpdateOnline(UUID AgentId)
193 { 193 {
194 List<FriendListItem> fl = new List<FriendListItem>(); 194 List<FriendListItem> fl = new List<FriendListItem>();
195 195
@@ -213,7 +213,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
213 } 213 }
214 } 214 }
215 215
216 List<LLUUID> UpdateUsers = new List<LLUUID>(); 216 List<UUID> UpdateUsers = new List<UUID>();
217 217
218 foreach (FriendListItem f in fl) 218 foreach (FriendListItem f in fl)
219 { 219 {
@@ -226,7 +226,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
226 } 226 }
227 } 227 }
228 } 228 }
229 foreach (LLUUID user in UpdateUsers) 229 foreach (UUID user in UpdateUsers)
230 { 230 {
231 ScenePresence av = GetPresenceFromAgentID(user); 231 ScenePresence av = GetPresenceFromAgentID(user);
232 if (av != null) 232 if (av != null)
@@ -245,7 +245,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
245 if (fli.Friend == AgentId) 245 if (fli.Friend == AgentId)
246 { 246 {
247 fli.onlinestatus = true; 247 fli.onlinestatus = true;
248 LLUUID[] Agents = new LLUUID[1]; 248 UUID[] Agents = new UUID[1];
249 Agents[0] = AgentId; 249 Agents[0] = AgentId;
250 av.ControllingClient.SendAgentOnline(Agents); 250 av.ControllingClient.SendAgentOnline(Agents);
251 251
@@ -266,7 +266,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
266 } 266 }
267 } 267 }
268 268
269 private void ClientLoggedOut(LLUUID AgentId) 269 private void ClientLoggedOut(UUID AgentId)
270 { 270 {
271 lock (m_rootAgents) 271 lock (m_rootAgents)
272 { 272 {
@@ -284,7 +284,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
284 lfli = FriendLists[AgentId]; 284 lfli = FriendLists[AgentId];
285 } 285 }
286 } 286 }
287 List<LLUUID> updateUsers = new List<LLUUID>(); 287 List<UUID> updateUsers = new List<UUID>();
288 foreach (FriendListItem fli in lfli) 288 foreach (FriendListItem fli in lfli)
289 { 289 {
290 if (fli.onlinestatus == true) 290 if (fli.onlinestatus == true)
@@ -352,7 +352,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
352 ScenePresence av = GetPresenceFromAgentID(updateUsers[i]); 352 ScenePresence av = GetPresenceFromAgentID(updateUsers[i]);
353 if (av != null) 353 if (av != null)
354 { 354 {
355 LLUUID[] agents = new LLUUID[1]; 355 UUID[] agents = new UUID[1];
356 agents[0] = AgentId; 356 agents[0] = AgentId;
357 av.ControllingClient.SendAgentOffline(agents); 357 av.ControllingClient.SendAgentOffline(agents);
358 } 358 }
@@ -364,7 +364,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
364 } 364 }
365 } 365 }
366 366
367 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, LLUUID regionID) 367 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
368 { 368 {
369 lock (m_rootAgents) 369 lock (m_rootAgents)
370 { 370 {
@@ -427,7 +427,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
427 } 427 }
428 } 428 }
429 429
430 private ScenePresence GetPresenceFromAgentID(LLUUID AgentID) 430 private ScenePresence GetPresenceFromAgentID(UUID AgentID)
431 { 431 {
432 ScenePresence returnAgent = null; 432 ScenePresence returnAgent = null;
433 lock (m_scene) 433 lock (m_scene)
@@ -451,11 +451,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
451 451
452 #region FriendRequestHandling 452 #region FriendRequestHandling
453 453
454 private void OnInstantMessage(IClientAPI client, LLUUID fromAgentID, 454 private void OnInstantMessage(IClientAPI client, UUID fromAgentID,
455 LLUUID fromAgentSession, LLUUID toAgentID, 455 UUID fromAgentSession, UUID toAgentID,
456 LLUUID imSessionID, uint timestamp, string fromAgentName, 456 UUID imSessionID, uint timestamp, string fromAgentName,
457 string message, byte dialog, bool fromGroup, byte offline, 457 string message, byte dialog, bool fromGroup, byte offline,
458 uint ParentEstateID, LLVector3 Position, LLUUID RegionID, 458 uint ParentEstateID, Vector3 Position, UUID RegionID,
459 byte[] binaryBucket) 459 byte[] binaryBucket)
460 { 460 {
461 // Friend Requests go by Instant Message.. using the dialog param 461 // Friend Requests go by Instant Message.. using the dialog param
@@ -464,17 +464,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
464 // 38 == Offer friendship 464 // 38 == Offer friendship
465 if (dialog == (byte) 38) 465 if (dialog == (byte) 38)
466 { 466 {
467 LLUUID friendTransactionID = LLUUID.Random(); 467 UUID friendTransactionID = UUID.Random();
468 468
469 m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); 469 m_pendingFriendRequests.Add(friendTransactionID, fromAgentID);
470 470
471 m_log.Info("[FRIEND]: 38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + 471 m_log.Info("[FRIEND]: 38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
472 message); 472 message);
473 GridInstantMessage msg = new GridInstantMessage(); 473 GridInstantMessage msg = new GridInstantMessage();
474 msg.fromAgentID = fromAgentID.UUID; 474 msg.fromAgentID = fromAgentID.Guid;
475 msg.fromAgentSession = fromAgentSession.UUID; 475 msg.fromAgentSession = fromAgentSession.Guid;
476 msg.toAgentID = toAgentID.UUID; 476 msg.toAgentID = toAgentID.Guid;
477 msg.imSessionID = friendTransactionID.UUID; // This is the item we're mucking with here 477 msg.imSessionID = friendTransactionID.Guid; // This is the item we're mucking with here
478 m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID.ToString()); 478 m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID.ToString());
479 msg.timestamp = timestamp; 479 msg.timestamp = timestamp;
480 if (client != null) 480 if (client != null)
@@ -490,8 +490,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
490 msg.fromGroup = fromGroup; 490 msg.fromGroup = fromGroup;
491 msg.offline = offline; 491 msg.offline = offline;
492 msg.ParentEstateID = ParentEstateID; 492 msg.ParentEstateID = ParentEstateID;
493 msg.Position = new sLLVector3(Position); 493 msg.Position = Position;
494 msg.RegionID = RegionID.UUID; 494 msg.RegionID = RegionID.Guid;
495 msg.binaryBucket = binaryBucket; 495 msg.binaryBucket = binaryBucket;
496 // We don't really care which scene we pipe it through. 496 // We don't really care which scene we pipe it through.
497 m_scene[0].TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); 497 m_scene[0].TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
@@ -512,7 +512,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
512 } 512 }
513 } 513 }
514 514
515 private void OnApprovedFriendRequest(IClientAPI client, LLUUID agentID, LLUUID transactionID, List<LLUUID> callingCardFolders) 515 private void OnApprovedFriendRequest(IClientAPI client, UUID agentID, UUID transactionID, List<UUID> callingCardFolders)
516 { 516 {
517 if (m_pendingFriendRequests.ContainsKey(transactionID)) 517 if (m_pendingFriendRequests.ContainsKey(transactionID))
518 { 518 {
@@ -528,18 +528,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
528 528
529 // Compose response to other agent. 529 // Compose response to other agent.
530 GridInstantMessage msg = new GridInstantMessage(); 530 GridInstantMessage msg = new GridInstantMessage();
531 msg.toAgentID = m_pendingFriendRequests[transactionID].UUID; 531 msg.toAgentID = m_pendingFriendRequests[transactionID].Guid;
532 msg.fromAgentID = agentID.UUID; 532 msg.fromAgentID = agentID.Guid;
533 msg.fromAgentName = client.Name; 533 msg.fromAgentName = client.Name;
534 msg.fromAgentSession = client.SessionId.UUID; 534 msg.fromAgentSession = client.SessionId.Guid;
535 msg.fromGroup = false; 535 msg.fromGroup = false;
536 msg.imSessionID = transactionID.UUID; 536 msg.imSessionID = transactionID.Guid;
537 msg.message = agentID.UUID.ToString(); 537 msg.message = agentID.Guid.ToString();
538 msg.ParentEstateID = 0; 538 msg.ParentEstateID = 0;
539 msg.timestamp = (uint) Util.UnixTimeSinceEpoch(); 539 msg.timestamp = (uint) Util.UnixTimeSinceEpoch();
540 msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID; 540 msg.RegionID = SceneAgentIn.RegionInfo.RegionID.Guid;
541 msg.dialog = (byte) 39; // Approved friend request 541 msg.dialog = (byte) 39; // Approved friend request
542 msg.Position = new sLLVector3(); 542 msg.Position = Vector3.Zero;
543 msg.offline = (byte) 0; 543 msg.offline = (byte) 0;
544 msg.binaryBucket = new byte[0]; 544 msg.binaryBucket = new byte[0];
545 // We don't really care which scene we pipe it through, it goes to the shared IM Module and/or the database 545 // We don't really care which scene we pipe it through, it goes to the shared IM Module and/or the database
@@ -548,7 +548,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
548 SceneAgentIn.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, (uint) 1); 548 SceneAgentIn.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, (uint) 1);
549 549
550 550
551 //LLUUID[] Agents = new LLUUID[1]; 551 //UUID[] Agents = new UUID[1];
552 //Agents[0] = msg.toAgentID; 552 //Agents[0] = msg.toAgentID;
553 //av.ControllingClient.SendAgentOnline(Agents); 553 //av.ControllingClient.SendAgentOnline(Agents);
554 554
@@ -557,7 +557,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
557 } 557 }
558 } 558 }
559 559
560 private void OnDenyFriendRequest(IClientAPI client, LLUUID agentID, LLUUID transactionID, List<LLUUID> callingCardFolders) 560 private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID transactionID, List<UUID> callingCardFolders)
561 { 561 {
562 if (m_pendingFriendRequests.ContainsKey(transactionID)) 562 if (m_pendingFriendRequests.ContainsKey(transactionID))
563 { 563 {
@@ -571,18 +571,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
571 } 571 }
572 // Compose response to other agent. 572 // Compose response to other agent.
573 GridInstantMessage msg = new GridInstantMessage(); 573 GridInstantMessage msg = new GridInstantMessage();
574 msg.toAgentID = m_pendingFriendRequests[transactionID].UUID; 574 msg.toAgentID = m_pendingFriendRequests[transactionID].Guid;
575 msg.fromAgentID = agentID.UUID; 575 msg.fromAgentID = agentID.Guid;
576 msg.fromAgentName = client.Name; 576 msg.fromAgentName = client.Name;
577 msg.fromAgentSession = client.SessionId.UUID; 577 msg.fromAgentSession = client.SessionId.Guid;
578 msg.fromGroup = false; 578 msg.fromGroup = false;
579 msg.imSessionID = transactionID.UUID; 579 msg.imSessionID = transactionID.Guid;
580 msg.message = agentID.UUID.ToString(); 580 msg.message = agentID.Guid.ToString();
581 msg.ParentEstateID = 0; 581 msg.ParentEstateID = 0;
582 msg.timestamp = (uint) Util.UnixTimeSinceEpoch(); 582 msg.timestamp = (uint) Util.UnixTimeSinceEpoch();
583 msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID; 583 msg.RegionID = SceneAgentIn.RegionInfo.RegionID.Guid;
584 msg.dialog = (byte) 40; // Deny friend request 584 msg.dialog = (byte) 40; // Deny friend request
585 msg.Position = new sLLVector3(); 585 msg.Position = Vector3.Zero;
586 msg.offline = (byte) 0; 586 msg.offline = (byte) 0;
587 msg.binaryBucket = new byte[0]; 587 msg.binaryBucket = new byte[0];
588 SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); 588 SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
@@ -590,7 +590,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
590 } 590 }
591 } 591 }
592 592
593 private void OnTerminateFriendship(IClientAPI client, LLUUID agent, LLUUID exfriendID) 593 private void OnTerminateFriendship(IClientAPI client, UUID agent, UUID exfriendID)
594 { 594 {
595 m_scene[0].StoreRemoveFriendship(agent, exfriendID); 595 m_scene[0].StoreRemoveFriendship(agent, exfriendID);
596 // TODO: Inform the client that the ExFriend is offline 596 // TODO: Inform the client that the ExFriend is offline
@@ -599,10 +599,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
599 private void OnGridInstantMessage(GridInstantMessage msg) 599 private void OnGridInstantMessage(GridInstantMessage msg)
600 { 600 {
601 // Trigger the above event handler 601 // Trigger the above event handler
602 OnInstantMessage(null, new LLUUID(msg.fromAgentID), new LLUUID(msg.fromAgentSession), 602 OnInstantMessage(null, new UUID(msg.fromAgentID), new UUID(msg.fromAgentSession),
603 new LLUUID(msg.toAgentID), new LLUUID(msg.imSessionID), msg.timestamp, msg.fromAgentName, 603 new UUID(msg.toAgentID), new UUID(msg.imSessionID), msg.timestamp, msg.fromAgentName,
604 msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID, 604 msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID,
605 new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID), 605 new Vector3(msg.Position.X, msg.Position.Y, msg.Position.Z), new UUID(msg.RegionID),
606 msg.binaryBucket); 606 msg.binaryBucket);
607 } 607 }
608 608
@@ -611,8 +611,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
611 611
612 public struct StoredFriendListUpdate 612 public struct StoredFriendListUpdate
613 { 613 {
614 public LLUUID storedFor; 614 public UUID storedFor;
615 public LLUUID storedAbout; 615 public UUID storedAbout;
616 public bool OnlineYN; 616 public bool OnlineYN;
617 } 617 }
618} 618}