Add methods to allow the groups modules to query online status and last login
parent
35911d2362
commit
d6b9504c84
|
@ -171,6 +171,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||||
{
|
{
|
||||||
return m_GridUserService.GetGridUserInfo(userID);
|
return m_GridUserService.GetGridUserInfo(userID);
|
||||||
}
|
}
|
||||||
|
public GridUserInfo[] GetGridUserInfo(string[] userID)
|
||||||
|
{
|
||||||
|
return m_GridUserService.GetGridUserInfo(userID);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||||
return m_RemoteConnector.GetGridUserInfo(userID);
|
return m_RemoteConnector.GetGridUserInfo(userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GridUserInfo[] GetGridUserInfo(string[] userID)
|
||||||
|
{
|
||||||
|
return m_RemoteConnector.GetGridUserInfo(userID);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,8 @@ namespace OpenSim.Server.Handlers.GridUser
|
||||||
return SetPosition(request);
|
return SetPosition(request);
|
||||||
case "getgriduserinfo":
|
case "getgriduserinfo":
|
||||||
return GetGridUserInfo(request);
|
return GetGridUserInfo(request);
|
||||||
|
case "getgriduserinfos":
|
||||||
|
return GetGridUserInfos(request);
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[GRID USER HANDLER]: unknown method request: {0}", method);
|
m_log.DebugFormat("[GRID USER HANDLER]: unknown method request: {0}", method);
|
||||||
}
|
}
|
||||||
|
@ -193,6 +195,46 @@ namespace OpenSim.Server.Handlers.GridUser
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte[] GetGridUserInfos(Dictionary<string, object> request)
|
||||||
|
{
|
||||||
|
|
||||||
|
string[] userIDs;
|
||||||
|
|
||||||
|
if (!request.ContainsKey("AgentIDs"))
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID USER HANDLER]: GetGridUserInfos called without required uuids argument");
|
||||||
|
return FailureResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(request["AgentIDs"] is List<string>))
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID USER HANDLER]: GetGridUserInfos input argument was of unexpected type {0}", request["uuids"].GetType().ToString());
|
||||||
|
return FailureResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
userIDs = ((List<string>)request["AgentIDs"]).ToArray();
|
||||||
|
|
||||||
|
GridUserInfo[] pinfos = m_GridUserService.GetGridUserInfo(userIDs);
|
||||||
|
|
||||||
|
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||||
|
if ((pinfos == null) || ((pinfos != null) && (pinfos.Length == 0)))
|
||||||
|
result["result"] = "null";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
foreach (GridUserInfo pinfo in pinfos)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> rinfoDict = pinfo.ToKeyValuePairs();
|
||||||
|
result["griduser" + i] = rinfoDict;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
private bool UnpackArgs(Dictionary<string, object> request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt)
|
private bool UnpackArgs(Dictionary<string, object> request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt)
|
||||||
{
|
{
|
||||||
user = string.Empty;
|
user = string.Empty;
|
||||||
|
|
|
@ -223,5 +223,65 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GridUserInfo[] GetGridUserInfo(string[] userIDs)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||||
|
//sendData["SCOPEID"] = scopeID.ToString();
|
||||||
|
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
|
||||||
|
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
|
||||||
|
sendData["METHOD"] = "getgriduserinfos";
|
||||||
|
|
||||||
|
sendData["AgentIDs"] = new List<string>(userIDs);
|
||||||
|
|
||||||
|
string reply = string.Empty;
|
||||||
|
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||||
|
//m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||||
|
m_ServerURI + "/griduser",
|
||||||
|
reqString);
|
||||||
|
if (reply == null || (reply != null && reply == string.Empty))
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GRID USER CONNECTOR]: Exception when contacting grid user server: {0}", e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<GridUserInfo> rinfos = new List<GridUserInfo>();
|
||||||
|
|
||||||
|
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||||
|
|
||||||
|
if (replyData != null)
|
||||||
|
{
|
||||||
|
if (replyData.ContainsKey("result") &&
|
||||||
|
(replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure"))
|
||||||
|
{
|
||||||
|
return new GridUserInfo[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, object>.ValueCollection pinfosList = replyData.Values;
|
||||||
|
//m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count);
|
||||||
|
foreach (object griduser in pinfosList)
|
||||||
|
{
|
||||||
|
if (griduser is Dictionary<string, object>)
|
||||||
|
{
|
||||||
|
GridUserInfo pinfo = new GridUserInfo((Dictionary<string, object>)griduser);
|
||||||
|
rinfos.Add(pinfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received invalid response type {0}",
|
||||||
|
griduser.GetType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null response");
|
||||||
|
|
||||||
|
return rinfos.ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -472,6 +472,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GridUserInfo[] GetGridUserInfo(string[] userIDs)
|
||||||
|
{
|
||||||
|
return new GridUserInfo[0];
|
||||||
|
}
|
||||||
#endregion Helpers
|
#endregion Helpers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,5 +131,6 @@ namespace OpenSim.Services.Interfaces
|
||||||
bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt);
|
bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt);
|
||||||
|
|
||||||
GridUserInfo GetGridUserInfo(string userID);
|
GridUserInfo GetGridUserInfo(string userID);
|
||||||
|
GridUserInfo[] GetGridUserInfo(string[] userID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,16 @@ namespace OpenSim.Services.UserAccountService
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GridUserInfo[] GetGridUserInfo(string[] userIDs)
|
||||||
|
{
|
||||||
|
List<GridUserInfo> ret = new List<GridUserInfo>();
|
||||||
|
|
||||||
|
foreach (string id in userIDs)
|
||||||
|
ret.Add(GetGridUserInfo(id));
|
||||||
|
|
||||||
|
return ret.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
public GridUserInfo LoggedIn(string userID)
|
public GridUserInfo LoggedIn(string userID)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[GRID USER SERVICE]: User {0} is online", userID);
|
m_log.DebugFormat("[GRID USER SERVICE]: User {0} is online", userID);
|
||||||
|
@ -156,4 +166,4 @@ namespace OpenSim.Services.UserAccountService
|
||||||
return m_Database.Store(d);
|
return m_Database.Store(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue