From 7f8a69f181aba493416c8b5c6e8aa4be8fde7a34 Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 13 Nov 2007 10:47:39 +0000 Subject: Some work on being able to set/send a users Buddylist info. (added handling code to LoginResponse). And as a test each user signing in will get the test account ("Mr OpenSim") as a friend (online/offline status will not currently show up) --- OpenSim/Framework/Communications/LoginResponse.cs | 64 +++++++++++++++++++++- .../Communications/Local/LocalLoginService.cs | 4 ++ 2 files changed, 67 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index 4d1c35a..a8c3f23 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs @@ -28,6 +28,7 @@ using System; using System.Collections; +using System.Collections.Generic; using libsecondlife; using Nwc.XmlRpc; using OpenSim.Framework.Console; @@ -99,6 +100,8 @@ namespace OpenSim.Framework.UserManagement private string seedCapability; private string lookAt; + private BuddyList m_buddyList = null; + public LoginResponse() { loginFlags = new ArrayList(); @@ -291,7 +294,11 @@ namespace OpenSim.Framework.UserManagement responseData["region_y"] = (Int32) RegionY*256; //responseData["inventory-lib-root"] = new ArrayList(); // todo - //responseData["buddy-list"] = new ArrayList(); // todo + + if (m_buddyList != null) + { + responseData["buddy-list"] = m_buddyList.ToArray(); + } responseData["login"] = "true"; xmlRpcResponse.Value = responseData; @@ -510,6 +517,12 @@ namespace OpenSim.Framework.UserManagement set { welcomeMessage = value; } } + public BuddyList BuddList + { + get{return m_buddyList;} + set { m_buddyList = value; } + } + #endregion public class UserInfo @@ -520,5 +533,54 @@ namespace OpenSim.Framework.UserManagement public LLVector3 homepos; public LLVector3 homelookat; } + + public class BuddyList + { + public List Buddies = new List(); + + public void AddNewBuddy(BuddyInfo buddy) + { + if (!Buddies.Contains(buddy)) + { + Buddies.Add(buddy); + } + } + + public ArrayList ToArray() + { + ArrayList buddyArray = new ArrayList(); + foreach (BuddyInfo buddy in Buddies) + { + buddyArray.Add(buddy.ToHashTable()); + } + return buddyArray; + } + + public class BuddyInfo + { + public int BuddyRightsHave = 1; + public int BuddyRightsGiven = 1; + public LLUUID BuddyID; + + public BuddyInfo(string buddyID) + { + BuddyID = new LLUUID(buddyID); + } + + public BuddyInfo(LLUUID buddyID) + { + BuddyID = buddyID; + } + + public Hashtable ToHashTable() + { + Hashtable hTable = new Hashtable(); + hTable["buddy_rights_has"] = BuddyRightsHave; + hTable["buddy_rights_given"] = BuddyRightsGiven; + hTable["buddy_id"] = BuddyID.ToStringHyphenated(); + return hTable; + } + } + } } } \ No newline at end of file diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index aa1a0d9..eef6ed4 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -131,6 +131,10 @@ namespace OpenSim.Region.Communications.Local // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; theUser.currentAgent.currentRegion = reg.RegionID; theUser.currentAgent.currentHandle = reg.RegionHandle; + + LoginResponse.BuddyList buddyList = new LoginResponse.BuddyList(); + buddyList.AddNewBuddy(new LoginResponse.BuddyList.BuddyInfo("11111111-1111-0000-0000-000100bba000")); + response.BuddList = buddyList; Login _login = new Login(); //copy data to login object -- cgit v1.1