This should make offline IMs work again. It should work for incoming foreign IMs where the local recipient is offline. I can't test any of this, because I don't run an offline IM server.
parent
6861606b6d
commit
e77ca65e57
|
@ -213,6 +213,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!success && !foreigner)
|
||||
HandleUndeliveredMessage(im, result);
|
||||
else
|
||||
result(success);
|
||||
});
|
||||
|
||||
|
|
|
@ -67,6 +67,10 @@ namespace OpenSim.Services.HypergridService
|
|||
protected static Dictionary<UUID, object> m_UserLocationMap = new Dictionary<UUID, object>();
|
||||
private static ExpiringCache<UUID, GridRegion> m_RegionCache;
|
||||
|
||||
private static string m_RestURL;
|
||||
private static bool m_ForwardOfflineGroupMessages;
|
||||
private static bool m_InGatekeeper;
|
||||
|
||||
public HGInstantMessageService(IConfigSource config)
|
||||
: this(config, null)
|
||||
{
|
||||
|
@ -81,8 +85,6 @@ namespace OpenSim.Services.HypergridService
|
|||
{
|
||||
m_Initialized = true;
|
||||
|
||||
m_log.DebugFormat("[HG IM SERVICE]: Starting...");
|
||||
|
||||
IConfig serverConfig = config.Configs["HGInstantMessageService"];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section HGInstantMessageService in config file"));
|
||||
|
@ -90,6 +92,9 @@ namespace OpenSim.Services.HypergridService
|
|||
string gridService = serverConfig.GetString("GridService", String.Empty);
|
||||
string presenceService = serverConfig.GetString("PresenceService", String.Empty);
|
||||
string userAgentService = serverConfig.GetString("UserAgentService", String.Empty);
|
||||
m_InGatekeeper = serverConfig.GetBoolean("InGatekeeper", false);
|
||||
m_log.DebugFormat("[HG IM SERVICE]: Starting... InRobust? {0}", m_InGatekeeper);
|
||||
|
||||
|
||||
if (gridService == string.Empty || presenceService == string.Empty)
|
||||
throw new Exception(String.Format("Incomplete specifications, InstantMessage Service cannot function."));
|
||||
|
@ -101,6 +106,21 @@ namespace OpenSim.Services.HypergridService
|
|||
|
||||
m_RegionCache = new ExpiringCache<UUID, GridRegion>();
|
||||
|
||||
IConfig cnf = config.Configs["Messaging"];
|
||||
if (cnf == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_RestURL = cnf.GetString("OfflineMessageURL", string.Empty);
|
||||
if (m_RestURL == string.Empty)
|
||||
{
|
||||
m_log.Error("[HG IM SERVICE]: Offline IMs enabled, but no URL is given");
|
||||
return;
|
||||
}
|
||||
|
||||
m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,13 +129,21 @@ namespace OpenSim.Services.HypergridService
|
|||
m_log.DebugFormat("[HG IM SERVICE]: Received message from {0} to {1}", im.fromAgentID, im.toAgentID);
|
||||
UUID toAgentID = new UUID(im.toAgentID);
|
||||
|
||||
bool success = false;
|
||||
if (m_IMSimConnector != null)
|
||||
{
|
||||
//m_log.DebugFormat("[XXX] SendIMToRegion local im connector");
|
||||
return m_IMSimConnector.SendInstantMessage(im);
|
||||
success = m_IMSimConnector.SendInstantMessage(im);
|
||||
}
|
||||
else
|
||||
return TrySendInstantMessage(im, "", true, false);
|
||||
{
|
||||
success = TrySendInstantMessage(im, "", true, false);
|
||||
}
|
||||
|
||||
if (!success && m_InGatekeeper) // we do this only in the Gatekeeper IM service
|
||||
UndeliveredMessage(im);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner)
|
||||
|
@ -129,6 +157,7 @@ namespace OpenSim.Services.HypergridService
|
|||
upd.RegionID = UUID.Zero;
|
||||
return TrySendInstantMessage(im, upd, true, foreigner);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected bool TrySendInstantMessage(GridInstantMessage im, object previousLocation, bool firstTime, bool foreigner)
|
||||
|
@ -313,5 +342,19 @@ namespace OpenSim.Services.HypergridService
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
private bool UndeliveredMessage(GridInstantMessage im)
|
||||
{
|
||||
if (m_RestURL != string.Empty && (im.offline != 0)
|
||||
&& (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
|
||||
{
|
||||
return SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
|
||||
"POST", m_RestURL + "/SaveMessage/", im);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,4 +360,19 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
|
|||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
|
||||
; This should always be true in the Robust config
|
||||
InGatekeeper = True
|
||||
|
||||
[Messaging]
|
||||
; If you have an Offline IM server, set the vars in this section, so that
|
||||
; incomming IMs to local users from foreign grids can be saved
|
||||
;
|
||||
;# {OfflineMessageURL} {OfflineMessageModule:OfflineMessageModule} {URL of offline messaging service} {}
|
||||
;; URL of web service for offline message storage
|
||||
; OfflineMessageURL = http://yourserver/Offline.php
|
||||
|
||||
;; Control whether group messages are forwarded to offline users.
|
||||
;; Default is true.
|
||||
;; This applies to the core groups module (Flotsam) only.
|
||||
; ForwardOfflineGroupMessages = true
|
||||
|
||||
|
|
Loading…
Reference in New Issue