aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2011-06-06 17:46:34 -0700
committerDiva Canto2011-06-06 17:46:34 -0700
commite77ca65e575e4f8f7645aec879b73b87ba505f49 (patch)
tree305c962a3c08b6d3c121f03d05064a64a031a85f
parentNarrow down the exception catching to exactly the exception of interest. This... (diff)
downloadopensim-SC_OLD-e77ca65e575e4f8f7645aec879b73b87ba505f49.zip
opensim-SC_OLD-e77ca65e575e4f8f7645aec879b73b87ba505f49.tar.gz
opensim-SC_OLD-e77ca65e575e4f8f7645aec879b73b87ba505f49.tar.bz2
opensim-SC_OLD-e77ca65e575e4f8f7645aec879b73b87ba505f49.tar.xz
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.
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs5
-rw-r--r--OpenSim/Services/HypergridService/HGInstantMessageService.cs51
-rw-r--r--bin/Robust.HG.ini.example23
3 files changed, 70 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
index 4de197e..dee86df 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
@@ -213,7 +213,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
213 } 213 }
214 } 214 }
215 } 215 }
216 result(success); 216 if (!success && !foreigner)
217 HandleUndeliveredMessage(im, result);
218 else
219 result(success);
217 }); 220 });
218 221
219 return; 222 return;
diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs
index 4f68e55..66cf4de 100644
--- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs
+++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs
@@ -67,6 +67,10 @@ namespace OpenSim.Services.HypergridService
67 protected static Dictionary<UUID, object> m_UserLocationMap = new Dictionary<UUID, object>(); 67 protected static Dictionary<UUID, object> m_UserLocationMap = new Dictionary<UUID, object>();
68 private static ExpiringCache<UUID, GridRegion> m_RegionCache; 68 private static ExpiringCache<UUID, GridRegion> m_RegionCache;
69 69
70 private static string m_RestURL;
71 private static bool m_ForwardOfflineGroupMessages;
72 private static bool m_InGatekeeper;
73
70 public HGInstantMessageService(IConfigSource config) 74 public HGInstantMessageService(IConfigSource config)
71 : this(config, null) 75 : this(config, null)
72 { 76 {
@@ -81,8 +85,6 @@ namespace OpenSim.Services.HypergridService
81 { 85 {
82 m_Initialized = true; 86 m_Initialized = true;
83 87
84 m_log.DebugFormat("[HG IM SERVICE]: Starting...");
85
86 IConfig serverConfig = config.Configs["HGInstantMessageService"]; 88 IConfig serverConfig = config.Configs["HGInstantMessageService"];
87 if (serverConfig == null) 89 if (serverConfig == null)
88 throw new Exception(String.Format("No section HGInstantMessageService in config file")); 90 throw new Exception(String.Format("No section HGInstantMessageService in config file"));
@@ -90,6 +92,9 @@ namespace OpenSim.Services.HypergridService
90 string gridService = serverConfig.GetString("GridService", String.Empty); 92 string gridService = serverConfig.GetString("GridService", String.Empty);
91 string presenceService = serverConfig.GetString("PresenceService", String.Empty); 93 string presenceService = serverConfig.GetString("PresenceService", String.Empty);
92 string userAgentService = serverConfig.GetString("UserAgentService", String.Empty); 94 string userAgentService = serverConfig.GetString("UserAgentService", String.Empty);
95 m_InGatekeeper = serverConfig.GetBoolean("InGatekeeper", false);
96 m_log.DebugFormat("[HG IM SERVICE]: Starting... InRobust? {0}", m_InGatekeeper);
97
93 98
94 if (gridService == string.Empty || presenceService == string.Empty) 99 if (gridService == string.Empty || presenceService == string.Empty)
95 throw new Exception(String.Format("Incomplete specifications, InstantMessage Service cannot function.")); 100 throw new Exception(String.Format("Incomplete specifications, InstantMessage Service cannot function."));
@@ -101,6 +106,21 @@ namespace OpenSim.Services.HypergridService
101 106
102 m_RegionCache = new ExpiringCache<UUID, GridRegion>(); 107 m_RegionCache = new ExpiringCache<UUID, GridRegion>();
103 108
109 IConfig cnf = config.Configs["Messaging"];
110 if (cnf == null)
111 {
112 return;
113 }
114
115 m_RestURL = cnf.GetString("OfflineMessageURL", string.Empty);
116 if (m_RestURL == string.Empty)
117 {
118 m_log.Error("[HG IM SERVICE]: Offline IMs enabled, but no URL is given");
119 return;
120 }
121
122 m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", false);
123
104 } 124 }
105 } 125 }
106 126
@@ -109,13 +129,21 @@ namespace OpenSim.Services.HypergridService
109 m_log.DebugFormat("[HG IM SERVICE]: Received message from {0} to {1}", im.fromAgentID, im.toAgentID); 129 m_log.DebugFormat("[HG IM SERVICE]: Received message from {0} to {1}", im.fromAgentID, im.toAgentID);
110 UUID toAgentID = new UUID(im.toAgentID); 130 UUID toAgentID = new UUID(im.toAgentID);
111 131
132 bool success = false;
112 if (m_IMSimConnector != null) 133 if (m_IMSimConnector != null)
113 { 134 {
114 //m_log.DebugFormat("[XXX] SendIMToRegion local im connector"); 135 //m_log.DebugFormat("[XXX] SendIMToRegion local im connector");
115 return m_IMSimConnector.SendInstantMessage(im); 136 success = m_IMSimConnector.SendInstantMessage(im);
116 } 137 }
117 else 138 else
118 return TrySendInstantMessage(im, "", true, false); 139 {
140 success = TrySendInstantMessage(im, "", true, false);
141 }
142
143 if (!success && m_InGatekeeper) // we do this only in the Gatekeeper IM service
144 UndeliveredMessage(im);
145
146 return success;
119 } 147 }
120 148
121 public bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner) 149 public bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner)
@@ -129,6 +157,7 @@ namespace OpenSim.Services.HypergridService
129 upd.RegionID = UUID.Zero; 157 upd.RegionID = UUID.Zero;
130 return TrySendInstantMessage(im, upd, true, foreigner); 158 return TrySendInstantMessage(im, upd, true, foreigner);
131 } 159 }
160
132 } 161 }
133 162
134 protected bool TrySendInstantMessage(GridInstantMessage im, object previousLocation, bool firstTime, bool foreigner) 163 protected bool TrySendInstantMessage(GridInstantMessage im, object previousLocation, bool firstTime, bool foreigner)
@@ -313,5 +342,19 @@ namespace OpenSim.Services.HypergridService
313 } 342 }
314 343
315 } 344 }
345
346 private bool UndeliveredMessage(GridInstantMessage im)
347 {
348 if (m_RestURL != string.Empty && (im.offline != 0)
349 && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
350 {
351 return SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
352 "POST", m_RestURL + "/SaveMessage/", im);
353
354 }
355
356 else
357 return false;
358 }
316 } 359 }
317} 360}
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example
index 7b2f8ac..812d265 100644
--- a/bin/Robust.HG.ini.example
+++ b/bin/Robust.HG.ini.example
@@ -356,8 +356,23 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
356 UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" 356 UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
357 357
358[HGInstantMessageService] 358[HGInstantMessageService]
359 LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInstantMessageService" 359 LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInstantMessageService"
360 GridService = "OpenSim.Services.GridService.dll:GridService" 360 GridService = "OpenSim.Services.GridService.dll:GridService"
361 PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" 361 PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
362 UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" 362 UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
363 ; This should always be true in the Robust config
364 InGatekeeper = True
365
366[Messaging]
367 ; If you have an Offline IM server, set the vars in this section, so that
368 ; incomming IMs to local users from foreign grids can be saved
369 ;
370 ;# {OfflineMessageURL} {OfflineMessageModule:OfflineMessageModule} {URL of offline messaging service} {}
371 ;; URL of web service for offline message storage
372 ; OfflineMessageURL = http://yourserver/Offline.php
373
374 ;; Control whether group messages are forwarded to offline users.
375 ;; Default is true.
376 ;; This applies to the core groups module (Flotsam) only.
377 ; ForwardOfflineGroupMessages = true
363 378