aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-03-03 08:30:36 +0000
committerTeravus Ovares2008-03-03 08:30:36 +0000
commitfe49c96ee0db0974a91b9b175ac1b00aef035797 (patch)
tree27fb1de9eea228d2e89e1c5b1c83cca8577b3bd9 /OpenSim/Region
parent* Doh, forgot one license header (diff)
downloadopensim-SC_OLD-fe49c96ee0db0974a91b9b175ac1b00aef035797.zip
opensim-SC_OLD-fe49c96ee0db0974a91b9b175ac1b00aef035797.tar.gz
opensim-SC_OLD-fe49c96ee0db0974a91b9b175ac1b00aef035797.tar.bz2
opensim-SC_OLD-fe49c96ee0db0974a91b9b175ac1b00aef035797.tar.xz
* Applying Ahzz's profile patch. Thanks Ahzz!
* Fixed a few bugs in the patch that are sim crashers. * There's still a bug in mySQL mode/ grid mode where the main userprofile text doesn't save.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs27
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs42
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs45
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs2
4 files changed, 106 insertions, 10 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index d032a2e..fe12cb7 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -123,6 +123,7 @@ namespace OpenSim.Region.ClientStack
123 //- used so we don't create new objects for each incoming packet and then toss it out later */ 123 //- used so we don't create new objects for each incoming packet and then toss it out later */
124 124
125 private RequestAvatarProperties handlerRequestAvatarProperties = null; //OnRequestAvatarProperties; 125 private RequestAvatarProperties handlerRequestAvatarProperties = null; //OnRequestAvatarProperties;
126 private UpdateAvatarProperties handlerUpdateAvatarProperties = null; // OnUpdateAvatarProperties;
126 private ChatFromViewer handlerChatFromViewer = null; //OnChatFromViewer; 127 private ChatFromViewer handlerChatFromViewer = null; //OnChatFromViewer;
127 private ChatFromViewer handlerChatFromViewer2 = null; //OnChatFromViewer; 128 private ChatFromViewer handlerChatFromViewer2 = null; //OnChatFromViewer;
128 private ImprovedInstantMessage handlerInstantMessage = null; //OnInstantMessage; 129 private ImprovedInstantMessage handlerInstantMessage = null; //OnInstantMessage;
@@ -217,7 +218,6 @@ namespace OpenSim.Region.ClientStack
217 private PacketStats handlerPacketStats = null; // OnPacketStats;# 218 private PacketStats handlerPacketStats = null; // OnPacketStats;#
218 private RequestAsset handlerRequestAsset = null; // OnRequestAsset; 219 private RequestAsset handlerRequestAsset = null; // OnRequestAsset;
219 220
220
221 /* Properties */ 221 /* Properties */
222 222
223 public LLUUID SecureSessionId 223 public LLUUID SecureSessionId
@@ -670,6 +670,7 @@ namespace OpenSim.Region.ClientStack
670 public event FetchInventory OnAgentDataUpdateRequest; 670 public event FetchInventory OnAgentDataUpdateRequest;
671 public event FetchInventory OnUserInfoRequest; 671 public event FetchInventory OnUserInfoRequest;
672 public event TeleportLocationRequest OnSetStartLocationRequest; 672 public event TeleportLocationRequest OnSetStartLocationRequest;
673 public event UpdateAvatarProperties OnUpdateAvatarProperties;
673 674
674 675
675 public event CreateNewInventoryItem OnCreateNewInventoryItem; 676 public event CreateNewInventoryItem OnCreateNewInventoryItem;
@@ -1591,7 +1592,10 @@ namespace OpenSim.Region.ClientStack
1591 avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText); 1592 avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText);
1592 avatarReply.PropertiesData.BornOn = Helpers.StringToField(bornOn); 1593 avatarReply.PropertiesData.BornOn = Helpers.StringToField(bornOn);
1593 avatarReply.PropertiesData.CharterMember = Helpers.StringToField(charterMember); 1594 avatarReply.PropertiesData.CharterMember = Helpers.StringToField(charterMember);
1594 avatarReply.PropertiesData.FLAboutText = Helpers.StringToField(flAbout); 1595 if (flAbout != null)
1596 avatarReply.PropertiesData.FLAboutText = Helpers.StringToField(flAbout);
1597 else
1598 avatarReply.PropertiesData.FLAboutText = Helpers.StringToField("");
1595 avatarReply.PropertiesData.Flags = 0; 1599 avatarReply.PropertiesData.Flags = 0;
1596 avatarReply.PropertiesData.FLImageID = flImageID; 1600 avatarReply.PropertiesData.FLImageID = flImageID;
1597 avatarReply.PropertiesData.ImageID = imageID; 1601 avatarReply.PropertiesData.ImageID = imageID;
@@ -2901,10 +2905,25 @@ namespace OpenSim.Region.ClientStack
2901 if (handlerChatFromViewer != null) 2905 if (handlerChatFromViewer != null)
2902 handlerChatFromViewer(this, args); 2906 handlerChatFromViewer(this, args);
2903 } 2907 }
2908 break;
2909 case PacketType.AvatarPropertiesUpdate:
2910 AvatarPropertiesUpdatePacket Packet = (AvatarPropertiesUpdatePacket)Pack;
2904 2911
2905 2912 handlerUpdateAvatarProperties = OnUpdateAvatarProperties;
2906 2913 if (handlerUpdateAvatarProperties != null)
2914 {
2915 AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = Packet.PropertiesData;
2916 UserProfileData UserProfile = new UserProfileData();
2917 UserProfile.UUID = AgentId;
2918 UserProfile.profileAboutText = Util.FieldToString(Properties.AboutText);
2919 UserProfile.profileFirstText = Util.FieldToString(Properties.FLAboutText);
2920 UserProfile.profileFirstImage = Properties.FLImageID;
2921 UserProfile.profileImage = Properties.ImageID;
2922
2923 handlerUpdateAvatarProperties(this, UserProfile);
2924 }
2907 break; 2925 break;
2926
2908 case PacketType.ScriptDialogReply: 2927 case PacketType.ScriptDialogReply:
2909 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; 2928 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
2910 int ch = rdialog.Data.ChatChannel; 2929 int ch = rdialog.Data.ChatChannel;
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 8ad4468..7dcbb46 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -270,6 +270,48 @@ namespace OpenSim.Region.Communications.OGS1
270 throw new Exception("The method or operation is not implemented."); 270 throw new Exception("The method or operation is not implemented.");
271 } 271 }
272 272
273 public bool UpdateUserProfileProperties(UserProfileData UserProfile)
274 {
275 m_log.Debug("[OGS1UserService]: Asking UserServer to update profile.");
276 Hashtable param = new Hashtable();
277 param["avatar_uuid"] = UserProfile.UUID.ToString();
278 //param["AllowPublish"] = UserProfile.ToString();
279 param["FLImageID"] = UserProfile.profileFirstImage.ToString();
280 param["ImageID"] = UserProfile.profileImage.ToString();
281 //param["MaturePublish"] = MaturePublish.ToString();
282 param["AboutText"] = UserProfile.profileAboutText;
283 param["FLAboutText"] = UserProfile.profileFirstText;
284 //param["ProfileURL"] = UserProfile.ProfileURL.ToString();
285 IList parameters = new ArrayList();
286 parameters.Add(param);
287
288 XmlRpcRequest req = new XmlRpcRequest("update_user_profile", parameters);
289 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
290 Hashtable respData = (Hashtable)resp.Value;
291 if (respData != null)
292 {
293 if (respData.Contains("returnString"))
294 {
295 if (((string)respData["returnString"]).ToUpper() != "TRUE")
296 {
297 m_log.Warn("[GRID]: Unable to update user profile, User Server Reported an issue");
298 return false;
299 }
300 }
301 else
302 {
303 m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!");
304 return false;
305 }
306 }
307 else
308 {
309 m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!");
310 return false;
311 }
312 return true;
313 }
314
273 #region IUserServices Friend Methods 315 #region IUserServices Friend Methods
274 /// <summary> 316 /// <summary>
275 /// Adds a new friend to the database for XUser 317 /// Adds a new friend to the database for XUser
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
index 8f4a0a1..711236d 100644
--- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
@@ -36,6 +36,7 @@ namespace OpenSim.Region.Environment.Modules
36{ 36{
37 public class AvatarProfilesModule : IRegionModule 37 public class AvatarProfilesModule : IRegionModule
38 { 38 {
39 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
39 private Scene m_scene; 40 private Scene m_scene;
40 41
41 public AvatarProfilesModule() 42 public AvatarProfilesModule()
@@ -69,11 +70,13 @@ namespace OpenSim.Region.Environment.Modules
69 public void NewClient(IClientAPI client) 70 public void NewClient(IClientAPI client)
70 { 71 {
71 client.OnRequestAvatarProperties += RequestAvatarProperty; 72 client.OnRequestAvatarProperties += RequestAvatarProperty;
73 client.OnUpdateAvatarProperties += UpdateAvatarProperties;
72 } 74 }
73 75
74 public void RemoveClient(IClientAPI client) 76 public void RemoveClient(IClientAPI client)
75 { 77 {
76 client.OnRequestAvatarProperties -= RequestAvatarProperty; 78 client.OnRequestAvatarProperties -= RequestAvatarProperty;
79 client.OnUpdateAvatarProperties -= UpdateAvatarProperties;
77 } 80 }
78 81
79 /// <summary> 82 /// <summary>
@@ -83,12 +86,42 @@ namespace OpenSim.Region.Environment.Modules
83 /// <param name="avatarID"></param> 86 /// <param name="avatarID"></param>
84 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) 87 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
85 { 88 {
86 string about = "OpenSim crash test dummy"; 89 // FIXME: finish adding fields such as url, masking, etc.
87 string bornOn = "Before now";
88 string flAbout = "First life? What is one of those? OpenSim is my life!";
89 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); 90 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
90 remoteClient.SendAvatarProperties(avatarID, about, bornOn, System.String.Empty, flAbout, 0, LLUUID.Zero, LLUUID.Zero, System.String.Empty, 91 UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID);
91 partner); 92 if (null != profile)
93 {
94 remoteClient.SendAvatarProperties(profile.UUID, profile.profileAboutText,
95 Util.ToDateTime(profile.created).ToString(),
96 System.String.Empty, profile.profileFirstText, profile.profileCanDoMask,
97 profile.profileFirstImage, profile.profileImage, System.String.Empty, partner);
98 }
99 else
100 {
101 m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString());
102 }
103 }
104
105 public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile)
106 {
107 UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.UUID);
108
109 // if it's the profile of the user requesting the update, then we change only a few things.
110 if (remoteClient.AgentId.CompareTo(Profile.UUID) == 0)
111 {
112 Profile.profileImage = newProfile.profileImage;
113 Profile.profileFirstImage = newProfile.profileFirstImage;
114 Profile.profileAboutText = newProfile.profileAboutText;
115 Profile.profileFirstText = newProfile.profileFirstText;
116 }
117 else
118 {
119 return;
120 }
121 if (m_scene.CommsManager.UserService.UpdateUserProfileProperties(Profile))
122 {
123 RequestAvatarProperty(remoteClient, newProfile.UUID);
124 }
92 } 125 }
93 } 126 }
94} \ No newline at end of file 127}
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 30a41b7..cb2c908 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -154,6 +154,8 @@ namespace SimpleApp
154 public event FriendshipTermination OnTerminateFriendship; 154 public event FriendshipTermination OnTerminateFriendship;
155 public event PacketStats OnPacketStats; 155 public event PacketStats OnPacketStats;
156 public event MoneyBalanceRequest OnMoneyBalanceRequest; 156 public event MoneyBalanceRequest OnMoneyBalanceRequest;
157 public event UpdateAvatarProperties OnUpdateAvatarProperties;
158
157 159
158#pragma warning restore 67 160#pragma warning restore 67
159 161