diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/FriendsModule.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/FriendsModule.cs | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index d9f09f7..d2fcba9 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs | |||
@@ -27,24 +27,61 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using System; | ||
31 | using System.Collections; | ||
32 | using System.Collections.Generic; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Console; | ||
30 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Environment.Interfaces; |
31 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Region.Environment.Scenes; |
37 | using libsecondlife; | ||
38 | using libsecondlife.Packets; | ||
32 | 39 | ||
33 | namespace OpenSim.Region.Environment.Modules | 40 | namespace OpenSim.Region.Environment.Modules |
34 | { | 41 | { |
35 | public class FriendsModule : IRegionModule | 42 | public class FriendsModule : IRegionModule |
36 | { | 43 | { |
37 | private Scene m_scene; | 44 | private List<Scene> m_scenes = new List<Scene>(); |
45 | private LogBase m_log; | ||
38 | 46 | ||
39 | public void Initialise(Scene scene, IConfigSource config) | 47 | public void Initialise(Scene scene, IConfigSource config) |
40 | { | 48 | { |
41 | m_scene = scene; | 49 | m_log = MainLog.Instance; |
50 | if (!m_scenes.Contains(scene)) | ||
51 | { | ||
52 | m_scenes.Add(scene); | ||
53 | scene.EventManager.OnNewClient += OnNewClient; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | private void OnNewClient(IClientAPI client) | ||
58 | { | ||
59 | FormFriendship(client,new Guid("c43a67ab-b196-4d62-936c-b40369547dee")); | ||
60 | FormFriendship(client, new Guid("0a2f777b-f44c-4662-8b22-c90ae038a3e6")); | ||
42 | } | 61 | } |
43 | 62 | ||
44 | public void PostInitialise() | 63 | public void PostInitialise() |
45 | { | 64 | { |
46 | } | 65 | } |
47 | 66 | ||
67 | private void FormFriendship(IClientAPI client, Guid friend) | ||
68 | { | ||
69 | foreach (Scene scene in m_scenes) | ||
70 | { | ||
71 | if (scene.Entities.ContainsKey(client.AgentId) && scene.Entities[client.AgentId] is ScenePresence) | ||
72 | { | ||
73 | OnlineNotificationPacket ONPack = new OnlineNotificationPacket(); | ||
74 | OnlineNotificationPacket.AgentBlockBlock[] AgentBlock = new OnlineNotificationPacket.AgentBlockBlock[1]; | ||
75 | |||
76 | AgentBlock[0] = new OnlineNotificationPacket.AgentBlockBlock(); | ||
77 | AgentBlock[0].AgentID = new LLUUID(friend); | ||
78 | ONPack.AgentBlock = AgentBlock; | ||
79 | client.OutPacket(ONPack,ThrottleOutPacketType.Task); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | } | ||
84 | |||
48 | public void Close() | 85 | public void Close() |
49 | { | 86 | { |
50 | } | 87 | } |
@@ -56,7 +93,7 @@ namespace OpenSim.Region.Environment.Modules | |||
56 | 93 | ||
57 | public bool IsSharedModule | 94 | public bool IsSharedModule |
58 | { | 95 | { |
59 | get { return false; } | 96 | get { return true; } |
60 | } | 97 | } |
61 | } | 98 | } |
62 | } \ No newline at end of file | 99 | } \ No newline at end of file |