<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://osimdev.org/wiki/index.php?action=history&amp;feed=atom&amp;title=OpenSimulator_Internals%2FCode_Map%2FROBUST%2FAgentPreferencesService</id>
	<title>OpenSimulator Internals/Code Map/ROBUST/AgentPreferencesService - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://osimdev.org/wiki/index.php?action=history&amp;feed=atom&amp;title=OpenSimulator_Internals%2FCode_Map%2FROBUST%2FAgentPreferencesService"/>
	<link rel="alternate" type="text/html" href="http://osimdev.org/wiki/index.php?title=OpenSimulator_Internals/Code_Map/ROBUST/AgentPreferencesService&amp;action=history"/>
	<updated>2026-08-04T15:36:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>http://osimdev.org/wiki/index.php?title=OpenSimulator_Internals/Code_Map/ROBUST/AgentPreferencesService&amp;diff=64&amp;oldid=prev</id>
		<title>Jwbshaw: first</title>
		<link rel="alternate" type="text/html" href="http://osimdev.org/wiki/index.php?title=OpenSimulator_Internals/Code_Map/ROBUST/AgentPreferencesService&amp;diff=64&amp;oldid=prev"/>
		<updated>2026-07-07T12:03:30Z</updated>

		<summary type="html">&lt;p&gt;first&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= OpenSimulator Internals/Code Map/ROBUST/AgentPreferencesService =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Source files:&lt;br /&gt;
&lt;br /&gt;
 OpenSim/Services/UserAccountService/AgentPreferencesService.cs&lt;br /&gt;
 OpenSim/Services/UserAccountService/AgentPreferencesServiceBase.cs&lt;br /&gt;
&lt;br /&gt;
Note: these files live in the UserAccountService directory, not a separate AgentPreferencesService directory.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Constructor and Config Loading ===&lt;br /&gt;
&lt;br /&gt;
 AgentPreferencesServiceBase(IConfigSource config)&lt;br /&gt;
&lt;br /&gt;
Config is read in two layers; [AgentPreferencesService] overrides [DatabaseService]. Unlike other services, [AgentPreferencesService] is required -- the constructor throws if the section is absent.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Section !! Key !! Default !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| [DatabaseService] || StorageProvider || (none) || DLL name -- fallback&lt;br /&gt;
|-&lt;br /&gt;
| [DatabaseService] || ConnectionString || (none) || DB connection string -- fallback&lt;br /&gt;
|-&lt;br /&gt;
| [AgentPreferencesService] || StorageProvider || (inherited) || Required section; overrides [DatabaseService]&lt;br /&gt;
|-&lt;br /&gt;
| [AgentPreferencesService] || ConnectionString || (inherited) || Overrides [DatabaseService]&lt;br /&gt;
|-&lt;br /&gt;
| [AgentPreferencesService] || Realm || AgentPrefs || Table name&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Throws if:&lt;br /&gt;
* [AgentPreferencesService] section is missing&lt;br /&gt;
* StorageProvider is empty after both layers&lt;br /&gt;
* Plugin cannot be loaded&lt;br /&gt;
&lt;br /&gt;
The loaded plugin is stored as m_Database (IAgentPreferencesData).&lt;br /&gt;
&lt;br /&gt;
No console commands are registered.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Data Model ===&lt;br /&gt;
&lt;br /&gt;
One row per user. Fields stored:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field !! Type !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| PrincipalID || UUID string || Stored in Data dictionary, not as a separate column in AgentPreferencesData&lt;br /&gt;
|-&lt;br /&gt;
| AccessPrefs || string || Access tier preference (e.g. &amp;quot;M&amp;quot; for Mature)&lt;br /&gt;
|-&lt;br /&gt;
| HoverHeight || float string || Avatar hover height&lt;br /&gt;
|-&lt;br /&gt;
| Language || string || BCP 47 language tag (e.g. &amp;quot;en-us&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| LanguageIsPublic || &amp;quot;1&amp;quot; / &amp;quot;0&amp;quot; || Whether language preference is visible to others&lt;br /&gt;
|-&lt;br /&gt;
| PermEveryone || int string || Default everyone permissions on created objects&lt;br /&gt;
|-&lt;br /&gt;
| PermGroup || int string || Default group permissions on created objects&lt;br /&gt;
|-&lt;br /&gt;
| PermNextOwner || int string || Default next-owner permissions on created objects&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Conversion between AgentPreferencesData (dictionary) and AgentPrefs (typed object) is handled by the AgentPrefs constructor and StoreAgentPreferences().&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== GetAgentPreferences ===&lt;br /&gt;
&lt;br /&gt;
 public AgentPrefs GetAgentPreferences(UUID principalID)&lt;br /&gt;
&lt;br /&gt;
Calls m_Database.GetPrefs(principalID). Returns null if no record exists, otherwise constructs AgentPrefs from the returned data dictionary.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== StoreAgentPreferences ===&lt;br /&gt;
&lt;br /&gt;
 public bool StoreAgentPreferences(AgentPrefs data)&lt;br /&gt;
&lt;br /&gt;
Converts AgentPrefs to AgentPreferencesData dictionary and calls m_Database.Store(). All fields are written on every call -- no partial update. LanguageIsPublic is stored as &amp;quot;1&amp;quot; or &amp;quot;0&amp;quot;, not &amp;quot;True&amp;quot;/&amp;quot;False&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Returns the result of m_Database.Store().&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== GetLang ===&lt;br /&gt;
&lt;br /&gt;
 public string GetLang(UUID principalID)&lt;br /&gt;
&lt;br /&gt;
Convenience method. Calls GetAgentPreferences(), returns Language if the record exists and LanguageIsPublic is true. Returns &amp;quot;en-us&amp;quot; in all other cases (no record, or language is not public).&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
&lt;br /&gt;
* [AgentPreferencesService] section is mandatory -- missing it throws at startup, unlike most other services where the section is optional.&lt;br /&gt;
* There is no cache in this service.&lt;br /&gt;
* No console commands are registered.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[OpenSimulator Internals/Code Map/ROBUST]]&lt;br /&gt;
* [[OpenSimulator Internals/Code Map/Shared]]&lt;br /&gt;
* [[OpenSimulator Internals/Databases]]&lt;/div&gt;</summary>
		<author><name>Jwbshaw</name></author>
	</entry>
</feed>