From dc80c2afb338570f8f7d79491fd731bebaf643f4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 4 Dec 2012 08:08:34 -0800 Subject: Improvement in HGInstantMessageService: account for the existence of an offline IM service. --- .../HypergridService/HGInstantMessageService.cs | 35 +++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'OpenSim/Services/HypergridService/HGInstantMessageService.cs') 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 protected static IGridService m_GridService; protected static IPresenceService m_PresenceService; protected static IUserAgentService m_UserAgentService; + protected static IOfflineIMService m_OfflineIMService; protected static IInstantMessageSimConnector m_IMSimConnector; protected static Dictionary m_UserLocationMap = new Dictionary(); private static ExpiringCache m_RegionCache; - private static string m_RestURL; private static bool m_ForwardOfflineGroupMessages; private static bool m_InGatekeeper; @@ -111,9 +111,14 @@ namespace OpenSim.Services.HypergridService return; } - m_RestURL = cnf.GetString("OfflineMessageURL", string.Empty); m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", false); + if (m_InGatekeeper) + { + string offlineIMService = cnf.GetString("OfflineIMService", string.Empty); + if (offlineIMService != string.Empty) + m_OfflineIMService = ServerUtils.LoadPlugin(offlineIMService, args); + } } } @@ -329,18 +334,28 @@ namespace OpenSim.Services.HypergridService private bool UndeliveredMessage(GridInstantMessage im) { - if (m_RestURL != string.Empty && (im.offline != 0) - && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) - { -// m_log.DebugFormat("[HG IM SERVICE]: Message saved"); + if (m_OfflineIMService == null) + return false; - return SynchronousRestObjectRequester.MakeRequest( - "POST", m_RestURL + "/SaveMessage/", im); - } - else + if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && + im.dialog != (byte)InstantMessageDialog.MessageFromAgent && + im.dialog != (byte)InstantMessageDialog.GroupNotice && + im.dialog != (byte)InstantMessageDialog.GroupInvitation && + im.dialog != (byte)InstantMessageDialog.InventoryOffered) { return false; } + + if (!m_ForwardOfflineGroupMessages) + { + if (im.dialog == (byte)InstantMessageDialog.GroupNotice || + im.dialog == (byte)InstantMessageDialog.GroupInvitation) + return false; + } + +// m_log.DebugFormat("[HG IM SERVICE]: Message saved"); + string reason = string.Empty; + return m_OfflineIMService.StoreMessage(im, out reason); } } } \ No newline at end of file -- cgit v1.1