Documentation
¶
Overview ¶
Package pronouns provides an implementation of the pronouns personal protocol.
Index ¶
Constants ¶
const ( SelfPronounsEventType event.Type = "xyz.diamondb.gotktrix.self_pronouns" UserPronounsEventType event.Type = "xyz.diamondb.gotktrix.user_pronouns" )
Variables ¶
var DefaultPronouns = []PronounForms{
{"he", "him", "his"},
{"she", "her", "hers"},
{"they", "them", "theirs"},
}
DefaultPronouns is the list of default common pronouns. A client should not assume that valid pronoun choices can only be one of these three.
Functions ¶
This section is empty.
Types ¶
type Preferred ¶
type Preferred struct { Pronouns []Pronoun `json:"pronouns"` // Preferred is indexed within Pronouns; the default is the first entry. Preferred int `json:"preferred,omitempty"` }
Preferred lists preferred pronouns.
func SelfPronouns ¶
SelfPronouns fetches the current user's preferred pronouns. A zero-value Preferred instance is returned if the user has none.
func UserPronouns ¶
UserPronouns searches the room for the given user's preferred pronouns. If the room ID is empty, then the user ID is only searched in the current user preferences, or if the user ID belongs to the current user, then their own preference is returned (i.e. it acts like SelfPronouns).
type Pronoun ¶
type Pronoun string
Pronoun describes a pronoun string in the format they/them/theirs.
type PronounForms ¶
PronounForms describes the 3 forms of pronouns.
func ParsePronoun ¶
func ParsePronoun(pronoun Pronoun) (PronounForms, error)
ParsePronoun parses the given pronoun in X/Y/Z form, similarly to what String() returns. Spaces inbetween pronouns will be trimmed.
Examples of valid pronoun strings are:
he/him/his he / him / his she/her/hers she / her / hers they / them / theirs they/them/theirs
func (PronounForms) String ¶
func (p PronounForms) String() string
String returns the pronoun in X/Y/Z form. If PronounForms is a zero-value, then an empty string is returned.
func (PronounForms) SubjectObject ¶
func (p PronounForms) SubjectObject() string
SubjectObject is similar to String, except the Possessive form is omitted.
type SelfPronounsEvent ¶
type SelfPronounsEvent struct { event.EventInfo `json:"-"` Self Preferred `json:"self"` Others map[matrix.UserID]Preferred `json:"others,omitempty"` }
SelfPronounsEvent describes the xyz.diamondb.gotktrix.self_pronouns event. It is an event that others
type UserPronounsEvent ¶
type UserPronounsEvent struct { event.StateEventInfo `json:"-"` UserID matrix.UserID `json:"user_id"` Preferred }
UserPronounsEvent describes the xyz.diamondb.gotktrix.user_pronouns event. This event is propagated to rooms as a state event for a user.