diff options
author | Dr Scofield | 2009-02-10 13:10:57 +0000 |
---|---|---|
committer | Dr Scofield | 2009-02-10 13:10:57 +0000 |
commit | 180be7de07014aa33bc6066f12a0819b731c1c9d (patch) | |
tree | 3aa13af3cda4b808fa9453655875327699b61311 /OpenSim/Region/CoreModules/Avatar/Profiles | |
parent | Stopgap measure: To use gridlaunch, or GUI, start opensim with (diff) | |
download | opensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.zip opensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.gz opensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.bz2 opensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.xz |
this is step 2 of 2 of the OpenSim.Region.Environment refactor.
NOTHING has been deleted or moved off to forge at this point. what
has happened is that OpenSim.Region.Environment.Modules has been split
in two:
- OpenSim.Region.CoreModules: all those modules that are either
directly or indirectly referenced from other OpenSim packages, or
that provide functionality that the OpenSim developer community
considers core functionality:
CoreModules/Agent/AssetTransaction
CoreModules/Agent/Capabilities
CoreModules/Agent/TextureDownload
CoreModules/Agent/TextureSender
CoreModules/Agent/TextureSender/Tests
CoreModules/Agent/Xfer
CoreModules/Avatar/AvatarFactory
CoreModules/Avatar/Chat/ChatModule
CoreModules/Avatar/Combat
CoreModules/Avatar/Currency/SampleMoney
CoreModules/Avatar/Dialog
CoreModules/Avatar/Friends
CoreModules/Avatar/Gestures
CoreModules/Avatar/Groups
CoreModules/Avatar/InstantMessage
CoreModules/Avatar/Inventory
CoreModules/Avatar/Inventory/Archiver
CoreModules/Avatar/Inventory/Transfer
CoreModules/Avatar/Lure
CoreModules/Avatar/ObjectCaps
CoreModules/Avatar/Profiles
CoreModules/Communications/Local
CoreModules/Communications/REST
CoreModules/Framework/EventQueue
CoreModules/Framework/InterfaceCommander
CoreModules/Hypergrid
CoreModules/InterGrid
CoreModules/Scripting/DynamicTexture
CoreModules/Scripting/EMailModules
CoreModules/Scripting/HttpRequest
CoreModules/Scripting/LoadImageURL
CoreModules/Scripting/VectorRender
CoreModules/Scripting/WorldComm
CoreModules/Scripting/XMLRPC
CoreModules/World/Archiver
CoreModules/World/Archiver/Tests
CoreModules/World/Estate
CoreModules/World/Land
CoreModules/World/Permissions
CoreModules/World/Serialiser
CoreModules/World/Sound
CoreModules/World/Sun
CoreModules/World/Terrain
CoreModules/World/Terrain/DefaultEffects
CoreModules/World/Terrain/DefaultEffects/bin
CoreModules/World/Terrain/DefaultEffects/bin/Debug
CoreModules/World/Terrain/Effects
CoreModules/World/Terrain/FileLoaders
CoreModules/World/Terrain/FloodBrushes
CoreModules/World/Terrain/PaintBrushes
CoreModules/World/Terrain/Tests
CoreModules/World/Vegetation
CoreModules/World/Wind
CoreModules/World/WorldMap
- OpenSim.Region.OptionalModules: all those modules that are not core
modules:
OptionalModules/Avatar/Chat/IRC-stuff
OptionalModules/Avatar/Concierge
OptionalModules/Avatar/Voice/AsterixVoice
OptionalModules/Avatar/Voice/SIPVoice
OptionalModules/ContentManagementSystem
OptionalModules/Grid/Interregion
OptionalModules/Python
OptionalModules/SvnSerialiser
OptionalModules/World/NPC
OptionalModules/World/TreePopulator
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Profiles')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs new file mode 100644 index 0000000..6ea5b56 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Globalization; | ||
30 | using System.Reflection; | ||
31 | using OpenMetaverse; | ||
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | |||
38 | namespace OpenSim.Region.CoreModules.Avatar.Profiles | ||
39 | { | ||
40 | public class AvatarProfilesModule : IRegionModule | ||
41 | { | ||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | private Scene m_scene; | ||
44 | |||
45 | public AvatarProfilesModule() | ||
46 | { | ||
47 | } | ||
48 | |||
49 | #region IRegionModule Members | ||
50 | |||
51 | public void Initialise(Scene scene, IConfigSource config) | ||
52 | { | ||
53 | m_scene = scene; | ||
54 | m_scene.EventManager.OnNewClient += NewClient; | ||
55 | } | ||
56 | |||
57 | public void PostInitialise() | ||
58 | { | ||
59 | } | ||
60 | |||
61 | public void Close() | ||
62 | { | ||
63 | } | ||
64 | |||
65 | public string Name | ||
66 | { | ||
67 | get { return "AvatarProfilesModule"; } | ||
68 | } | ||
69 | |||
70 | public bool IsSharedModule | ||
71 | { | ||
72 | get { return false; } | ||
73 | } | ||
74 | |||
75 | #endregion | ||
76 | |||
77 | public void NewClient(IClientAPI client) | ||
78 | { | ||
79 | client.OnRequestAvatarProperties += RequestAvatarProperty; | ||
80 | client.OnUpdateAvatarProperties += UpdateAvatarProperties; | ||
81 | } | ||
82 | |||
83 | public void RemoveClient(IClientAPI client) | ||
84 | { | ||
85 | client.OnRequestAvatarProperties -= RequestAvatarProperty; | ||
86 | client.OnUpdateAvatarProperties -= UpdateAvatarProperties; | ||
87 | } | ||
88 | |||
89 | /// <summary> | ||
90 | /// | ||
91 | /// </summary> | ||
92 | /// <param name="remoteClient"></param> | ||
93 | /// <param name="avatarID"></param> | ||
94 | public void RequestAvatarProperty(IClientAPI remoteClient, UUID avatarID) | ||
95 | { | ||
96 | // FIXME: finish adding fields such as url, masking, etc. | ||
97 | UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID); | ||
98 | if (null != profile) | ||
99 | { | ||
100 | Byte[] charterMember; | ||
101 | if (profile.CustomType == "") | ||
102 | { | ||
103 | charterMember = new Byte[1]; | ||
104 | charterMember[0] = (Byte)((profile.UserFlags & 0xf00) >> 8); | ||
105 | } | ||
106 | else | ||
107 | { | ||
108 | charterMember = Utils.StringToBytes(profile.CustomType); | ||
109 | } | ||
110 | |||
111 | remoteClient.SendAvatarProperties(profile.ID, profile.AboutText, | ||
112 | Util.ToDateTime(profile.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), | ||
113 | charterMember, profile.FirstLifeAboutText, (uint)(profile.UserFlags & 0xff), | ||
114 | profile.FirstLifeImage, profile.Image, String.Empty, profile.Partner); | ||
115 | } | ||
116 | else | ||
117 | { | ||
118 | m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString()); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile) | ||
123 | { | ||
124 | UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.ID); | ||
125 | |||
126 | // if it's the profile of the user requesting the update, then we change only a few things. | ||
127 | if (remoteClient.AgentId.CompareTo(Profile.ID) == 0) | ||
128 | { | ||
129 | Profile.Image = newProfile.Image; | ||
130 | Profile.FirstLifeImage = newProfile.FirstLifeImage; | ||
131 | Profile.AboutText = newProfile.AboutText; | ||
132 | Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText; | ||
133 | } | ||
134 | else | ||
135 | { | ||
136 | return; | ||
137 | } | ||
138 | |||
139 | if (m_scene.CommsManager.UserService.UpdateUserProfile(Profile)) | ||
140 | { | ||
141 | RequestAvatarProperty(remoteClient, newProfile.ID); | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 | } | ||