Jump to content

OpenSimulator Internals/Connector Architecture/Friends Connector

From Open Simulator Technical Help

OpenSimulator Internals/Connector Architecture/Friends Connector

[edit]

Overview

[edit]

FriendsServicesConnector is the simulator-side remote connector for IFriendsService. It translates IFriendsService calls into HTTP POST requests to the ROBUST Friends handler at /friends.

Source file:

OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs

Initialisation

[edit]

Config section: [FriendsService]

Required key:

  • FriendsServerURI -- URL of the ROBUST friends endpoint; throws if missing

Base class BaseServiceConnector.Initialise() called for auth setup.

Three constructors:

  • Default (no args) -- URI must be set externally
  • String URI -- used by callers that pass the URI directly
  • IConfigSource -- calls Initialise(), normal grid mode

Transport

[edit]

All methods POST to m_ServerURI + "/friends" using SynchronousRestFormsRequester.

Unlike most other connectors, requests do not include VERSIONMIN / VERSIONMAX fields.


Methods

[edit]
Method METHOD field Notes
GetFriends(UUID principalID) "getfriends" UUID overload
GetFriends(string principalID) "getfriends_string" String overload -- used for HG UUI identifiers
StoreFriend(principalID, friend, flags) "storefriend" Sends PrincipalID, Friend, MyFlags; returns bool from Result field
Delete(UUID principalID, string friend) "deletefriend" UUID overload
Delete(string principalID, string friend) "deletefriend_string" String overload -- used for HG UUI identifiers

GetFriends() (both overloads) delegate to a protected GetFriends(Dictionary, string) helper:

  • Returns empty FriendInfo[] if result == "null"
  • Iterates all values in reply dictionary, constructs FriendInfo for each dictionary entry
  • Returns empty FriendInfo[] on empty reply or exception (never returns null)

StoreFriend() and Delete():

  • Check replyData["Result"] (capital R -- different from most other connectors which use lowercase "result")
  • Parse as bool via Boolean.TryParse()
  • Return false on empty reply, null response, or exception

Notes

[edit]
  • Two string overloads exist (GetFriends, Delete) to support HyperGrid UUI identifiers which are not valid UUIDs.
  • Result field key is "Result" (capital R) -- inconsistent with most other ROBUST service connectors which use lowercase "result".
  • No VERSIONMIN/VERSIONMAX sent -- unlike GridUser, Presence, Avatar, and UserAccount connectors.
  • GetFriends() returns empty array (not null) on all failure paths.

See Also

[edit]