diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs index 1b82837..cb58b4c 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -38,6 +38,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
38 | { | 38 | { |
39 | private readonly List<Scene> m_scenes = new List<Scene>(); | 39 | private readonly List<Scene> m_scenes = new List<Scene>(); |
40 | 40 | ||
41 | #region IRegionModule Members | ||
42 | |||
41 | public void Initialise(Scene scene, IConfigSource config) | 43 | public void Initialise(Scene scene, IConfigSource config) |
42 | { | 44 | { |
43 | lock (m_scenes) | 45 | lock (m_scenes) |
@@ -56,27 +58,47 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
56 | } | 58 | } |
57 | } | 59 | } |
58 | 60 | ||
61 | public void PostInitialise() | ||
62 | { | ||
63 | } | ||
64 | |||
65 | public void Close() | ||
66 | { | ||
67 | } | ||
68 | |||
69 | public string Name | ||
70 | { | ||
71 | get { return "InstantMessageModule"; } | ||
72 | } | ||
73 | |||
74 | public bool IsSharedModule | ||
75 | { | ||
76 | get { return true; } | ||
77 | } | ||
78 | |||
79 | #endregion | ||
80 | |||
59 | private void OnNewClient(IClientAPI client) | 81 | private void OnNewClient(IClientAPI client) |
60 | { | 82 | { |
61 | client.OnInstantMessage += OnInstantMessage; | 83 | client.OnInstantMessage += OnInstantMessage; |
62 | } | 84 | } |
63 | 85 | ||
64 | private void OnInstantMessage(IClientAPI client,LLUUID fromAgentID, | 86 | private void OnInstantMessage(IClientAPI client, LLUUID fromAgentID, |
65 | LLUUID fromAgentSession, LLUUID toAgentID, | 87 | LLUUID fromAgentSession, LLUUID toAgentID, |
66 | LLUUID imSessionID, uint timestamp, string fromAgentName, | 88 | LLUUID imSessionID, uint timestamp, string fromAgentName, |
67 | string message, byte dialog, bool fromGroup, byte offline, | 89 | string message, byte dialog, bool fromGroup, byte offline, |
68 | uint ParentEstateID, LLVector3 Position, LLUUID RegionID, | 90 | uint ParentEstateID, LLVector3 Position, LLUUID RegionID, |
69 | byte[] binaryBucket) | 91 | byte[] binaryBucket) |
70 | { | 92 | { |
71 | bool dialogHandledElsewhere | 93 | bool dialogHandledElsewhere |
72 | = ((dialog == 38) || (dialog == 39) || (dialog == 40) | 94 | = ((dialog == 38) || (dialog == 39) || (dialog == 40) |
73 | || dialog == (byte)InstantMessageDialog.InventoryOffered | 95 | || dialog == (byte) InstantMessageDialog.InventoryOffered |
74 | || dialog == (byte)InstantMessageDialog.InventoryAccepted | 96 | || dialog == (byte) InstantMessageDialog.InventoryAccepted |
75 | || dialog == (byte)InstantMessageDialog.InventoryDeclined); | 97 | || dialog == (byte) InstantMessageDialog.InventoryDeclined); |
76 | 98 | ||
77 | // IM dialogs need to be pre-processed and have their sessionID filled by the server | 99 | // IM dialogs need to be pre-processed and have their sessionID filled by the server |
78 | // so the sim can match the transaction on the return packet. | 100 | // so the sim can match the transaction on the return packet. |
79 | 101 | ||
80 | // Don't send a Friend Dialog IM with a LLUUID.Zero session. | 102 | // Don't send a Friend Dialog IM with a LLUUID.Zero session. |
81 | if (!(dialogHandledElsewhere && imSessionID == LLUUID.Zero)) | 103 | if (!(dialogHandledElsewhere && imSessionID == LLUUID.Zero)) |
82 | { | 104 | { |
@@ -86,7 +108,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
86 | if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) | 108 | if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) |
87 | { | 109 | { |
88 | // Local message | 110 | // Local message |
89 | ScenePresence user = (ScenePresence)scene.Entities[toAgentID]; | 111 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
90 | if (!user.IsChildAgent) | 112 | if (!user.IsChildAgent) |
91 | { | 113 | { |
92 | user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, | 114 | user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, |
@@ -104,54 +126,33 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
104 | if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) | 126 | if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) |
105 | { | 127 | { |
106 | // Local message | 128 | // Local message |
107 | ScenePresence user = (ScenePresence)scene.Entities[toAgentID]; | 129 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
108 | 130 | ||
109 | user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, | 131 | user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, |
110 | toAgentID, imSessionID, fromAgentName, dialog, | 132 | toAgentID, imSessionID, fromAgentName, dialog, |
111 | timestamp); | 133 | timestamp); |
112 | // Message sent | 134 | // Message sent |
113 | return; | 135 | return; |
114 | |||
115 | } | 136 | } |
116 | } | 137 | } |
117 | |||
118 | } | 138 | } |
119 | 139 | ||
120 | 140 | ||
121 | // Still here, try send via Grid | 141 | // Still here, try send via Grid |
122 | // TODO | 142 | // TODO |
123 | } | 143 | } |
124 | 144 | ||
125 | // Trusty OSG1 called method. This method also gets called from the FriendsModule | 145 | // Trusty OSG1 called method. This method also gets called from the FriendsModule |
126 | // Turns out the sim has to send an instant message to the user to get it to show an accepted friend. | 146 | // Turns out the sim has to send an instant message to the user to get it to show an accepted friend. |
127 | 147 | ||
128 | private void OnGridInstantMessage(GridInstantMessage msg) | 148 | private void OnGridInstantMessage(GridInstantMessage msg) |
129 | { | 149 | { |
130 | // Trigger the above event handler | 150 | // Trigger the above event handler |
131 | OnInstantMessage(null,new LLUUID(msg.fromAgentID), new LLUUID(msg.fromAgentSession), | 151 | OnInstantMessage(null, new LLUUID(msg.fromAgentID), new LLUUID(msg.fromAgentSession), |
132 | new LLUUID(msg.toAgentID), new LLUUID(msg.imSessionID), msg.timestamp, msg.fromAgentName, | 152 | new LLUUID(msg.toAgentID), new LLUUID(msg.imSessionID), msg.timestamp, msg.fromAgentName, |
133 | msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID, | 153 | msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID, |
134 | new LLVector3(msg.Position.x,msg.Position.y,msg.Position.z), new LLUUID(msg.RegionID), | 154 | new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID), |
135 | msg.binaryBucket); | 155 | msg.binaryBucket); |
136 | |||
137 | } | ||
138 | |||
139 | public void PostInitialise() | ||
140 | { | ||
141 | } | ||
142 | |||
143 | public void Close() | ||
144 | { | ||
145 | } | ||
146 | |||
147 | public string Name | ||
148 | { | ||
149 | get { return "InstantMessageModule"; } | ||
150 | } | ||
151 | |||
152 | public bool IsSharedModule | ||
153 | { | ||
154 | get { return true; } | ||
155 | } | 156 | } |
156 | } | 157 | } |
157 | } \ No newline at end of file | 158 | } \ No newline at end of file |