Make SimianFriendsServiceConnector initialize like the other connectors and gracefully handle the case where it is loaded but disabled #monoaddinslol
parent
83f6550bcc
commit
fc062a23af
|
@ -76,38 +76,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
bool isSimianEnabled = false;
|
IConfig gridConfig = source.Configs["FriendsService"];
|
||||||
|
if (gridConfig != null)
|
||||||
if (source.Configs["Friends"] != null)
|
|
||||||
{
|
{
|
||||||
string module = source.Configs["Friends"].GetString("Connector");
|
string serviceUrl = gridConfig.GetString("FriendsServerURI");
|
||||||
isSimianEnabled = !String.IsNullOrEmpty(module) && module.EndsWith(this.Name);
|
if (!String.IsNullOrEmpty(serviceUrl))
|
||||||
|
{
|
||||||
|
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
|
||||||
|
serviceUrl = serviceUrl + '/';
|
||||||
|
m_serverUrl = serviceUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSimianEnabled)
|
if (String.IsNullOrEmpty(m_serverUrl))
|
||||||
{
|
m_log.Info("[SIMIAN FRIENDS CONNECTOR]: No FriendsServerURI specified, disabling connector");
|
||||||
IConfig assetConfig = source.Configs["FriendsService"];
|
|
||||||
if (assetConfig == null)
|
|
||||||
{
|
|
||||||
m_log.Error("[SIMIAN FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini");
|
|
||||||
throw new Exception("Friends connector init error");
|
|
||||||
}
|
|
||||||
|
|
||||||
string serviceURI = assetConfig.GetString("FriendsServerURI");
|
|
||||||
if (String.IsNullOrEmpty(serviceURI))
|
|
||||||
{
|
|
||||||
m_log.Error("[SIMIAN FRIENDS CONNECTOR]: No Server URI named in section FriendsService");
|
|
||||||
throw new Exception("Friends connector init error");
|
|
||||||
}
|
|
||||||
|
|
||||||
m_serverUrl = serviceURI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IFriendsService
|
#region IFriendsService
|
||||||
|
|
||||||
public FriendInfo[] GetFriends(UUID principalID)
|
public FriendInfo[] GetFriends(UUID principalID)
|
||||||
{
|
{
|
||||||
|
if (String.IsNullOrEmpty(m_serverUrl))
|
||||||
|
return new FriendInfo[0];
|
||||||
|
|
||||||
Dictionary<UUID, FriendInfo> friends = new Dictionary<UUID, FriendInfo>();
|
Dictionary<UUID, FriendInfo> friends = new Dictionary<UUID, FriendInfo>();
|
||||||
|
|
||||||
OSDArray friendsArray = GetFriended(principalID);
|
OSDArray friendsArray = GetFriended(principalID);
|
||||||
|
@ -156,6 +147,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
|
|
||||||
public bool StoreFriend(UUID principalID, string friend, int flags)
|
public bool StoreFriend(UUID principalID, string friend, int flags)
|
||||||
{
|
{
|
||||||
|
if (String.IsNullOrEmpty(m_serverUrl))
|
||||||
|
return true;
|
||||||
|
|
||||||
NameValueCollection requestArgs = new NameValueCollection
|
NameValueCollection requestArgs = new NameValueCollection
|
||||||
{
|
{
|
||||||
{ "RequestMethod", "AddGeneric" },
|
{ "RequestMethod", "AddGeneric" },
|
||||||
|
@ -176,6 +170,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
|
|
||||||
public bool Delete(UUID principalID, string friend)
|
public bool Delete(UUID principalID, string friend)
|
||||||
{
|
{
|
||||||
|
if (String.IsNullOrEmpty(m_serverUrl))
|
||||||
|
return true;
|
||||||
|
|
||||||
NameValueCollection requestArgs = new NameValueCollection
|
NameValueCollection requestArgs = new NameValueCollection
|
||||||
{
|
{
|
||||||
{ "RequestMethod", "RemoveGeneric" },
|
{ "RequestMethod", "RemoveGeneric" },
|
||||||
|
|
Loading…
Reference in New Issue