Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Open Simulator Technical Help
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
OpenSimulator Internals/Code Map/ROBUST/AgentPreferencesService
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= OpenSimulator Internals/Code Map/ROBUST/AgentPreferencesService = == Overview == AgentPreferencesService stores per-user viewer preferences: language, hover height, access tier, and default creation permissions. It is a thin wrapper over a single database table. Source files: OpenSim/Services/UserAccountService/AgentPreferencesService.cs OpenSim/Services/UserAccountService/AgentPreferencesServiceBase.cs Note: these files live in the UserAccountService directory, not a separate AgentPreferencesService directory. ---- === Constructor and Config Loading === AgentPreferencesServiceBase(IConfigSource config) Config is read in two layers; [AgentPreferencesService] overrides [DatabaseService]. Unlike other services, [AgentPreferencesService] is required -- the constructor throws if the section is absent. {| class="wikitable" ! Section !! Key !! Default !! Notes |- | [DatabaseService] || StorageProvider || (none) || DLL name -- fallback |- | [DatabaseService] || ConnectionString || (none) || DB connection string -- fallback |- | [AgentPreferencesService] || StorageProvider || (inherited) || Required section; overrides [DatabaseService] |- | [AgentPreferencesService] || ConnectionString || (inherited) || Overrides [DatabaseService] |- | [AgentPreferencesService] || Realm || AgentPrefs || Table name |} Throws if: * [AgentPreferencesService] section is missing * StorageProvider is empty after both layers * Plugin cannot be loaded The loaded plugin is stored as m_Database (IAgentPreferencesData). No console commands are registered. ---- === Data Model === One row per user. Fields stored: {| class="wikitable" ! Field !! Type !! Notes |- | PrincipalID || UUID string || Stored in Data dictionary, not as a separate column in AgentPreferencesData |- | AccessPrefs || string || Access tier preference (e.g. "M" for Mature) |- | HoverHeight || float string || Avatar hover height |- | Language || string || BCP 47 language tag (e.g. "en-us") |- | LanguageIsPublic || "1" / "0" || Whether language preference is visible to others |- | PermEveryone || int string || Default everyone permissions on created objects |- | PermGroup || int string || Default group permissions on created objects |- | PermNextOwner || int string || Default next-owner permissions on created objects |} Conversion between AgentPreferencesData (dictionary) and AgentPrefs (typed object) is handled by the AgentPrefs constructor and StoreAgentPreferences(). ---- === GetAgentPreferences === public AgentPrefs GetAgentPreferences(UUID principalID) Calls m_Database.GetPrefs(principalID). Returns null if no record exists, otherwise constructs AgentPrefs from the returned data dictionary. ---- === StoreAgentPreferences === public bool StoreAgentPreferences(AgentPrefs data) Converts AgentPrefs to AgentPreferencesData dictionary and calls m_Database.Store(). All fields are written on every call -- no partial update. LanguageIsPublic is stored as "1" or "0", not "True"/"False". Returns the result of m_Database.Store(). ---- === GetLang === public string GetLang(UUID principalID) Convenience method. Calls GetAgentPreferences(), returns Language if the record exists and LanguageIsPublic is true. Returns "en-us" in all other cases (no record, or language is not public). ---- === Notes === * [AgentPreferencesService] section is mandatory -- missing it throws at startup, unlike most other services where the section is optional. * There is no cache in this service. * No console commands are registered. ---- == See Also == * [[OpenSimulator Internals/Code Map/ROBUST]] * [[OpenSimulator Internals/Code Map/Shared]] * [[OpenSimulator Internals/Databases]]
Summary:
Please note that all contributions to Open Simulator Technical Help may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Open Simulator Technical Help:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
OpenSimulator Internals/Code Map/ROBUST/AgentPreferencesService
Add topic