Megapatch that fixes/adds: friend offer/deny/accept, friendship termination,

on-/offline updates, calling cards for friends.
This adds methods in the DB layer and changes the MessagingServer, so a full
update (incl. UGAIM) is necessary to get it working. Older regions shouldn't
break, nor should older UGAIM break newer regions, but friends/presence will
only work with all concerned parts (UGAIM, source region and destination
region) at this revision (or later).
I added the DB code for MSSQL, too, but couldn't test that.
BEWARE: May contain bugs.
This commit is contained in:
Homer Horwitz
2008-11-01 22:09:48 +00:00
parent e3a1ccf0b2
commit 38e8853e57
32 changed files with 1402 additions and 754 deletions

View File

@@ -570,6 +570,39 @@ namespace OpenSim.Data.MSSQL
return friendList;
}
override public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
{
Dictionary<UUID, FriendRegionInfo> infos = new Dictionary<UUID,FriendRegionInfo>();
try
{
foreach (UUID uuid in uuids)
{
using (AutoClosingSqlCommand command = database.Query(
"select agentOnline,currentHandle from " + m_agentsTableName + " where UUID = @uuid"))
{
command.Parameters.Add(database.CreateParameter("@uuid", uuid));
using (IDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
FriendRegionInfo fri = new FriendRegionInfo();
fri.isOnline = (sbyte)reader["agentOnline"] != 0;
fri.regionHandle = (ulong)reader["currentHandle"];
infos[uuid] = fri;
}
}
}
}
}
catch (Exception e)
{
m_log.Warn("[MSSQL]: Got exception on trying to find friends regions:", e);
}
return infos;
}
#endregion
#region Money functions (not used)

View File

@@ -365,6 +365,49 @@ namespace OpenSim.Data.MySQL
return Lfli;
}
override public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
{
MySQLSuperManager dbm = GetLockedConnection("GetFriendRegionInfos");
Dictionary<UUID, FriendRegionInfo> infos = new Dictionary<UUID,FriendRegionInfo>();
try
{
foreach (UUID uuid in uuids)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["?uuid"] = uuid.ToString();
IDbCommand result =
dbm.Manager.Query("select agentOnline,currentHandle from " + m_agentsTableName +
" where UUID = ?uuid", param);
IDataReader reader = result.ExecuteReader();
while (reader.Read())
{
FriendRegionInfo fri = new FriendRegionInfo();
fri.isOnline = (sbyte)reader["agentOnline"] != 0;
fri.regionHandle = (ulong)reader["currentHandle"];
infos[uuid] = fri;
}
reader.Dispose();
result.Dispose();
}
}
catch (Exception e)
{
m_log.Warn("[MYSQL]: Got exception on trying to find friends regions:", e);
dbm.Manager.Reconnect();
m_log.Error(e.ToString());
}
finally
{
dbm.Release();
}
return infos;
}
#endregion
public override void UpdateUserCurrentRegion(UUID avatarid, UUID regionuuid, ulong regionhandle)

View File

@@ -255,6 +255,7 @@ namespace OpenSim.Data.NHibernate
public override void RemoveUserFriend(UUID friendlistowner, UUID friend) { return; }
public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) { return; }
public override List<FriendListItem> GetUserFriendList(UUID friendlistowner) { return new List<FriendListItem>(); }
public override Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids) { return new Dictionary<UUID, FriendRegionInfo>(); }
public override bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return true; }
public override bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return true; }

View File

@@ -332,8 +332,28 @@ namespace OpenSim.Data.SQLite
return returnlist;
}
override public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
{
Dictionary<UUID, FriendRegionInfo> infos = new Dictionary<UUID,FriendRegionInfo>();
DataTable agents = ds.Tables["useragents"];
foreach (UUID uuid in uuids)
{
lock (ds)
{
DataRow row = agents.Rows.Find(Util.ToRawUuidString(uuid));
if (row == null) infos[uuid] = null;
else
{
FriendRegionInfo fri = new FriendRegionInfo();
fri.isOnline = (bool)row["agentOnline"];
fri.regionHandle = Convert.ToUInt64(row["currentHandle"]);
infos[uuid] = fri;
}
}
}
return infos;
}
#endregion

View File

@@ -53,6 +53,7 @@ namespace OpenSim.Data
public abstract void RemoveUserFriend(UUID friendlistowner, UUID friend);
public abstract void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms);
public abstract List<FriendListItem> GetUserFriendList(UUID friendlistowner);
public abstract Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids);
public abstract bool MoneyTransferRequest(UUID from, UUID to, uint amount);
public abstract bool InventoryTransferRequest(UUID from, UUID to, UUID inventory);
public abstract List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query);