diff options
author | Mike Rieker | 2010-07-06 02:23:10 +0000 |
---|---|---|
committer | Mike Rieker | 2010-07-06 02:23:10 +0000 |
commit | 6e7f1a3ac11b889175c87f59a3c5361c704363a6 (patch) | |
tree | 2ed5bebf54db3adc420e1510045b84b880ecb157 /OpenSim/Region/CoreModules/Avatar/InstantMessage | |
parent | rewrote hanging llParseStringKeepNulls() (diff) | |
parent | Undo fix is now complete. This commit repairs the special case of the root pr... (diff) | |
download | opensim-SC-6e7f1a3ac11b889175c87f59a3c5361c704363a6.zip opensim-SC-6e7f1a3ac11b889175c87f59a3c5361c704363a6.tar.gz opensim-SC-6e7f1a3ac11b889175c87f59a3c5361c704363a6.tar.bz2 opensim-SC-6e7f1a3ac11b889175c87f59a3c5361c704363a6.tar.xz |
Merge branch 'careminster-presence-refactor' of www.3dhosting.de:/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | 65 |
2 files changed, 61 insertions, 29 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index 2dc7384..ffdac58 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -156,12 +156,31 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
156 | return; | 156 | return; |
157 | } | 157 | } |
158 | 158 | ||
159 | if (dialog == (byte)InstantMessageDialog.MessageFromAgent || | 159 | DateTime dt = DateTime.UtcNow; |
160 | dialog == (byte)InstantMessageDialog.MessageFromObject) | 160 | |
161 | // Ticks from UtcNow, but make it look like local. Evil, huh? | ||
162 | dt = DateTime.SpecifyKind(dt, DateTimeKind.Local); | ||
163 | |||
164 | try | ||
165 | { | ||
166 | // Convert that to the PST timezone | ||
167 | TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles"); | ||
168 | dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo); | ||
169 | } | ||
170 | catch | ||
161 | { | 171 | { |
162 | im.offline = 1; | 172 | m_log.Info("[OFFLINE MESSAGING]: No PST timezone found on this machine. Saving with local timestamp."); |
163 | } | 173 | } |
164 | 174 | ||
175 | // And make it look local again to fool the unix time util | ||
176 | dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc); | ||
177 | |||
178 | im.timestamp = (uint)Util.ToUnixTime(dt); | ||
179 | |||
180 | // If client is null, this message comes from storage and IS offline | ||
181 | if (client != null) | ||
182 | im.offline = 0; | ||
183 | |||
165 | if (m_TransferModule != null) | 184 | if (m_TransferModule != null) |
166 | { | 185 | { |
167 | m_TransferModule.SendInstantMessage(im, | 186 | m_TransferModule.SendInstantMessage(im, |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index a2dc91f..feeb9e6 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -192,6 +192,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
192 | // Needed for proper state management for stored group | 192 | // Needed for proper state management for stored group |
193 | // invitations | 193 | // invitations |
194 | // | 194 | // |
195 | |||
196 | im.offline = 1; | ||
197 | |||
198 | // Reconstruct imSessionID | ||
199 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | ||
200 | { | ||
201 | UUID fromAgentID = new UUID(im.fromAgentID); | ||
202 | UUID sessionID = fromAgentID ^ client.AgentId; | ||
203 | im.imSessionID = new Guid(sessionID.ToString()); | ||
204 | } | ||
205 | |||
195 | Scene s = FindScene(client.AgentId); | 206 | Scene s = FindScene(client.AgentId); |
196 | if (s != null) | 207 | if (s != null) |
197 | s.EventManager.TriggerIncomingInstantMessage(im); | 208 | s.EventManager.TriggerIncomingInstantMessage(im); |
@@ -201,35 +212,37 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
201 | 212 | ||
202 | private void UndeliveredMessage(GridInstantMessage im) | 213 | private void UndeliveredMessage(GridInstantMessage im) |
203 | { | 214 | { |
204 | if (im.dialog == 19) | 215 | if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && |
205 | im.offline = 1; // We want them pushed out to the server | 216 | im.dialog != (byte)InstantMessageDialog.MessageFromAgent && |
206 | if ((im.offline != 0) | 217 | im.dialog != (byte)InstantMessageDialog.GroupNotice && |
207 | && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) | 218 | im.dialog != (byte)InstantMessageDialog.InventoryOffered) |
208 | { | 219 | { |
209 | // It's not delivered. Make sure the scope id is saved | 220 | return; |
210 | // We don't need the imSessionID here anymore, overwrite it | 221 | } |
211 | Scene scene = FindScene(new UUID(im.fromAgentID)); | ||
212 | if (scene == null) | ||
213 | scene = m_SceneList[0]; | ||
214 | im.imSessionID = new Guid(scene.RegionInfo.ScopeID.ToString()); | ||
215 | 222 | ||
216 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( | 223 | // It's not delivered. Make sure the scope id is saved |
217 | "POST", m_RestURL+"/SaveMessage/", im); | 224 | // We don't need the imSessionID here anymore, overwrite it |
225 | Scene scene = FindScene(new UUID(im.fromAgentID)); | ||
226 | if (scene == null) | ||
227 | scene = m_SceneList[0]; | ||
228 | im.imSessionID = new Guid(scene.RegionInfo.ScopeID.ToString()); | ||
218 | 229 | ||
219 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | 230 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( |
220 | { | 231 | "POST", m_RestURL+"/SaveMessage/", im); |
221 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); | 232 | |
222 | if (client == null) | 233 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) |
223 | return; | 234 | { |
224 | 235 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); | |
225 | client.SendInstantMessage(new GridInstantMessage( | 236 | if (client == null) |
226 | null, new UUID(im.toAgentID), | 237 | return; |
227 | "System", new UUID(im.fromAgentID), | 238 | |
228 | (byte)InstantMessageDialog.MessageFromAgent, | 239 | client.SendInstantMessage(new GridInstantMessage( |
229 | "User is not logged in. "+ | 240 | null, new UUID(im.toAgentID), |
230 | (success ? "Message saved." : "Message not saved"), | 241 | "System", new UUID(im.fromAgentID), |
231 | false, new Vector3())); | 242 | (byte)InstantMessageDialog.MessageFromAgent, |
232 | } | 243 | "User is not logged in. "+ |
244 | (success ? "Message saved." : "Message not saved"), | ||
245 | false, new Vector3())); | ||
233 | } | 246 | } |
234 | } | 247 | } |
235 | } | 248 | } |