Database and presence changes. Untested

slimupdates
Melanie 2009-12-28 17:34:42 +00:00
parent f43a648052
commit 92a40129b5
8 changed files with 39 additions and 44 deletions

View File

@ -35,7 +35,7 @@ namespace OpenSim.Data
// This MUST be a ref type! // This MUST be a ref type!
public class PresenceData public class PresenceData
{ {
public UUID PrincipalID; public string UserID;
public UUID RegionID; public UUID RegionID;
public UUID SessionID; public UUID SessionID;
public Dictionary<string, string> Data; public Dictionary<string, string> Data;

View File

@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
#region IPresenceService #region IPresenceService
public bool LoginAgent(UUID principalID, UUID sessionID, UUID secureSessionID) public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID)
{ {
m_log.Warn("[LOCAL PRESENCE CONNECTOR]: LoginAgent connector not implemented at the simulators"); m_log.Warn("[LOCAL PRESENCE CONNECTOR]: LoginAgent connector not implemented at the simulators");
return false; return false;
@ -175,9 +175,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
return m_PresenceService.GetAgent(sessionID); return m_PresenceService.GetAgent(sessionID);
} }
public PresenceInfo[] GetAgents(string[] principalIDs) public PresenceInfo[] GetAgents(string[] userIDs)
{ {
return m_PresenceService.GetAgents(principalIDs); return m_PresenceService.GetAgents(userIDs);
} }
#endregion #endregion

View File

@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
#region IPresenceService #region IPresenceService
public bool LoginAgent(UUID principalID, UUID sessionID, UUID secureSessionID) public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID)
{ {
m_log.Warn("[REMOTE PRESENCE CONNECTOR]: LoginAgent connector not implemented at the simulators"); m_log.Warn("[REMOTE PRESENCE CONNECTOR]: LoginAgent connector not implemented at the simulators");
return false; return false;
@ -148,9 +148,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
return m_RemoteConnector.GetAgent(sessionID); return m_RemoteConnector.GetAgent(sessionID);
} }
public PresenceInfo[] GetAgents(string[] principalIDs) public PresenceInfo[] GetAgents(string[] userIDs)
{ {
return m_RemoteConnector.GetAgents(principalIDs); return m_RemoteConnector.GetAgents(userIDs);
} }
#endregion #endregion

View File

