Tweak presence handling and whip up a database connector and handler

for testign the new generic table handling
0.6.8-post-fixes
Melanie 2009-11-18 08:21:28 +00:00
parent 0cd3bf074a
commit 06ecdf1967
5 changed files with 42 additions and 4 deletions

View File

@ -32,11 +32,11 @@ using OpenSim.Framework;
namespace OpenSim.Data
{
public class PresenceData
public struct PresenceData
{
public UUID UUID;
public UUID currentRegion;
public Dictionary<string, object> Data;
public Dictionary<string, string> Data;
}
/// <summary>

View File

@ -190,11 +190,13 @@ namespace OpenSim.Data.MySQL
return DoQuery(cmd);
}
public void Store(T row)
public bool Store(T row)
{
MySqlCommand cmd = new MySqlCommand();
string query = "";
return false;
}
}
}

View File

@ -94,6 +94,33 @@ namespace OpenSim.Server.Handlers.Presence
byte[] Report(Dictionary<string, string> request)
{
PresenceInfo info = new PresenceInfo();
info.Data = new Dictionary<string, string>();
if (request["PrincipalID"] == null || request["RegionID"] == null)
return FailureResult();
if (!UUID.TryParse(request["PrincipalID"].ToString(),
out info.PrincipalID))
return FailureResult();
if (!UUID.TryParse(request["RegionID"].ToString(),
out info.RegionID))
return FailureResult();
foreach (KeyValuePair<string, string> kvp in request)
{
if (kvp.Key == "METHOD" ||
kvp.Key == "PrincipalID" ||
kvp.Key == "RegionID")
continue;
info.Data[kvp.Key] = kvp.Value;
}
if (m_PresenceService.Report(info))
return SuccessResult();
return FailureResult();
}

View File

@ -35,7 +35,7 @@ namespace OpenSim.Services.Interfaces
{
public UUID PrincipalID;
public UUID RegionID;
public Dictionary<string, object> Data;
public Dictionary<string, string> Data;
}
public interface IPresenceService

View File

@ -52,6 +52,15 @@ namespace OpenSim.Services.PresenceService
public bool Report(PresenceInfo presence)
{
PresenceData p = new PresenceData();
p.Data = new Dictionary<string, string>();
p.UUID = presence.PrincipalID;
p.currentRegion = presence.RegionID;
foreach (KeyValuePair<string, string> kvp in presence.Data)
p.Data[kvp.Key] = kvp.Value;
return false;
}
}