aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs23
1 files changed, 13 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
index 230e042..d54cf27 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
@@ -402,6 +402,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
402 402
403 if (im.dialog == (byte)InstantMessageDialog.FriendshipOffered) // 38 403 if (im.dialog == (byte)InstantMessageDialog.FriendshipOffered) // 38
404 { 404 {
405 // fromAgentName is the *destination* name (the friend we offer friendship to)
406 ScenePresence initiator = GetAnyPresenceFromAgentID(new UUID(im.fromAgentID));
407 im.fromAgentName = initiator != null ? initiator.Name : "(hippo)";
408
405 FriendshipOffered(im); 409 FriendshipOffered(im);
406 } 410 }
407 else if (im.dialog == (byte)InstantMessageDialog.FriendshipAccepted) // 39 411 else if (im.dialog == (byte)InstantMessageDialog.FriendshipAccepted) // 39
@@ -417,19 +421,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
417 /// <summary> 421 /// <summary>
418 /// Invoked when a user offers a friendship. 422 /// Invoked when a user offers a friendship.
419 /// </summary> 423 /// </summary>
420 /// May not currently be used - see OnApproveFriendRequest() instead 424 ///
421 /// <param name="im"></param> 425 /// <param name="im"></param>
422 /// <param name="client"></param> 426 /// <param name="client"></param>
423 private void FriendshipOffered(GridInstantMessage im) 427 private void FriendshipOffered(GridInstantMessage im)
424 { 428 {
425 // this is triggered by the initiating agent: 429 // this is triggered by the initiating agent:
426 // A local agent offers friendship to some possibly remote friend. 430 // A local agent offers friendship to some possibly remote friend.
427 // A IM is triggered, processed here and sent to the friend (possibly in a remote region). 431 // A IM is triggered, processed here and sent to the friend (possibly in a remote region).
428
429 // some properties are misused here:
430 // fromAgentName is the *destination* name (the friend we offer friendship to)
431 ScenePresence initiator = GetAnyPresenceFromAgentID(new UUID(im.fromAgentID));
432 im.fromAgentName = initiator != null ? initiator.Name : "(hippo)";
433 432
434 m_log.DebugFormat("[FRIEND]: Offer(38) - From: {0}, FromName: {1} To: {2}, Session: {3}, Message: {4}, Offline {5}", 433 m_log.DebugFormat("[FRIEND]: Offer(38) - From: {0}, FromName: {1} To: {2}, Session: {3}, Message: {4}, Offline {5}",
435 im.fromAgentID, im.fromAgentName, im.toAgentID, im.imSessionID, im.message, im.offline); 434 im.fromAgentID, im.fromAgentName, im.toAgentID, im.imSessionID, im.message, im.offline);
@@ -447,7 +446,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
447 // Send it to whoever is the destination. 446 // Send it to whoever is the destination.
448 // If new friend is local, it will send an IM to the viewer. 447 // If new friend is local, it will send an IM to the viewer.
449 // If new friend is remote, it will cause a OnGridInstantMessage on the remote server 448 // If new friend is remote, it will cause a OnGridInstantMessage on the remote server
450 m_TransferModule.SendInstantMessage(im, 449 m_TransferModule.SendInstantMessage(
450 im,
451 delegate(bool success) 451 delegate(bool success)
452 { 452 {
453 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success); 453 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
@@ -485,8 +485,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
485 fromAgentID, im.fromAgentName, im.imSessionID, im.toAgentID, im.message, im.dialog); 485 fromAgentID, im.fromAgentName, im.imSessionID, im.toAgentID, im.message, im.dialog);
486 486
487 // Send the decline to whoever is the destination. 487 // Send the decline to whoever is the destination.
488 GridInstantMessage msg = new GridInstantMessage(client.Scene, fromAgentID, client.Name, toAgentID, 488 GridInstantMessage msg
489 im.dialog, im.message, im.offline != 0, im.Position); 489 = new GridInstantMessage(
490 client.Scene, fromAgentID, client.Name, toAgentID,
491 im.dialog, im.message, im.offline != 0, im.Position);
490 492
491 // If new friend is local, it will send an IM to the viewer. 493 // If new friend is local, it will send an IM to the viewer.
492 // If new friend is remote, it will cause a OnGridInstantMessage on the remote server 494 // If new friend is remote, it will cause a OnGridInstantMessage on the remote server
@@ -504,6 +506,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
504 // via grid again 506 // via grid again
505 m_log.DebugFormat("[FRIEND]: Got GridIM from {0}, to {1}, imSession {2}, message {3}, dialog {4}", 507 m_log.DebugFormat("[FRIEND]: Got GridIM from {0}, to {1}, imSession {2}, message {3}, dialog {4}",
506 msg.fromAgentID, msg.toAgentID, msg.imSessionID, msg.message, msg.dialog); 508 msg.fromAgentID, msg.toAgentID, msg.imSessionID, msg.message, msg.dialog);
509
507 if (msg.dialog == (byte)InstantMessageDialog.FriendshipOffered || 510 if (msg.dialog == (byte)InstantMessageDialog.FriendshipOffered ||
508 msg.dialog == (byte)InstantMessageDialog.FriendshipAccepted || 511 msg.dialog == (byte)InstantMessageDialog.FriendshipAccepted ||
509 msg.dialog == (byte)InstantMessageDialog.FriendshipDeclined) 512 msg.dialog == (byte)InstantMessageDialog.FriendshipDeclined)