aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/Profiles/AvatarProfilesModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Profiles/AvatarProfilesModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Profiles/AvatarProfilesModule.cs264
1 files changed, 132 insertions, 132 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Profiles/AvatarProfilesModule.cs
index 1955d2a..15825b6 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Profiles/AvatarProfilesModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Profiles/AvatarProfilesModule.cs
@@ -1,133 +1,133 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using libsecondlife; 30using libsecondlife;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
36 36
37namespace OpenSim.Region.Environment.Modules.Avatar.Profiles 37namespace OpenSim.Region.Environment.Modules.Avatar.Profiles
38{ 38{
39 public class AvatarProfilesModule : IRegionModule 39 public class AvatarProfilesModule : IRegionModule
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 private Scene m_scene; 42 private Scene m_scene;
43 43
44 public AvatarProfilesModule() 44 public AvatarProfilesModule()
45 { 45 {
46 } 46 }
47 47
48 #region IRegionModule Members 48 #region IRegionModule Members
49 49
50 public void Initialise(Scene scene, IConfigSource config) 50 public void Initialise(Scene scene, IConfigSource config)
51 { 51 {
52 m_scene = scene; 52 m_scene = scene;
53 m_scene.EventManager.OnNewClient += NewClient; 53 m_scene.EventManager.OnNewClient += NewClient;
54 } 54 }
55 55
56 public void PostInitialise() 56 public void PostInitialise()
57 { 57 {
58 } 58 }
59 59
60 public void Close() 60 public void Close()
61 { 61 {
62 } 62 }
63 63
64 public string Name 64 public string Name
65 { 65 {
66 get { return "AvatarProfilesModule"; } 66 get { return "AvatarProfilesModule"; }
67 } 67 }
68 68
69 public bool IsSharedModule 69 public bool IsSharedModule
70 { 70 {
71 get { return false; } 71 get { return false; }
72 } 72 }
73 73
74 #endregion 74 #endregion
75 75
76 public void NewClient(IClientAPI client) 76 public void NewClient(IClientAPI client)
77 { 77 {
78 client.OnRequestAvatarProperties += RequestAvatarProperty; 78 client.OnRequestAvatarProperties += RequestAvatarProperty;
79 client.OnUpdateAvatarProperties += UpdateAvatarProperties; 79 client.OnUpdateAvatarProperties += UpdateAvatarProperties;
80 } 80 }
81 81
82 public void RemoveClient(IClientAPI client) 82 public void RemoveClient(IClientAPI client)
83 { 83 {
84 client.OnRequestAvatarProperties -= RequestAvatarProperty; 84 client.OnRequestAvatarProperties -= RequestAvatarProperty;
85 client.OnUpdateAvatarProperties -= UpdateAvatarProperties; 85 client.OnUpdateAvatarProperties -= UpdateAvatarProperties;
86 } 86 }
87 87
88 /// <summary> 88 /// <summary>
89 /// 89 ///
90 /// </summary> 90 /// </summary>
91 /// <param name="remoteClient"></param> 91 /// <param name="remoteClient"></param>
92 /// <param name="avatarID"></param> 92 /// <param name="avatarID"></param>
93 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) 93 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
94 { 94 {
95 // FIXME: finish adding fields such as url, masking, etc. 95 // FIXME: finish adding fields such as url, masking, etc.
96 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); 96 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
97 UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID); 97 UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID);
98 if (null != profile) 98 if (null != profile)
99 { 99 {
100 remoteClient.SendAvatarProperties(profile.ID, profile.AboutText, 100 remoteClient.SendAvatarProperties(profile.ID, profile.AboutText,
101 Util.ToDateTime(profile.Created).ToString(), 101 Util.ToDateTime(profile.Created).ToString(),
102 String.Empty, profile.FirstLifeAboutText, profile.CanDoMask, 102 String.Empty, profile.FirstLifeAboutText, profile.CanDoMask,
103 profile.FirstLifeImage, profile.Image, String.Empty, partner); 103 profile.FirstLifeImage, profile.Image, String.Empty, partner);
104 } 104 }
105 else 105 else
106 { 106 {
107 m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString()); 107 m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString());
108 } 108 }
109 } 109 }
110 110
111 public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile) 111 public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile)
112 { 112 {
113 UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.ID); 113 UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.ID);
114 114
115 // if it's the profile of the user requesting the update, then we change only a few things. 115 // if it's the profile of the user requesting the update, then we change only a few things.
116 if (remoteClient.AgentId.CompareTo(Profile.ID) == 0) 116 if (remoteClient.AgentId.CompareTo(Profile.ID) == 0)
117 { 117 {
118 Profile.Image = newProfile.Image; 118 Profile.Image = newProfile.Image;
119 Profile.FirstLifeImage = newProfile.FirstLifeImage; 119 Profile.FirstLifeImage = newProfile.FirstLifeImage;
120 Profile.AboutText = newProfile.AboutText; 120 Profile.AboutText = newProfile.AboutText;
121 Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText; 121 Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText;
122 } 122 }
123 else 123 else
124 { 124 {
125 return; 125 return;
126 } 126 }
127 if (m_scene.CommsManager.UserService.UpdateUserProfileProperties(Profile)) 127 if (m_scene.CommsManager.UserService.UpdateUserProfileProperties(Profile))
128 { 128 {
129 RequestAvatarProperty(remoteClient, newProfile.ID); 129 RequestAvatarProperty(remoteClient, newProfile.ID);
130 } 130 }
131 } 131 }
132 } 132 }
133} \ No newline at end of file 133} \ No newline at end of file