@ -104,15 +104,14 @@ namespace OpenSim.Server.Handlers.Presence
byte[] LoginAgent(Dictionary<string, object> request) byte[] LoginAgent(Dictionary<string, object> request)
{ {
UUID principal = UUID.Zero; string user = String.Empty;
UUID session = UUID.Zero; UUID session = UUID.Zero;
UUID ssession = UUID.Zero; UUID ssession = UUID.Zero;
if (!request.ContainsKey("PrincipalID") || !request.ContainsKey("SessionID")) if (!request.ContainsKey("UserID") || !request.ContainsKey("SessionID"))
return FailureResult(); return FailureResult();
if (!UUID.TryParse(request["PrincipalID"].ToString(), out principal)) user = request["UserID"].ToString();
return FailureResult();
if (!UUID.TryParse(request["SessionID"].ToString(), out session)) if (!UUID.TryParse(request["SessionID"].ToString(), out session))
return FailureResult(); return FailureResult();
@ -121,7 +120,7 @@ namespace OpenSim.Server.Handlers.Presence
// If it's malformed, we go on with a Zero on it // If it's malformed, we go on with a Zero on it
UUID.TryParse(request["SecureSessionID"].ToString(), out ssession); UUID.TryParse(request["SecureSessionID"].ToString(), out ssession);
if (m_PresenceService.LoginAgent(principal, session, ssession)) if (m_PresenceService.LoginAgent(user, session, ssession))
return SuccessResult(); return SuccessResult();
return FailureResult(); return FailureResult();

View File

@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors
#region IPresenceService #region IPresenceService
public bool LoginAgent(UUID principalID, UUID sessionID, UUID secureSessionID) public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID)
{ {
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();
//sendData["SCOPEID"] = scopeID.ToString(); //sendData["SCOPEID"] = scopeID.ToString();
@ -94,7 +94,7 @@ namespace OpenSim.Services.Connectors
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
sendData["METHOD"] = "login"; sendData["METHOD"] = "login";
sendData["PrincipalID"] = principalID.ToString(); sendData["UserID"] = userID;
sendData["SessionID"] = sessionID.ToString(); sendData["SessionID"] = sessionID.ToString();
sendData["SecureSessionID"] = secureSessionID.ToString(); sendData["SecureSessionID"] = secureSessionID.ToString();

View File

@ -34,7 +34,7 @@ namespace OpenSim.Services.Interfaces
{ {
public class PresenceInfo public class PresenceInfo
{ {
public UUID PrincipalID; public string UserID;
public UUID RegionID; public UUID RegionID;
public bool Online; public bool Online;
public DateTime Login; public DateTime Login;
@ -48,8 +48,8 @@ namespace OpenSim.Services.Interfaces
public PresenceInfo(Dictionary<string, object> kvp) public PresenceInfo(Dictionary<string, object> kvp)
{ {
if (kvp.ContainsKey("PrincipalID")) if (kvp.ContainsKey("UserID"))
UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID); UserID = kvp["UserID"].ToString();
if (kvp.ContainsKey("RegionID")) if (kvp.ContainsKey("RegionID"))
UUID.TryParse(kvp["RegionID"].ToString(), out RegionID); UUID.TryParse(kvp["RegionID"].ToString(), out RegionID);
if (kvp.ContainsKey("login")) if (kvp.ContainsKey("login"))
@ -68,7 +68,7 @@ namespace OpenSim.Services.Interfaces
public Dictionary<string, object> ToKeyValuePairs() public Dictionary<string, object> ToKeyValuePairs()
{ {
Dictionary<string, object> result = new Dictionary<string, object>(); Dictionary<string, object> result = new Dictionary<string, object>();
result["PrincipalID"] = PrincipalID.ToString(); result["UserID"] = UserID;
result["RegionID"] = RegionID.ToString(); result["RegionID"] = RegionID.ToString();
result["online"] = Online.ToString(); result["online"] = Online.ToString();
result["login"] = Login.ToString(); result["login"] = Login.ToString();
@ -82,7 +82,7 @@ namespace OpenSim.Services.Interfaces
public interface IPresenceService public interface IPresenceService
{ {
bool LoginAgent(UUID principalID, UUID sessionID, UUID secureSessionID); bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID);
bool LogoutAgent(UUID sessionID); bool LogoutAgent(UUID sessionID);
bool LogoutRegionAgents(UUID regionID); bool LogoutRegionAgents(UUID regionID);

View File

@ -50,7 +50,7 @@ namespace OpenSim.Services.PresenceService
{ {
} }
public bool LoginAgent(UUID principalID, UUID sessionID, public bool LoginAgent(string userID, UUID sessionID,
UUID secureSessionID) UUID secureSessionID)
{ {
// We have just logged in. If there is any info in the table // We have just logged in. If there is any info in the table
@ -58,7 +58,7 @@ namespace OpenSim.Services.PresenceService
// //
PresenceData data = new PresenceData(); PresenceData data = new PresenceData();
data.PrincipalID = principalID; data.UserID = userID;
data.RegionID = UUID.Zero; data.RegionID = UUID.Zero;
data.SessionID = sessionID; data.SessionID = sessionID;
data.Data["SecureSessionID"] = secureSessionID.ToString(); data.Data["SecureSessionID"] = secureSessionID.ToString();
@ -105,7 +105,7 @@ namespace OpenSim.Services.PresenceService
if (data == null) if (data == null)
return null; return null;
ret.PrincipalID = data.PrincipalID; ret.UserID = data.UserID;
ret.RegionID = data.RegionID; ret.RegionID = data.RegionID;
ret.Online = bool.Parse(data.Data["Online"]); ret.Online = bool.Parse(data.Data["Online"]);
ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"])); ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"]));
@ -116,23 +116,20 @@ namespace OpenSim.Services.PresenceService
return ret; return ret;
} }
public PresenceInfo[] GetAgents(string[] principalIDs) public PresenceInfo[] GetAgents(string[] userIDs)
{ {
List<PresenceInfo> info = new List<PresenceInfo>(); List<PresenceInfo> info = new List<PresenceInfo>();
foreach (string principalIDStr in principalIDs) foreach (string userIDStr in userIDs)
{ {
UUID principalID = UUID.Zero; PresenceData[] data = m_Database.Get("UserID",
if (UUID.TryParse(principalIDStr, out principalID)) userIDStr);
{
PresenceData[] data = m_Database.Get("PrincipalID",
principalID.ToString());
foreach (PresenceData d in data) foreach (PresenceData d in data)
{ {
PresenceInfo ret = new PresenceInfo(); PresenceInfo ret = new PresenceInfo();
ret.PrincipalID = d.PrincipalID; ret.UserID = d.UserID;
ret.RegionID = d.RegionID; ret.RegionID = d.RegionID;
ret.Online = bool.Parse(d.Data["Online"]); ret.Online = bool.Parse(d.Data["Online"]);
ret.Login = Util.ToDateTime(Convert.ToInt32( ret.Login = Util.ToDateTime(Convert.ToInt32(
@ -145,7 +142,6 @@ namespace OpenSim.Services.PresenceService
info.Add(ret); info.Add(ret);
} }
} }
}
return info.ToArray(); return info.ToArray();
} }

View File

@ -44,7 +44,7 @@ namespace OpenSim.Services.PresenceService
{ {
string dllName = String.Empty; string dllName = String.Empty;
string connString = String.Empty; string connString = String.Empty;
string realm = "agents"; string realm = "Presence";
// //
// Try reading the [DatabaseService] section, if it exists // Try reading the [DatabaseService] section, if it exists