aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMike Mazur2009-02-03 05:20:35 +0000
committerMike Mazur2009-02-03 05:20:35 +0000
commitd3eae4073e75d1482467eee54230df141bdbb568 (patch)
tree63aaa3a0bab86d0df8dc5e19c08915e630ad5834 /OpenSim/Framework
parent- move OpenSim/Framework/IInventoryData.cs to (diff)
downloadopensim-SC-d3eae4073e75d1482467eee54230df141bdbb568.zip
opensim-SC-d3eae4073e75d1482467eee54230df141bdbb568.tar.gz
opensim-SC-d3eae4073e75d1482467eee54230df141bdbb568.tar.bz2
opensim-SC-d3eae4073e75d1482467eee54230df141bdbb568.tar.xz
- move OpenSim/Framework/IUserData.cs to OpenSim/Data/IUserData.cs
- trim trailing whitespace
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs60
-rw-r--r--OpenSim/Framework/IUserData.cs192
2 files changed, 30 insertions, 222 deletions
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 2e3efd5..b12abb3 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -35,8 +35,8 @@ using OpenMetaverse;
35using OpenMetaverse.StructuredData; 35using OpenMetaverse.StructuredData;
36using log4net; 36using log4net;
37using Nwc.XmlRpc; 37using Nwc.XmlRpc;
38using OpenSim.Framework;
39using OpenSim.Framework.Statistics; 38using OpenSim.Framework.Statistics;
39using OpenSim.Data;
40 40
41namespace OpenSim.Framework.Communications 41namespace OpenSim.Framework.Communications
42{ 42{
@@ -52,22 +52,22 @@ namespace OpenSim.Framework.Communications
52 /// List of plugins to search for user data 52 /// List of plugins to search for user data
53 /// </value> 53 /// </value>
54 private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>(); 54 private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>();
55 55
56 protected IInterServiceInventoryServices m_interServiceInventoryService; 56 protected IInterServiceInventoryServices m_interServiceInventoryService;
57 57
58 /// <summary> 58 /// <summary>
59 /// Constructor 59 /// Constructor
60 /// </summary> 60 /// </summary>
61 /// <param name="interServiceInventoryService"></param> 61 /// <param name="interServiceInventoryService"></param>
62 public UserManagerBase(IInterServiceInventoryServices interServiceInventoryService) 62 public UserManagerBase(IInterServiceInventoryServices interServiceInventoryService)
63 { 63 {
64 m_interServiceInventoryService = interServiceInventoryService; 64 m_interServiceInventoryService = interServiceInventoryService;
65 } 65 }
66 66
67 /// <summary> 67 /// <summary>
68 /// Add a new user data plugin - plugins will be requested in the order they were added. 68 /// Add a new user data plugin - plugins will be requested in the order they were added.
69 /// </summary> 69 /// </summary>
70 /// <param name="plugin">The plugin that will provide user data</param> 70 /// <param name="plugin">The plugin that will provide user data</param>
71 public void AddPlugin(IUserDataPlugin plugin) 71 public void AddPlugin(IUserDataPlugin plugin)
72 { 72 {
73 _plugins.Add(plugin); 73 _plugins.Add(plugin);
@@ -85,13 +85,13 @@ namespace OpenSim.Framework.Communications
85 85
86 // loader will try to load all providers (MySQL, MSSQL, etc) 86 // loader will try to load all providers (MySQL, MSSQL, etc)
87 // unless it is constrainted to the correct "Provider" entry in the addin.xml 87 // unless it is constrainted to the correct "Provider" entry in the addin.xml
88 loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider)); 88 loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider));
89 loader.Load(); 89 loader.Load();
90 90
91 _plugins.AddRange(loader.Plugins); 91 _plugins.AddRange(loader.Plugins);
92 } 92 }
93 93
94 #region Get UserProfile 94 #region Get UserProfile
95 95
96 // see IUserService 96 // see IUserService
97 public UserProfileData GetUserProfile(string fname, string lname) 97 public UserProfileData GetUserProfile(string fname, string lname)
@@ -109,7 +109,7 @@ namespace OpenSim.Framework.Communications
109 109
110 return null; 110 return null;
111 } 111 }
112 112
113 public void LogoutUsers(UUID regionID) 113 public void LogoutUsers(UUID regionID)
114 { 114 {
115 foreach (IUserDataPlugin plugin in _plugins) 115 foreach (IUserDataPlugin plugin in _plugins)
@@ -117,7 +117,7 @@ namespace OpenSim.Framework.Communications
117 plugin.LogoutUsers(regionID); 117 plugin.LogoutUsers(regionID);
118 } 118 }
119 } 119 }
120 120
121 public void ResetAttachments(UUID userID) 121 public void ResetAttachments(UUID userID)
122 { 122 {
123 foreach (IUserDataPlugin plugin in _plugins) 123 foreach (IUserDataPlugin plugin in _plugins)
@@ -125,7 +125,7 @@ namespace OpenSim.Framework.Communications
125 plugin.ResetAttachments(userID); 125 plugin.ResetAttachments(userID);
126 } 126 }
127 } 127 }
128 128
129 public UserAgentData GetAgentByUUID(UUID userId) 129 public UserAgentData GetAgentByUUID(UUID userId)
130 { 130 {
131 foreach (IUserDataPlugin plugin in _plugins) 131 foreach (IUserDataPlugin plugin in _plugins)
@@ -140,7 +140,7 @@ namespace OpenSim.Framework.Communications
140 140
141 return null; 141 return null;
142 } 142 }
143 143
144 // see IUserService 144 // see IUserService
145 public virtual UserProfileData GetUserProfile(UUID uuid) 145 public virtual UserProfileData GetUserProfile(UUID uuid)
146 { 146 {
@@ -173,7 +173,7 @@ namespace OpenSim.Framework.Communications
173 return new List<AvatarPickerAvatar>(); 173 return new List<AvatarPickerAvatar>();
174 } 174 }
175 } 175 }
176 176
177 return pickerlist; 177 return pickerlist;
178 } 178 }
179 179
@@ -216,8 +216,8 @@ namespace OpenSim.Framework.Communications
216 try 216 try
217 { 217 {
218 UserAgentData result = plugin.GetAgentByUUID(uuid); 218 UserAgentData result = plugin.GetAgentByUUID(uuid);
219 219
220 if (result != null) 220 if (result != null)
221 { 221 {
222 return result; 222 return result;
223 } 223 }
@@ -288,8 +288,8 @@ namespace OpenSim.Framework.Communications
288 try 288 try
289 { 289 {
290 List<FriendListItem> result = plugin.GetUserFriendList(ownerID); 290 List<FriendListItem> result = plugin.GetUserFriendList(ownerID);
291 291
292 if (result != null) 292 if (result != null)
293 { 293 {
294 return result; 294 return result;
295 } 295 }
@@ -310,8 +310,8 @@ namespace OpenSim.Framework.Communications
310 try 310 try
311 { 311 {
312 Dictionary<UUID, FriendRegionInfo> result = plugin.GetFriendRegionInfos(uuids); 312 Dictionary<UUID, FriendRegionInfo> result = plugin.GetFriendRegionInfos(uuids);
313 313
314 if (result != null) 314 if (result != null)
315 { 315 {
316 return result; 316 return result;
317 } 317 }
@@ -396,7 +396,7 @@ namespace OpenSim.Framework.Communications
396 { 396 {
397 return; 397 return;
398 } 398 }
399 399
400 profile.CurrentAgent = null; 400 profile.CurrentAgent = null;
401 401
402 UpdateUserProfile(profile); 402 UpdateUserProfile(profile);
@@ -623,7 +623,7 @@ namespace OpenSim.Framework.Communications
623 string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID) 623 string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID)
624 { 624 {
625 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); 625 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
626 626
627 UserProfileData user = new UserProfileData(); 627 UserProfileData user = new UserProfileData();
628 user.HomeLocation = new Vector3(128, 128, 100); 628 user.HomeLocation = new Vector3(128, 128, 100);
629 user.ID = SetUUID; 629 user.ID = SetUUID;
@@ -657,9 +657,9 @@ namespace OpenSim.Framework.Communications
657 else 657 else
658 { 658 {
659 m_interServiceInventoryService.CreateNewUserInventory(userProf.ID); 659 m_interServiceInventoryService.CreateNewUserInventory(userProf.ID);
660 660
661 return userProf.ID; 661 return userProf.ID;
662 } 662 }
663 } 663 }
664 664
665 /// <summary> 665 /// <summary>
@@ -672,22 +672,22 @@ namespace OpenSim.Framework.Communications
672 public bool ResetUserPassword(string firstName, string lastName, string newPassword) 672 public bool ResetUserPassword(string firstName, string lastName, string newPassword)
673 { 673 {
674 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(newPassword) + ":" + String.Empty); 674 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(newPassword) + ":" + String.Empty);
675 675
676 UserProfileData profile = GetUserProfile(firstName, lastName); 676 UserProfileData profile = GetUserProfile(firstName, lastName);
677 677
678 if (null == profile) 678 if (null == profile)
679 { 679 {
680 m_log.ErrorFormat("[USERSTORAGE]: Could not find user {0} {1}", firstName, lastName); 680 m_log.ErrorFormat("[USERSTORAGE]: Could not find user {0} {1}", firstName, lastName);
681 return false; 681 return false;
682 } 682 }
683 683
684 profile.PasswordHash = md5PasswdHash; 684 profile.PasswordHash = md5PasswdHash;
685 profile.PasswordSalt = String.Empty; 685 profile.PasswordSalt = String.Empty;
686 686
687 UpdateUserProfile(profile); 687 UpdateUserProfile(profile);
688 688
689 return true; 689 return true;
690 } 690 }
691 691
692 public abstract UserProfileData SetupMasterUser(string firstName, string lastName); 692 public abstract UserProfileData SetupMasterUser(string firstName, string lastName);
693 public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); 693 public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password);
diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs
deleted file mode 100644
index 4653255..0000000
--- a/OpenSim/Framework/IUserData.cs
+++ /dev/null
@@ -1,192 +0,0 @@
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
28using System.Collections.Generic;
29using OpenMetaverse;
30
31namespace OpenSim.Framework
32{
33 /// <summary>
34 /// An interface for connecting to user storage servers.
35 /// </summary>
36 public interface IUserDataPlugin : IPlugin
37 {
38 /// <summary>
39 /// Returns a user profile from a database via their UUID
40 /// </summary>
41 /// <param name="user">The user's UUID</param>
42 /// <returns>The user data profile. Returns null if no user is found</returns>
43 UserProfileData GetUserByUUID(UUID user);
44
45 /// <summary>
46 /// Returns a users profile by searching their username parts
47 /// </summary>
48 /// <param name="fname">Account firstname</param>
49 /// <param name="lname">Account lastname</param>
50 /// <returns>The user data profile</returns>
51 UserProfileData GetUserByName(string fname, string lname);
52
53 /// <summary>
54 /// Returns a list of UUIDs firstnames and lastnames that match string query entered into the avatar picker.
55 /// </summary>
56 /// <param name="queryID">ID associated with the user's query. This must match what the client sent</param>
57 /// <param name="query">The filtered contents of the search box when the user hit search.</param>
58 /// <returns>The user data profile</returns>
59 List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query);
60
61 /// <summary>
62 /// Returns the current agent for a user searching by it's UUID
63 /// </summary>
64 /// <param name="user">The users UUID</param>
65 /// <returns>The current agent session</returns>
66 UserAgentData GetAgentByUUID(UUID user);
67
68 /// <summary>
69 /// Returns the current session agent for a user searching by username
70 /// </summary>
71 /// <param name="name">The users account name</param>
72 /// <returns>The current agent session</returns>
73 UserAgentData GetAgentByName(string name);
74
75 /// <summary>
76 /// Returns the current session agent for a user searching by username parts
77 /// </summary>
78 /// <param name="fname">The users first account name</param>
79 /// <param name="lname">The users account surname</param>
80 /// <returns>The current agent session</returns>
81 UserAgentData GetAgentByName(string fname, string lname);
82
83 /// <summary>
84 /// Stores new web-login key for user during web page login
85 /// </summary>
86 /// <param name="webLoginKey"></param>
87 void StoreWebLoginKey(UUID agentID, UUID webLoginKey);
88
89 /// <summary>
90 /// Adds a new User profile to the database
91 /// </summary>
92 /// <param name="user">UserProfile to add</param>
93 void AddNewUserProfile(UserProfileData user);
94
95 /// <summary></summary>
96 /// Updates an existing user profile
97 /// </summary>
98 /// <param name="user">UserProfile to update</param>
99 bool UpdateUserProfile(UserProfileData user);
100
101 /// <summary>
102 /// Adds a new agent to the database
103 /// </summary>
104 /// <param name="agent">The agent to add</param>
105 void AddNewUserAgent(UserAgentData agent);
106
107 /// <summary>
108 /// Adds a new friend to the database for XUser
109 /// </summary>
110 /// <param name="friendlistowner">The agent that who's friends list is being added to</param>
111 /// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
112 /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
113 void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms);
114
115 /// <summary>
116 /// Delete friend on friendlistowner's friendlist.
117 /// </summary>
118 /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
119 /// <param name="friend">The Ex-friend agent</param>
120 void RemoveUserFriend(UUID friendlistowner, UUID friend);
121
122 /// <summary>
123 /// Update permissions for friend on friendlistowner's friendlist.
124 /// </summary>
125 /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
126 /// <param name="friend">The agent that is getting or loosing permissions</param>
127 /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
128 void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms);
129
130 /// <summary>
131 /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner
132 /// </summary>
133 /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
134 List<FriendListItem> GetUserFriendList(UUID friendlistowner);
135
136 /// <summary>
137 /// Returns a list of <see cref="FriendRegionInfo/>s for the specified UUIDs.
138 /// </summary>
139 /// <param name="uuids">
140 /// A <see cref="List"/> of <see cref="UUID/>s to fetch info for
141 /// </param>
142 /// <returns>
143 /// A <see cref="Dictionary"/>, mapping the <see cref="UUID"/>s to <see cref="FriendRegionInfo"/>s.
144 /// </returns>
145 Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids);
146
147 /// <summary>
148 /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
149 /// </summary>
150 /// <param name="from">The account to transfer from</param>
151 /// <param name="to">The account to transfer to</param>
152 /// <param name="amount">The amount to transfer</param>
153 /// <returns>Successful?</returns>
154 bool MoneyTransferRequest(UUID from, UUID to, uint amount);
155
156 /// <summary>
157 /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account.
158 /// </summary>
159 /// <param name="from">User to transfer from</param>
160 /// <param name="to">User to transfer to</param>
161 /// <param name="inventory">Specified inventory item</param>
162 /// <returns>Successful?</returns>
163 bool InventoryTransferRequest(UUID from, UUID to, UUID inventory);
164
165 /// <summary>
166 /// Initialises the plugin (artificial constructor)
167 /// </summary>
168 void Initialise(string connect);
169
170 /// <summary>
171 /// Gets the user appearance
172 /// </summer>
173 AvatarAppearance GetUserAppearance(UUID user);
174
175 void UpdateUserAppearance(UUID user, AvatarAppearance appearance);
176
177 void ResetAttachments(UUID userID);
178
179 void LogoutUsers(UUID regionID);
180 }
181
182 public class UserDataInitialiser : PluginInitialiserBase
183 {
184 private string connect;
185 public UserDataInitialiser (string s) { connect = s; }
186 public override void Initialise (IPlugin plugin)
187 {
188 IUserDataPlugin p = plugin as IUserDataPlugin;
189 p.Initialise (connect);
190 }
191 }
192}