aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
authorJohn Hurliman2010-09-03 14:50:26 -0700
committerJohn Hurliman2010-09-03 14:50:26 -0700
commitfc062a23afab6d5391960240da3953a5865cc12d (patch)
tree30dc656773a1ea174d5ade0df33c6065f5da601c /OpenSim/Services/Connectors
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-fc062a23afab6d5391960240da3953a5865cc12d.zip
opensim-SC_OLD-fc062a23afab6d5391960240da3953a5865cc12d.tar.gz
opensim-SC_OLD-fc062a23afab6d5391960240da3953a5865cc12d.tar.bz2
opensim-SC_OLD-fc062a23afab6d5391960240da3953a5865cc12d.tar.xz
Make SimianFriendsServiceConnector initialize like the other connectors and gracefully handle the case where it is loaded but disabled #monoaddinslol
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs41
1 files changed, 19 insertions, 22 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
index 89f3594..1afb1e1 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
@@ -76,38 +76,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
76 76
77 public void Initialise(IConfigSource source) 77 public void Initialise(IConfigSource source)
78 { 78 {
79 bool isSimianEnabled = false; 79 IConfig gridConfig = source.Configs["FriendsService"];
80 80 if (gridConfig != null)
81 if (source.Configs["Friends"] != null)
82 {
83 string module = source.Configs["Friends"].GetString("Connector");
84 isSimianEnabled = !String.IsNullOrEmpty(module) && module.EndsWith(this.Name);
85 }
86
87 if (isSimianEnabled)
88 { 81 {
89 IConfig assetConfig = source.Configs["FriendsService"]; 82 string serviceUrl = gridConfig.GetString("FriendsServerURI");
90 if (assetConfig == null) 83 if (!String.IsNullOrEmpty(serviceUrl))
91 {
92 m_log.Error("[SIMIAN FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini");
93 throw new Exception("Friends connector init error");
94 }
95
96 string serviceURI = assetConfig.GetString("FriendsServerURI");
97 if (String.IsNullOrEmpty(serviceURI))
98 { 84 {
99 m_log.Error("[SIMIAN FRIENDS CONNECTOR]: No Server URI named in section FriendsService"); 85 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
100 throw new Exception("Friends connector init error"); 86 serviceUrl = serviceUrl + '/';
87 m_serverUrl = serviceUrl;
101 } 88 }
102
103 m_serverUrl = serviceURI;
104 } 89 }
90
91 if (String.IsNullOrEmpty(m_serverUrl))
92 m_log.Info("[SIMIAN FRIENDS CONNECTOR]: No FriendsServerURI specified, disabling connector");
105 } 93 }
106 94
107 #region IFriendsService 95 #region IFriendsService
108 96
109 public FriendInfo[] GetFriends(UUID principalID) 97 public FriendInfo[] GetFriends(UUID principalID)
110 { 98 {
99 if (String.IsNullOrEmpty(m_serverUrl))
100 return new FriendInfo[0];
101
111 Dictionary<UUID, FriendInfo> friends = new Dictionary<UUID, FriendInfo>(); 102 Dictionary<UUID, FriendInfo> friends = new Dictionary<UUID, FriendInfo>();
112 103
113 OSDArray friendsArray = GetFriended(principalID); 104 OSDArray friendsArray = GetFriended(principalID);
@@ -156,6 +147,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
156 147
157 public bool StoreFriend(UUID principalID, string friend, int flags) 148 public bool StoreFriend(UUID principalID, string friend, int flags)
158 { 149 {
150 if (String.IsNullOrEmpty(m_serverUrl))
151 return true;
152
159 NameValueCollection requestArgs = new NameValueCollection 153 NameValueCollection requestArgs = new NameValueCollection
160 { 154 {
161 { "RequestMethod", "AddGeneric" }, 155 { "RequestMethod", "AddGeneric" },
@@ -176,6 +170,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
176 170
177 public bool Delete(UUID principalID, string friend) 171 public bool Delete(UUID principalID, string friend)
178 { 172 {
173 if (String.IsNullOrEmpty(m_serverUrl))
174 return true;
175
179 NameValueCollection requestArgs = new NameValueCollection 176 NameValueCollection requestArgs = new NameValueCollection
180 { 177 {
181 { "RequestMethod", "RemoveGeneric" }, 178 { "RequestMethod", "RemoveGeneric" },