aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs68
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs141
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs4
3 files changed, 135 insertions, 78 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index b88f162..6a38278 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -186,40 +186,40 @@ namespace OpenSim.Framework
186 PCode = (byte)PCodeEnum.Primitive; 186 PCode = (byte)PCodeEnum.Primitive;
187 ExtraParams = new byte[1]; 187 ExtraParams = new byte[1];
188 m_textureEntry = DEFAULT_TEXTURE; 188 m_textureEntry = DEFAULT_TEXTURE;
189 } 189 }
190 190
191 public PrimitiveBaseShape(Primitive prim) 191 public PrimitiveBaseShape(Primitive prim)
192 { 192 {
193 PCode = (byte)prim.PrimData.PCode; 193 PCode = (byte)prim.PrimData.PCode;
194 ExtraParams = new byte[1]; 194 ExtraParams = new byte[1];
195 195
196 State = prim.PrimData.State; 196 State = prim.PrimData.State;
197 PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin); 197 PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin);
198 PathEnd = Primitive.PackEndCut(prim.PrimData.PathEnd); 198 PathEnd = Primitive.PackEndCut(prim.PrimData.PathEnd);
199 PathScaleX = Primitive.PackPathScale(prim.PrimData.PathScaleX); 199 PathScaleX = Primitive.PackPathScale(prim.PrimData.PathScaleX);
200 PathScaleY = Primitive.PackPathScale(prim.PrimData.PathScaleY); 200 PathScaleY = Primitive.PackPathScale(prim.PrimData.PathScaleY);
201 PathShearX = (byte)Primitive.PackPathShear(prim.PrimData.PathShearX); 201 PathShearX = (byte)Primitive.PackPathShear(prim.PrimData.PathShearX);
202 PathShearY = (byte)Primitive.PackPathShear(prim.PrimData.PathShearY); 202 PathShearY = (byte)Primitive.PackPathShear(prim.PrimData.PathShearY);
203 PathSkew = Primitive.PackPathTwist(prim.PrimData.PathSkew); 203 PathSkew = Primitive.PackPathTwist(prim.PrimData.PathSkew);
204 ProfileBegin = Primitive.PackBeginCut(prim.PrimData.ProfileBegin); 204 ProfileBegin = Primitive.PackBeginCut(prim.PrimData.ProfileBegin);
205 ProfileEnd = Primitive.PackEndCut(prim.PrimData.ProfileEnd); 205 ProfileEnd = Primitive.PackEndCut(prim.PrimData.ProfileEnd);
206 Scale = prim.Scale; 206 Scale = prim.Scale;
207 PathCurve = (byte)prim.PrimData.PathCurve; 207 PathCurve = (byte)prim.PrimData.PathCurve;
208 ProfileCurve = (byte)prim.PrimData.ProfileCurve; 208 ProfileCurve = (byte)prim.PrimData.ProfileCurve;
209 ProfileHollow = Primitive.PackProfileHollow(prim.PrimData.ProfileHollow); 209 ProfileHollow = Primitive.PackProfileHollow(prim.PrimData.ProfileHollow);
210 PathRadiusOffset = Primitive.PackPathTwist(prim.PrimData.PathRadiusOffset); 210 PathRadiusOffset = Primitive.PackPathTwist(prim.PrimData.PathRadiusOffset);
211 PathRevolutions = Primitive.PackPathRevolutions(prim.PrimData.PathRevolutions); 211 PathRevolutions = Primitive.PackPathRevolutions(prim.PrimData.PathRevolutions);
212 PathTaperX = Primitive.PackPathTaper(prim.PrimData.PathTaperX); 212 PathTaperX = Primitive.PackPathTaper(prim.PrimData.PathTaperX);
213 PathTaperY = Primitive.PackPathTaper(prim.PrimData.PathTaperY); 213 PathTaperY = Primitive.PackPathTaper(prim.PrimData.PathTaperY);
214 PathTwist = Primitive.PackPathTwist(prim.PrimData.PathTwist); 214 PathTwist = Primitive.PackPathTwist(prim.PrimData.PathTwist);
215 PathTwistBegin = Primitive.PackPathTwist(prim.PrimData.PathTwistBegin); 215 PathTwistBegin = Primitive.PackPathTwist(prim.PrimData.PathTwistBegin);
216 216
217 m_textureEntry = prim.Textures.GetBytes(); 217 m_textureEntry = prim.Textures.GetBytes();
218 218
219 SculptEntry = (prim.Sculpt.Type != OpenMetaverse.SculptType.None); 219 SculptEntry = (prim.Sculpt.Type != OpenMetaverse.SculptType.None);
220 SculptData = prim.Sculpt.GetBytes(); 220 SculptData = prim.Sculpt.GetBytes();
221 SculptTexture = prim.Sculpt.SculptTexture; 221 SculptTexture = prim.Sculpt.SculptTexture;
222 SculptType = (byte)prim.Sculpt.Type; 222 SculptType = (byte)prim.Sculpt.Type;
223 } 223 }
224 224
225 [XmlIgnore] 225 [XmlIgnore]
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 7ec4a9c..61116a7 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -566,52 +566,64 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
566 if (!m_Friends.ContainsKey(remoteClient.AgentId)) 566 if (!m_Friends.ContainsKey(remoteClient.AgentId))
567 return; 567 return;
568 568
569 m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
570 // Let's find the friend in this user's friend list
569 UserFriendData fd = m_Friends[remoteClient.AgentId]; 571 UserFriendData fd = m_Friends[remoteClient.AgentId];
570 572 FriendInfo friend = new FriendInfo();
571 FriendsService.StoreFriend(requester, target.ToString(), rights);
572
573 foreach (FriendInfo fi in fd.Friends) 573 foreach (FriendInfo fi in fd.Friends)
574 {
575 if (fi.Friend == target.ToString()) 574 if (fi.Friend == target.ToString())
576 { 575 friend = fi;
577 IClientAPI friendClient = LocateClientObject(target);
578 576
579 int delta = rights ^ fi.MyFlags; 577 if (!friend.PrincipalID.Equals(UUID.Zero)) // Found it
580 if ((delta & ~1) != 0) 578 {
581 { 579 FriendsService.StoreFriend(requester, target.ToString(), rights);
582 remoteClient.SendChangeUserRights(remoteClient.AgentId, target, rights & ~1); 580
583 // 581 bool onlineBitChanged = ((rights ^ friend.MyFlags) & (int)FriendRights.CanSeeOnline) == 0;
584 // Notify the friend 582 if (!onlineBitChanged)
585 // 583 {
586 584 remoteClient.SendChangeUserRights(requester, target, rights);
587 if (friendClient != null)
588 {
589 friendClient.SendChangeUserRights(target, remoteClient.AgentId, rights & ~1);
590 }
591 }
592 if ((delta & 1) != 0)
593 {
594 if (friendClient != null)
595 {
596 if ((rights & 1) != 0)
597 friendClient.SendAgentOnline(new UUID[] { new UUID(remoteClient.AgentId) } );
598 else
599 friendClient.SendAgentOffline(new UUID[] { new UUID(remoteClient.AgentId) } );
600 }
601 }
602 if (friendClient != null) // Local, we're done
603 return;
604 } 585 }
605 }
606 586
607 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); 587 // Try local
608 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 588 if (LocalGrantRights(requester, target, friend.MyFlags, rights))
609 if (friendSession != null) 589 return;
610 { 590
611 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 591
612 // TODO: You might want to send the delta to save the lookup 592 //int delta = rights ^ friend.MyFlags;
613 // on the other end!! 593 //if ((delta & ~1) != 0)
614 m_FriendsSimConnector.GrantRights(region, requester, target); 594 //{
595 // //remoteClient.SendChangeUserRights(remoteClient.AgentId, target, rights & ~1);
596 // //
597 // // Notify the friend
598 // //
599
600 // if (friendClient != null)
601 // {
602 // friendClient.SendChangeUserRights(target, remoteClient.AgentId, rights & ~1);
603 // }
604 //}
605 //if ((delta & 1) != 0)
606 //{
607 // if (friendClient != null)
608 // {
609 // if ((rights & 1) != 0)
610 // friendClient.SendAgentOnline(new UUID[] { new UUID(remoteClient.AgentId) });
611 // else
612 // friendClient.SendAgentOffline(new UUID[] { new UUID(remoteClient.AgentId) });
613 // }
614 //}
615 //if (friendClient != null) // Local, we're done
616 // return;
617
618 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
619 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
620 if (friendSession != null)
621 {
622 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
623 // TODO: You might want to send the delta to save the lookup
624 // on the other end!!
625 m_FriendsSimConnector.GrantRights(region, requester, target);
626 }
615 } 627 }
616 } 628 }
617 629
@@ -681,10 +693,53 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
681 return false; 693 return false;
682 } 694 }
683 695
684 public bool LocalGrantRights() 696 public bool LocalGrantRights(UUID userID, UUID friendID, int myFlags, int rights)
685 { 697 {
686 // TODO 698 m_log.DebugFormat("XXX Trying to locate {0}", friendID);
687 return true; 699 IClientAPI friendClient = LocateClientObject(friendID);
700 if (friendClient != null)
701 {
702 bool onlineBitChanged = ((rights ^ myFlags) & (int)FriendRights.CanSeeOnline) == 0;
703 if (!onlineBitChanged)
704 friendClient.SendChangeUserRights(userID, friendID, rights);
705 else
706 {
707 if ((rights & (int)FriendRights.CanSeeOnline) == 1)
708 friendClient.SendAgentOnline(new UUID[] { new UUID(userID) });
709 else
710 friendClient.SendAgentOffline(new UUID[] { new UUID(userID) });
711 }
712 return true;
713 }
714
715 return false;
716
717 //int delta = rights ^ friend.MyFlags;
718 //if ((delta & ~1) != 0)
719 //{
720 // //remoteClient.SendChangeUserRights(remoteClient.AgentId, target, rights & ~1);
721 // //
722 // // Notify the friend
723 // //
724
725 // if (friendClient != null)
726 // {
727 // friendClient.SendChangeUserRights(target, remoteClient.AgentId, rights & ~1);
728 // }
729 //}
730 //if ((delta & 1) != 0)
731 //{
732 // if (friendClient != null)
733 // {
734 // if ((rights & 1) != 0)
735 // friendClient.SendAgentOnline(new UUID[] { new UUID(remoteClient.AgentId) });
736 // else
737 // friendClient.SendAgentOffline(new UUID[] { new UUID(remoteClient.AgentId) });
738 // }
739 //}
740 //if (friendClient != null) // Local, we're done
741 // return;
742
688 } 743 }
689 744
690 public bool LocalStatusNotification(UUID userID, UUID friendID, bool online) 745 public bool LocalStatusNotification(UUID userID, UUID friendID, bool online)
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
index e7b74a9..140660b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
@@ -34,6 +34,7 @@ using System.Xml;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Server.Base; 35using OpenSim.Server.Base;
36using OpenSim.Framework.Servers.HttpServer; 36using OpenSim.Framework.Servers.HttpServer;
37using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
37 38
38using OpenMetaverse; 39using OpenMetaverse;
39using log4net; 40using log4net;
@@ -205,7 +206,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
205 if (!UUID.TryParse(request["ToID"].ToString(), out toID)) 206 if (!UUID.TryParse(request["ToID"].ToString(), out toID))
206 return FailureResult(); 207 return FailureResult();
207 208
208 if (m_FriendsModule.LocalGrantRights(/* ??? */)) 209 // !!!
210 if (m_FriendsModule.LocalGrantRights(UUID.Zero, UUID.Zero, 0, 0))
209 return SuccessResult(); 211 return SuccessResult();
210 212
211 return FailureResult(); 213 return FailureResult();