diff options
author | Diva Canto | 2012-12-04 08:08:34 -0800 |
---|---|---|
committer | Diva Canto | 2012-12-04 08:08:34 -0800 |
commit | dc80c2afb338570f8f7d79491fd731bebaf643f4 (patch) | |
tree | ba78486551e6c49ecdd2cf509af65bce5498cb83 /OpenSim/Services/HypergridService | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-dc80c2afb338570f8f7d79491fd731bebaf643f4.zip opensim-SC_OLD-dc80c2afb338570f8f7d79491fd731bebaf643f4.tar.gz opensim-SC_OLD-dc80c2afb338570f8f7d79491fd731bebaf643f4.tar.bz2 opensim-SC_OLD-dc80c2afb338570f8f7d79491fd731bebaf643f4.tar.xz |
Improvement in HGInstantMessageService: account for the existence of an offline IM service.
Diffstat (limited to 'OpenSim/Services/HypergridService')
-rw-r--r-- | OpenSim/Services/HypergridService/HGInstantMessageService.cs | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index 0c9cfd3..e8d7cca 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs | |||
@@ -61,13 +61,13 @@ namespace OpenSim.Services.HypergridService | |||
61 | protected static IGridService m_GridService; | 61 | protected static IGridService m_GridService; |
62 | protected static IPresenceService m_PresenceService; | 62 | protected static IPresenceService m_PresenceService; |
63 | protected static IUserAgentService m_UserAgentService; | 63 | protected static IUserAgentService m_UserAgentService; |
64 | protected static IOfflineIMService m_OfflineIMService; | ||
64 | 65 | ||
65 | protected static IInstantMessageSimConnector m_IMSimConnector; | 66 | protected static IInstantMessageSimConnector m_IMSimConnector; |
66 | 67 | ||
67 | protected static Dictionary<UUID, object> m_UserLocationMap = new Dictionary<UUID, object>(); | 68 | protected static Dictionary<UUID, object> m_UserLocationMap = new Dictionary<UUID, object>(); |
68 | private static ExpiringCache<UUID, GridRegion> m_RegionCache; | 69 | private static ExpiringCache<UUID, GridRegion> m_RegionCache; |
69 | 70 | ||
70 | private static string m_RestURL; | ||
71 | private static bool m_ForwardOfflineGroupMessages; | 71 | private static bool m_ForwardOfflineGroupMessages; |
72 | private static bool m_InGatekeeper; | 72 | private static bool m_InGatekeeper; |
73 | 73 | ||
@@ -111,9 +111,14 @@ namespace OpenSim.Services.HypergridService | |||
111 | return; | 111 | return; |
112 | } | 112 | } |
113 | 113 | ||
114 | m_RestURL = cnf.GetString("OfflineMessageURL", string.Empty); | ||
115 | m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", false); | 114 | m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", false); |
116 | 115 | ||
116 | if (m_InGatekeeper) | ||
117 | { | ||
118 | string offlineIMService = cnf.GetString("OfflineIMService", string.Empty); | ||
119 | if (offlineIMService != string.Empty) | ||
120 | m_OfflineIMService = ServerUtils.LoadPlugin<IOfflineIMService>(offlineIMService, args); | ||
121 | } | ||
117 | } | 122 | } |
118 | } | 123 | } |
119 | 124 | ||
@@ -329,18 +334,28 @@ namespace OpenSim.Services.HypergridService | |||
329 | 334 | ||
330 | private bool UndeliveredMessage(GridInstantMessage im) | 335 | private bool UndeliveredMessage(GridInstantMessage im) |
331 | { | 336 | { |
332 | if (m_RestURL != string.Empty && (im.offline != 0) | 337 | if (m_OfflineIMService == null) |
333 | && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) | 338 | return false; |
334 | { | ||
335 | // m_log.DebugFormat("[HG IM SERVICE]: Message saved"); | ||
336 | 339 | ||
337 | return SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( | 340 | if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && |
338 | "POST", m_RestURL + "/SaveMessage/", im); | 341 | im.dialog != (byte)InstantMessageDialog.MessageFromAgent && |
339 | } | 342 | im.dialog != (byte)InstantMessageDialog.GroupNotice && |
340 | else | 343 | im.dialog != (byte)InstantMessageDialog.GroupInvitation && |
344 | im.dialog != (byte)InstantMessageDialog.InventoryOffered) | ||
341 | { | 345 | { |
342 | return false; | 346 | return false; |
343 | } | 347 | } |
348 | |||
349 | if (!m_ForwardOfflineGroupMessages) | ||
350 | { | ||
351 | if (im.dialog == (byte)InstantMessageDialog.GroupNotice || | ||
352 | im.dialog == (byte)InstantMessageDialog.GroupInvitation) | ||
353 | return false; | ||
354 | } | ||
355 | |||
356 | // m_log.DebugFormat("[HG IM SERVICE]: Message saved"); | ||
357 | string reason = string.Empty; | ||
358 | return m_OfflineIMService.StoreMessage(im, out reason); | ||
344 | } | 359 | } |
345 | } | 360 | } |
346 | } \ No newline at end of file | 361 | } \ No newline at end of file |