aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs81
-rw-r--r--OpenSim/Region/Environment/Modules/GroupsModule.cs223
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs8
3 files changed, 297 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index ff1bac4..47cb582 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -561,6 +561,11 @@ namespace OpenSim.Region.ClientStack
561 public event RequestAvatarProperties OnRequestAvatarProperties; 561 public event RequestAvatarProperties OnRequestAvatarProperties;
562 public event SetAlwaysRun OnSetAlwaysRun; 562 public event SetAlwaysRun OnSetAlwaysRun;
563 563
564 public event FetchInventory OnAgentDataUpdateRequest;
565 public event FetchInventory OnUserInfoRequest;
566 public event TeleportLocationRequest OnSetStartLocationRequest;
567
568
564 public event CreateNewInventoryItem OnCreateNewInventoryItem; 569 public event CreateNewInventoryItem OnCreateNewInventoryItem;
565 public event CreateInventoryFolder OnCreateNewInventoryFolder; 570 public event CreateInventoryFolder OnCreateNewInventoryFolder;
566 public event UpdateInventoryFolder OnUpdateInventoryFolder; 571 public event UpdateInventoryFolder OnUpdateInventoryFolder;
@@ -1301,6 +1306,19 @@ namespace OpenSim.Region.ClientStack
1301 OutPacket(replyPacket, ThrottleOutPacketType.Task); 1306 OutPacket(replyPacket, ThrottleOutPacketType.Task);
1302 } 1307 }
1303 1308
1309 public void SendAgentDataUpdate(LLUUID agentid, LLUUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname,string grouptitle)
1310 {
1311 AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate);
1312 sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid;
1313 sendAgentDataUpdate.AgentData.AgentID = agentid;
1314 sendAgentDataUpdate.AgentData.FirstName = Helpers.StringToField(firstname);
1315 sendAgentDataUpdate.AgentData.GroupName = Helpers.StringToField(groupname);
1316 sendAgentDataUpdate.AgentData.GroupPowers = grouppowers;
1317 sendAgentDataUpdate.AgentData.GroupTitle = Helpers.StringToField(grouptitle);
1318 sendAgentDataUpdate.AgentData.LastName = Helpers.StringToField(lastname);
1319 OutPacket(sendAgentDataUpdate,ThrottleOutPacketType.Task);
1320 }
1321
1304 /// <summary> 1322 /// <summary>
1305 /// 1323 ///
1306 /// </summary> 1324 /// </summary>
@@ -2795,6 +2813,7 @@ namespace OpenSim.Region.ClientStack
2795 //rezPacket.RezData.RezSelected; 2813 //rezPacket.RezData.RezSelected;
2796 //rezPacket.RezData.FromTaskID; 2814 //rezPacket.RezData.FromTaskID;
2797 //m_log.Info("[REZData]: " + rezPacket.ToString()); 2815 //m_log.Info("[REZData]: " + rezPacket.ToString());
2816
2798 OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd, 2817 OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
2799 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID, 2818 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
2800 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection, 2819 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
@@ -2949,6 +2968,41 @@ namespace OpenSim.Region.ClientStack
2949 Helpers.FieldToUTF8String(querydata.Name)); 2968 Helpers.FieldToUTF8String(querydata.Name));
2950 } 2969 }
2951 break; 2970 break;
2971 case PacketType.AgentDataUpdateRequest:
2972 AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack;
2973
2974 if (OnAgentDataUpdateRequest != null)
2975 {
2976 OnAgentDataUpdateRequest(this, avRequestDataUpdatePacket.AgentData.AgentID, avRequestDataUpdatePacket.AgentData.SessionID);
2977 }
2978
2979 break;
2980 case PacketType.UserInfoRequest:
2981 UserInfoRequestPacket avUserInfoRequestPacket = (UserInfoRequestPacket)Pack;
2982 if (OnUserInfoRequest != null)
2983 {
2984 OnUserInfoRequest(this,avUserInfoRequestPacket.AgentData.AgentID,avUserInfoRequestPacket.AgentData.SessionID);
2985
2986 }
2987 break;
2988
2989 case PacketType.SetStartLocationRequest:
2990 SetStartLocationRequestPacket avSetStartLocationRequestPacket = (SetStartLocationRequestPacket)Pack;
2991 if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId)
2992 {
2993 if (OnSetStartLocationRequest != null)
2994 {
2995 OnSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos,
2996 avSetStartLocationRequestPacket.StartLocationData.LocationLookAt,
2997 avSetStartLocationRequestPacket.StartLocationData.LocationID);
2998 }
2999 }
3000 break;
3001
3002 case PacketType.AgentThrottle:
3003 AgentThrottlePacket atpack = (AgentThrottlePacket)Pack;
3004 m_packetQueue.SetThrottleFromClient(atpack.Throttle.Throttles);
3005 break;
2952 3006
2953 #endregion 3007 #endregion
2954 3008
@@ -3654,14 +3708,11 @@ namespace OpenSim.Region.ClientStack
3654 OnEstateCovenantRequest(this, epack.SessionID); 3708 OnEstateCovenantRequest(this, epack.SessionID);
3655 } 3709 }
3656 break; 3710 break;
3657 case PacketType.AgentThrottle: 3711
3658 AgentThrottlePacket atpack = (AgentThrottlePacket)Pack;
3659 m_packetQueue.SetThrottleFromClient(atpack.Throttle.Throttles);
3660 break;
3661 3712
3662 #endregion 3713 #endregion
3663 3714
3664 #region unimplemented handlers 3715 #region GodPackets
3665 3716
3666 case PacketType.RequestGodlikePowers: 3717 case PacketType.RequestGodlikePowers:
3667 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack; 3718 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack;
@@ -3699,6 +3750,12 @@ namespace OpenSim.Region.ClientStack
3699 //OutPacket(kupack, ThrottleOutPacketType.Task); 3750 //OutPacket(kupack, ThrottleOutPacketType.Task);
3700 break; 3751 break;
3701 3752
3753
3754 #endregion
3755
3756 #region unimplemented handlers
3757
3758
3702 case PacketType.StartPingCheck: 3759 case PacketType.StartPingCheck:
3703 // Send the client the ping response back 3760 // Send the client the ping response back
3704 // Pass the same PingID in the matching packet 3761 // Pass the same PingID in the matching packet
@@ -3746,17 +3803,17 @@ namespace OpenSim.Region.ClientStack
3746 // TODO: handle this packet 3803 // TODO: handle this packet
3747 m_log.Warn("[CLIENT]: unhandled MuteListRequest packet"); 3804 m_log.Warn("[CLIENT]: unhandled MuteListRequest packet");
3748 break; 3805 break;
3749 case PacketType.AgentDataUpdateRequest: 3806 //case PacketType.AgentDataUpdateRequest:
3750 // TODO: handle this packet 3807 // TODO: handle this packet
3751 m_log.Warn("[CLIENT]: unhandled AgentDataUpdateRequest packet"); 3808 //m_log.Warn("[CLIENT]: unhandled AgentDataUpdateRequest packet");
3752 break; 3809 //break;
3753 3810
3754 case PacketType.ParcelDwellRequest: 3811 case PacketType.ParcelDwellRequest:
3755 // TODO: handle this packet 3812 // TODO: handle this packet
3756 m_log.Warn("[CLIENT]: unhandled ParcelDwellRequest packet"); 3813 m_log.Warn("[CLIENT]: unhandled ParcelDwellRequest packet");
3757 break; 3814 break;
3758 case PacketType.UseCircuitCode: 3815 case PacketType.UseCircuitCode:
3759 // TODO: handle this packet 3816 // TODO: Don't display this one, we handle it at a lower level
3760 //m_log.Warn("[CLIENT]: unhandled UseCircuitCode packet"); 3817 //m_log.Warn("[CLIENT]: unhandled UseCircuitCode packet");
3761 break; 3818 break;
3762 case PacketType.EconomyDataRequest: 3819 case PacketType.EconomyDataRequest:
@@ -3775,10 +3832,10 @@ namespace OpenSim.Region.ClientStack
3775 // TODO: handle this packet 3832 // TODO: handle this packet
3776 m_log.Warn("[CLIENT]: unhandled SoundTrigger packet"); 3833 m_log.Warn("[CLIENT]: unhandled SoundTrigger packet");
3777 break; 3834 break;
3778 case PacketType.UserInfoRequest: 3835 //case PacketType.UserInfoRequest:
3779 // TODO: handle this packet 3836 // TODO: handle this packet
3780 m_log.Warn("[CLIENT]: unhandled UserInfoRequest packet"); 3837 //m_log.Warn("[CLIENT]: unhandled UserInfoRequest packet");
3781 break; 3838 //break;
3782 case PacketType.InventoryDescendents: 3839 case PacketType.InventoryDescendents:
3783 // TODO: handle this packet 3840 // TODO: handle this packet
3784 m_log.Warn("[CLIENT]: unhandled InventoryDescent packet"); 3841 m_log.Warn("[CLIENT]: unhandled InventoryDescent packet");
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs
index 50e9a39..6eb3cda 100644
--- a/OpenSim/Region/Environment/Modules/GroupsModule.cs
+++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs
@@ -27,18 +27,182 @@
27*/ 27*/
28 28
29using Nini.Config; 29using Nini.Config;
30using System;
31using System.Collections;
32using System.Collections.Generic;
33using OpenSim.Framework;
34using OpenSim.Framework.Console;
30using OpenSim.Region.Environment.Interfaces; 35using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
37using libsecondlife;
32 38
33namespace OpenSim.Region.Environment.Modules 39namespace OpenSim.Region.Environment.Modules
34{ 40{
35 public class GroupsModule : IRegionModule 41 public class GroupsModule : IRegionModule
36 { 42 {
37 private Scene m_scene; 43 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
44
45 private List<Scene> m_scene = new List<Scene>();
46 private Dictionary<LLUUID, IClientAPI> m_iclientmap = new Dictionary<LLUUID, IClientAPI>();
47 private Dictionary<LLUUID, GroupData> m_groupmap = new Dictionary<LLUUID, GroupData>();
48 private Dictionary<LLUUID, GroupList> m_grouplistmap = new Dictionary<LLUUID, GroupList>();
38 49
39 public void Initialise(Scene scene, IConfigSource config) 50 public void Initialise(Scene scene, IConfigSource config)
40 { 51 {
41 m_scene = scene; 52 lock (m_scene)
53 {
54 m_scene.Add(scene);
55 }
56 scene.EventManager.OnNewClient += OnNewClient;
57 scene.EventManager.OnClientClosed += OnClientClosed;
58 scene.EventManager.OnGridInstantMessageToGroupsModule += OnGridInstantMessage;
59 //scene.EventManager.
60 }
61 private void OnNewClient(IClientAPI client)
62 {
63 // All friends establishment protocol goes over instant message
64 // There's no way to send a message from the sim
65 // to a user to 'add a friend' without causing dialog box spam
66 //
67 // The base set of friends are added when the user signs on in their XMLRPC response
68 // Generated by LoginService. The friends are retreived from the database by the UserManager
69
70 // Subscribe to instant messages
71 client.OnInstantMessage += OnInstantMessage;
72 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
73 lock (m_iclientmap)
74 {
75 if (!m_iclientmap.ContainsKey(client.AgentId))
76 {
77 m_iclientmap.Add(client.AgentId, client);
78 }
79 }
80 GroupData OpenSimulatorGroup = new GroupData();
81 OpenSimulatorGroup.ActiveGroupTitle = "OpenSimulator Tester";
82 OpenSimulatorGroup.GroupID = new LLUUID("00000000-68f9-1111-024e-222222111120");
83 OpenSimulatorGroup.GroupMembers.Add(client.AgentId);
84 OpenSimulatorGroup.groupName = "OpenSimulator Testing";
85 OpenSimulatorGroup.ActiveGroupPowers = GroupPowers.LandAllowSetHome;
86 OpenSimulatorGroup.GroupTitles.Add("OpenSimulator Tester");
87 lock (m_groupmap)
88 {
89 if (!m_groupmap.ContainsKey(client.AgentId))
90 {
91 m_groupmap.Add(client.AgentId, OpenSimulatorGroup);
92 }
93 }
94 GroupList testGroupList = new GroupList();
95 testGroupList.m_GroupList.Add(new LLUUID("00000000-68f9-1111-024e-222222111120"));
96
97 lock (m_grouplistmap)
98 {
99 if (!m_grouplistmap.ContainsKey(client.AgentId))
100 {
101 m_grouplistmap.Add(client.AgentId, testGroupList);
102 }
103 }
104 m_log.Info("[GROUP]: Adding " + client.FirstName + " " + client.LastName + " to OpenSimulator Tester group");
105
106
107 }
108
109 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, LLUUID AgentID, LLUUID SessionID)
110 {
111 string firstname = remoteClient.FirstName;
112 string lastname = remoteClient.LastName;
113
114 LLUUID ActiveGroupID = LLUUID.Zero;
115 uint ActiveGroupPowers = 0;
116 string ActiveGroupName = "";
117 string ActiveGroupTitle = "";
118
119 bool foundUser = false;
120
121 lock (m_iclientmap)
122 {
123 if (m_iclientmap.ContainsKey(remoteClient.AgentId))
124 {
125 foundUser = true;
126 }
127 }
128 if (foundUser)
129 {
130 lock (m_groupmap)
131 {
132 if (m_groupmap.ContainsKey(remoteClient.AgentId))
133 {
134 GroupData grp = m_groupmap[remoteClient.AgentId];
135 if (grp != null)
136 {
137 ActiveGroupID = grp.GroupID;
138 ActiveGroupName = grp.groupName;
139 ActiveGroupPowers = grp.groupPowers;
140 ActiveGroupTitle = grp.ActiveGroupTitle;
141 }
142
143 //remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname, lastname, ActiveGroupPowers, ActiveGroupName, ActiveGroupTitle);
144
145 }
146 }
147 }
148
149 }
150
151 private void OnInstantMessage(IClientAPI client, LLUUID fromAgentID,
152 LLUUID fromAgentSession, LLUUID toAgentID,
153 LLUUID imSessionID, uint timestamp, string fromAgentName,
154 string message, byte dialog, bool fromGroup, byte offline,
155 uint ParentEstateID, LLVector3 Position, LLUUID RegionID,
156 byte[] binaryBucket)
157 {
158
159 }
160
161 private void OnGridInstantMessage(GridInstantMessage msg)
162 {
163 // Trigger the above event handler
164 OnInstantMessage(null, new LLUUID(msg.fromAgentID), new LLUUID(msg.fromAgentSession),
165 new LLUUID(msg.toAgentID), new LLUUID(msg.imSessionID), msg.timestamp, msg.fromAgentName,
166 msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID,
167 new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID),
168 msg.binaryBucket);
169 }
170
171 private void OnClientClosed(LLUUID agentID)
172 {
173 lock (m_iclientmap)
174 {
175 if (m_iclientmap.ContainsKey(agentID))
176 {
177 IClientAPI cli = m_iclientmap[agentID];
178 if (cli != null)
179 {
180 m_log.Info("[GROUP]: Removing all reference to groups for " + cli.FirstName + " " + cli.LastName);
181 }
182 else
183 {
184 m_log.Info("[GROUP]: Removing all reference to groups for " + agentID.ToString());
185 }
186 m_iclientmap.Remove(agentID);
187 }
188 }
189
190 lock (m_groupmap)
191 {
192 if (m_groupmap.ContainsKey(agentID))
193 {
194 m_groupmap.Remove(agentID);
195 }
196 }
197
198 lock (m_grouplistmap)
199 {
200 if (m_grouplistmap.ContainsKey(agentID))
201 {
202 m_grouplistmap.Remove(agentID);
203 }
204 }
205 GC.Collect();
42 } 206 }
43 207
44 public void PostInitialise() 208 public void PostInitialise()
@@ -47,6 +211,22 @@ namespace OpenSim.Region.Environment.Modules
47 211
48 public void Close() 212 public void Close()
49 { 213 {
214 m_log.Info("[GROUP]: Shutting down group module.");
215 lock (m_iclientmap)
216 {
217 m_iclientmap.Clear();
218 }
219
220 lock (m_groupmap)
221 {
222 m_groupmap.Clear();
223 }
224
225 lock (m_grouplistmap)
226 {
227 m_grouplistmap.Clear();
228 }
229 GC.Collect();
50 } 230 }
51 231
52 public string Name 232 public string Name
@@ -56,7 +236,44 @@ namespace OpenSim.Region.Environment.Modules
56 236
57 public bool IsSharedModule 237 public bool IsSharedModule
58 { 238 {
59 get { return false; } 239 get { return true; }
240 }
241
242 }
243 public class GroupData
244 {
245 public LLUUID GroupID;
246 public string groupName;
247 public string ActiveGroupTitle;
248 public List<string> GroupTitles;
249 public List<LLUUID> GroupMembers;
250 public uint groupPowers = (uint)(GroupPowers.LandAllowLandmark | GroupPowers.LandAllowSetHome);
251
252 public GroupPowers ActiveGroupPowers
253 {
254 set
255 {
256 groupPowers = (uint) value;
257 }
258 get
259 {
260 return (GroupPowers)groupPowers;
261 }
262 }
263
264 public GroupData()
265 {
266 GroupTitles = new List<string>();
267 GroupMembers = new List<LLUUID>();
268 }
269
270 }
271 public class GroupList
272 {
273 public List<LLUUID> m_GroupList;
274 public GroupList()
275 {
276 m_GroupList = new List<LLUUID>();
60 } 277 }
61 } 278 }
62} \ No newline at end of file 279} \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 0258c61..089dee7 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -89,6 +89,9 @@ namespace SimpleApp
89 public event MoveObject OnGrabUpdate; 89 public event MoveObject OnGrabUpdate;
90 public event ViewerEffectEventHandler OnViewerEffect; 90 public event ViewerEffectEventHandler OnViewerEffect;
91 91
92 public event FetchInventory OnAgentDataUpdateRequest;
93 public event FetchInventory OnUserInfoRequest;
94 public event TeleportLocationRequest OnSetStartLocationRequest;
92 95
93 public event UpdateShape OnUpdatePrimShape; 96 public event UpdateShape OnUpdatePrimShape;
94 public event ObjectExtraParams OnUpdateExtraParams; 97 public event ObjectExtraParams OnUpdateExtraParams;
@@ -226,6 +229,11 @@ namespace SimpleApp
226 { 229 {
227 } 230 }
228 231
232 public virtual void SendAgentDataUpdate(LLUUID agentid, LLUUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
233 {
234
235 }
236
229 public virtual void SendKillObject(ulong regionHandle, uint localID) 237 public virtual void SendKillObject(ulong regionHandle, uint localID)
230 { 238 {
231 } 239 }