aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Addons/OfflineIM
diff options
context:
space:
mode:
authorJustin Clark-Casey2014-05-27 23:29:54 +0100
committerJustin Clark-Casey2014-05-27 23:29:54 +0100
commit3f703ae1cb02cbcb0efaff061d495bacca941de0 (patch)
tree3221068b4bc4119023b3dfa621c19e126c2eb3f3 /OpenSim/Addons/OfflineIM
parentMerge branch 'master' into 0.8-post-fixes (diff)
parentminor: Comment out 2 error level debugging message in authentication code (diff)
downloadopensim-SC_OLD-3f703ae1cb02cbcb0efaff061d495bacca941de0.zip
opensim-SC_OLD-3f703ae1cb02cbcb0efaff061d495bacca941de0.tar.gz
opensim-SC_OLD-3f703ae1cb02cbcb0efaff061d495bacca941de0.tar.bz2
opensim-SC_OLD-3f703ae1cb02cbcb0efaff061d495bacca941de0.tar.xz
Merge branch 'master' into 0.8-post-fixes
Diffstat (limited to 'OpenSim/Addons/OfflineIM')
-rw-r--r--OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs6
-rw-r--r--OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs17
-rw-r--r--OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs9
-rw-r--r--OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs4
4 files changed, 25 insertions, 11 deletions
diff --git a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
index 5ef068a..5340bcd 100644
--- a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
+++ b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
@@ -66,7 +66,7 @@ namespace OpenSim.OfflineIM
66 if (serviceLocation == string.Empty) 66 if (serviceLocation == string.Empty)
67 m_OfflineIMService = new OfflineIMService(config); 67 m_OfflineIMService = new OfflineIMService(config);
68 else 68 else
69 m_OfflineIMService = new OfflineIMServiceRemoteConnector(serviceLocation); 69 m_OfflineIMService = new OfflineIMServiceRemoteConnector(config);
70 70
71 m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages); 71 m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
72 m_log.DebugFormat("[OfflineIM.V2]: Offline messages enabled by {0}", Name); 72 m_log.DebugFormat("[OfflineIM.V2]: Offline messages enabled by {0}", Name);
@@ -226,10 +226,6 @@ namespace OpenSim.OfflineIM
226 return; 226 return;
227 } 227 }
228 228
229 Scene scene = FindScene(new UUID(im.fromAgentID));
230 if (scene == null)
231 scene = m_SceneList[0];
232
233 string reason = string.Empty; 229 string reason = string.Empty;
234 bool success = m_OfflineIMService.StoreMessage(im, out reason); 230 bool success = m_OfflineIMService.StoreMessage(im, out reason);
235 231
diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs
index eb287a4..047b8be 100644
--- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs
+++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs
@@ -32,6 +32,7 @@ using System.Reflection;
32using System.Text; 32using System.Text;
33 33
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.ServiceAuth;
35using OpenSim.Server.Base; 36using OpenSim.Server.Base;
36using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
37 38
@@ -46,6 +47,7 @@ namespace OpenSim.OfflineIM
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 48
48 private string m_ServerURI = string.Empty; 49 private string m_ServerURI = string.Empty;
50 private IServiceAuth m_Auth;
49 private object m_Lock = new object(); 51 private object m_Lock = new object();
50 52
51 public OfflineIMServiceRemoteConnector(string url) 53 public OfflineIMServiceRemoteConnector(string url)
@@ -65,6 +67,18 @@ namespace OpenSim.OfflineIM
65 67
66 m_ServerURI = cnf.GetString("OfflineMessageURL", string.Empty); 68 m_ServerURI = cnf.GetString("OfflineMessageURL", string.Empty);
67 69
70 /// This is from BaseServiceConnector
71 string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", "Messaging" }, "None");
72
73 switch (authType)
74 {
75 case "BasicHttpAuthentication":
76 m_Auth = new BasicHttpAuthentication(config, "Messaging");
77 break;
78 }
79 ///
80 m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0} with auth {1}",
81 m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString()));
68 } 82 }
69 83
70 #region IOfflineIMService 84 #region IOfflineIMService
@@ -143,7 +157,8 @@ namespace OpenSim.OfflineIM
143 lock (m_Lock) 157 lock (m_Lock)
144 reply = SynchronousRestFormsRequester.MakeRequest("POST", 158 reply = SynchronousRestFormsRequester.MakeRequest("POST",
145 m_ServerURI + "/offlineim", 159 m_ServerURI + "/offlineim",
146 ServerUtils.BuildQueryString(sendData)); 160 ServerUtils.BuildQueryString(sendData),
161 m_Auth);
147 162
148 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( 163 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
149 reply); 164 reply);
diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
index ed5c742..c44b6cc 100644
--- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
+++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
@@ -36,6 +36,7 @@ using OpenSim.Framework;
36using OpenSim.Server.Base; 36using OpenSim.Server.Base;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using OpenSim.Framework.Servers.HttpServer; 38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Framework.ServiceAuth;
39using OpenSim.Server.Handlers.Base; 40using OpenSim.Server.Handlers.Base;
40using log4net; 41using log4net;
41using OpenMetaverse; 42using OpenMetaverse;
@@ -59,7 +60,9 @@ namespace OpenSim.OfflineIM
59 60
60 m_OfflineIMService = new OfflineIMService(config); 61 m_OfflineIMService = new OfflineIMService(config);
61 62
62 server.AddStreamHandler(new OfflineIMServicePostHandler(m_OfflineIMService)); 63 IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
64
65 server.AddStreamHandler(new OfflineIMServicePostHandler(m_OfflineIMService, auth));
63 } 66 }
64 } 67 }
65 68
@@ -69,8 +72,8 @@ namespace OpenSim.OfflineIM
69 72
70 private IOfflineIMService m_OfflineIMService; 73 private IOfflineIMService m_OfflineIMService;
71 74
72 public OfflineIMServicePostHandler(IOfflineIMService service) : 75 public OfflineIMServicePostHandler(IOfflineIMService service, IServiceAuth auth) :
73 base("POST", "/offlineim") 76 base("POST", "/offlineim", auth)
74 { 77 {
75 m_OfflineIMService = service; 78 m_OfflineIMService = service;
76 } 79 }
diff --git a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
index 690c955..02084ff 100644
--- a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
+++ b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
@@ -104,7 +104,7 @@ namespace OpenSim.OfflineIM
104 using (MemoryStream mstream = new MemoryStream()) 104 using (MemoryStream mstream = new MemoryStream())
105 { 105 {
106 XmlWriterSettings settings = new XmlWriterSettings(); 106 XmlWriterSettings settings = new XmlWriterSettings();
107 settings.Encoding = Encoding.UTF8; 107 settings.Encoding = Util.UTF8NoBomEncoding;
108 108
109 using (XmlWriter writer = XmlWriter.Create(mstream, settings)) 109 using (XmlWriter writer = XmlWriter.Create(mstream, settings))
110 { 110 {
@@ -112,7 +112,7 @@ namespace OpenSim.OfflineIM
112 writer.Flush(); 112 writer.Flush();
113 } 113 }
114 114
115 imXml = Util.UTF8.GetString(mstream.ToArray()); 115 imXml = Util.UTF8NoBomEncoding.GetString(mstream.ToArray());
116 } 116 }
117 117
118 OfflineIMData data = new OfflineIMData(); 118 OfflineIMData data = new OfflineIMData();