diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/Modules/InstantMessageModule.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 36 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 1 |
3 files changed, 41 insertions, 39 deletions
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index 2598e54..412d8c3 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs | |||
@@ -26,18 +26,55 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System.Collections.Generic; | ||
29 | using OpenSim.Region.Environment.Interfaces; | 30 | using OpenSim.Region.Environment.Interfaces; |
30 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Framework.Console; | ||
31 | 33 | ||
32 | namespace OpenSim.Region.Environment.Modules | 34 | namespace OpenSim.Region.Environment.Modules |
33 | { | 35 | { |
34 | public class InstantMessageModule : IRegionModule | 36 | public class InstantMessageModule : IRegionModule |
35 | { | 37 | { |
36 | private Scene m_scene; | 38 | private List<Scene> m_scenes; |
39 | private LogBase m_log; | ||
37 | 40 | ||
38 | public void Initialise(Scene scene) | 41 | public void Initialise(Scene scene) |
39 | { | 42 | { |
40 | m_scene = scene; | 43 | if (!m_scenes.Contains(scene)) |
44 | m_scenes.Add(scene); | ||
45 | |||
46 | scene.EventManager.OnNewClient += OnNewClient; | ||
47 | m_log = OpenSim.Framework.Console.MainLog.Instance; | ||
48 | } | ||
49 | |||
50 | void OnNewClient(OpenSim.Framework.Interfaces.IClientAPI client) | ||
51 | { | ||
52 | client.OnInstantMessage += OnInstantMessage; | ||
53 | } | ||
54 | |||
55 | void OnInstantMessage(libsecondlife.LLUUID fromAgentID, | ||
56 | libsecondlife.LLUUID fromAgentSession, libsecondlife.LLUUID toAgentID, | ||
57 | libsecondlife.LLUUID imSessionID, uint timestamp, string fromAgentName, | ||
58 | string message, byte dialog) | ||
59 | { | ||
60 | // TODO: Remove after debugging. Privacy implications. | ||
61 | m_log.Verbose("IM",fromAgentName + ": " + message); | ||
62 | |||
63 | foreach (Scene m_scene in m_scenes) | ||
64 | { | ||
65 | if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) | ||
66 | { | ||
67 | // Local Message | ||
68 | ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID]; | ||
69 | user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, | ||
70 | toAgentID, imSessionID, user.Firstname + " " + user.Lastname, dialog, timestamp); | ||
71 | |||
72 | // Message sent | ||
73 | return; | ||
74 | } | ||
75 | } | ||
76 | |||
77 | // Still here, try send via Grid | ||
41 | } | 78 | } |
42 | 79 | ||
43 | public void PostInitialise() | 80 | public void PostInitialise() |
@@ -55,7 +92,7 @@ namespace OpenSim.Region.Environment.Modules | |||
55 | 92 | ||
56 | public bool IsSharedModule | 93 | public bool IsSharedModule |
57 | { | 94 | { |
58 | get { return false; } | 95 | get { return true; } |
59 | } | 96 | } |
60 | } | 97 | } |
61 | } | 98 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 43a9d86..df8b190 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -60,40 +60,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
60 | /// <summary> | 60 | /// <summary> |
61 | /// | 61 | /// |
62 | /// </summary> | 62 | /// </summary> |
63 | /// <remarks>Inefficient. TODO: Fixme</remarks> | ||
64 | /// <param name="fromAgentID"></param> | ||
65 | /// <param name="toAgentID"></param> | ||
66 | /// <param name="timestamp"></param> | ||
67 | /// <param name="fromAgentName"></param> | ||
68 | /// <param name="message"></param> | ||
69 | public void InstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, | ||
70 | uint timestamp, string fromAgentName, string message, byte dialog) | ||
71 | { | ||
72 | if (m_scenePresences.ContainsKey(toAgentID)) | ||
73 | { | ||
74 | if (m_scenePresences.ContainsKey(fromAgentID)) | ||
75 | { | ||
76 | // Local sim message | ||
77 | ScenePresence fromAvatar = m_scenePresences[fromAgentID]; | ||
78 | ScenePresence toAvatar = m_scenePresences[toAgentID]; | ||
79 | string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname; | ||
80 | toAvatar.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, toAgentID, | ||
81 | imSessionID, fromName, dialog, timestamp); | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | // Message came from a user outside the sim, ignore? | ||
86 | } | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | // Grid message | ||
91 | } | ||
92 | } | ||
93 | |||
94 | /// <summary> | ||
95 | /// | ||
96 | /// </summary> | ||
97 | /// <param name="message"></param> | 63 | /// <param name="message"></param> |
98 | /// <param name="type"></param> | 64 | /// <param name="type"></param> |
99 | /// <param name="fromPos"></param> | 65 | /// <param name="fromPos"></param> |
@@ -531,4 +497,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
531 | } | 497 | } |
532 | } | 498 | } |
533 | } | 499 | } |
534 | } \ No newline at end of file | 500 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 83432d4..ab94842 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -739,7 +739,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
739 | //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); | 739 | //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); |
740 | client.OnModifyTerrain += ModifyTerrain; | 740 | client.OnModifyTerrain += ModifyTerrain; |
741 | //client.OnChatFromViewer += SimChat; | 741 | //client.OnChatFromViewer += SimChat; |
742 | client.OnInstantMessage += InstantMessage; | ||
743 | client.OnRequestWearables += InformClientOfNeighbours; | 742 | client.OnRequestWearables += InformClientOfNeighbours; |
744 | client.OnAddPrim += AddNewPrim; | 743 | client.OnAddPrim += AddNewPrim; |
745 | client.OnUpdatePrimGroupPosition += UpdatePrimPosition; | 744 | client.OnUpdatePrimGroupPosition += UpdatePrimPosition; |