Documentation
¶
Index ¶
- Constants
- type ByOccupantJid
- type ByOccupantNick
- type ConfigListMultiField
- type ConfigListSingleField
- type Occupant
- func (o *Occupant) Ban()
- func (o *Occupant) CanBroadcastPresenceToAllOccupants() bool
- func (o *Occupant) CanChangeAvailabilityStatus() bool
- func (o *Occupant) CanChangeRoomNickname() bool
- func (o *Occupant) CanGrantVoice() bool
- func (o *Occupant) CanInviteOtherUsers() bool
- func (o *Occupant) CanKickParticipantsAndVisitors() bool
- func (o *Occupant) CanModifySubject() bool
- func (o *Occupant) CanPresentInRoom() bool
- func (o *Occupant) CanReceiveMessage() bool
- func (o *Occupant) CanReceiveOccupantPresence() bool
- func (o *Occupant) CanRevokeVoice(oc *Occupant) bool
- func (o *Occupant) CanSendMessagesToAll() bool
- func (o *Occupant) CanSendPrivateMessages() bool
- func (o *Occupant) ChangeAffiliationToAdmin()
- func (o *Occupant) ChangeAffiliationToMember()
- func (o *Occupant) ChangeAffiliationToNone()
- func (o *Occupant) ChangeAffiliationToOutcast()
- func (o *Occupant) ChangeAffiliationToOwner()
- func (o *Occupant) ChangeRoleToModerator()
- func (o *Occupant) ChangeRoleToNone()
- func (o *Occupant) ChangeRoleToParticipant()
- func (o *Occupant) ChangeRoleToVisitor()
- func (o *Occupant) HasVoice() bool
- func (o *Occupant) Update(nickname string, affiliation data.Affiliation, role data.Role, ...)
- func (o *Occupant) UpdateAffiliation(a data.Affiliation)
- func (o *Occupant) UpdateRole(a data.Role)
- func (o *Occupant) UpdateStatus(status, statusMsg string)
- type OccupantAffiliationRole
- type OccupantPresenceInfo
- type Room
- func (r *Room) AddSelfOccupant(occupant *Occupant)
- func (r *Room) GetSubject() string
- func (r *Room) IsSelfOccupantAnOwner() bool
- func (r *Room) IsSelfOccupantInTheRoom() bool
- func (r *Room) Publish(ev events.MUC)
- func (r *Room) Roster() *RoomRoster
- func (r *Room) SelfOccupant() *Occupant
- func (r *Room) SelfOccupantNickname() string
- func (r *Room) Subscribe(f func(events.MUC))
- func (r *Room) UpdateSubject(s string) bool
- type RoomConfigForm
- type RoomListing
- func (rl *RoomListing) GetDiscoInfo() data.RoomDiscoInfo
- func (rl *RoomListing) OnUpdate(f func(*RoomListing, interface{}), data interface{})
- func (rl *RoomListing) SetFeatures(features []xmppData.DiscoveryFeature)
- func (rl *RoomListing) SetFormsData(forms []xmppData.Form)
- func (rl *RoomListing) Updated()
- type RoomManager
- type RoomRoster
- func (r *RoomRoster) Admins() []*Occupant
- func (r *RoomRoster) AllOccupants() []*Occupant
- func (r *RoomRoster) Banned() []*Occupant
- func (r *RoomRoster) GetOccupant(nickname string) (*Occupant, bool)
- func (r *RoomRoster) Members() []*Occupant
- func (r *RoomRoster) Moderators() []*Occupant
- func (r *RoomRoster) NoAffiliation() []*Occupant
- func (r *RoomRoster) NoRole() []*Occupant
- func (r *RoomRoster) OccupantsByAffiliation() (none, banned, members, admins, owners []*Occupant)
- func (r *RoomRoster) OccupantsByRole() (none, visitors, participants, moderators []*Occupant)
- func (r *RoomRoster) Owners() []*Occupant
- func (r *RoomRoster) Participants() []*Occupant
- func (r *RoomRoster) RemoveOccupant(nickname string) error
- func (r *RoomRoster) UpdateNickname(nickname, newNickname string) error
- func (r *RoomRoster) UpdateOrAddOccupant(op *OccupantPresenceInfo) bool
- func (r *RoomRoster) UpdatePresence(op *OccupantPresenceInfo, tp string) (joined, left bool, err error)
- func (r *RoomRoster) Visitors() []*Occupant
- type ServiceListing
Constants ¶
const ( // RoomConfigOptionModerators represents the field option for "moderators" RoomConfigOptionModerators = "moderators" // RoomConfigOptionParticipants represents the field option for "participants" RoomConfigOptionParticipants = "participants" // RoomConfigOptionAnyone represents the field opion for "anyone" RoomConfigOptionAnyone = "anyone" // RoomConfigOptionModerator represents the field option for "moderator" RoomConfigOptionModerator = "moderator" // RoomConfigOptionParticipant represents the field option for "participant" RoomConfigOptionParticipant = "participant" // RoomConfigOptionVisitor represents the field option for "visitor" RoomConfigOptionVisitor = "visitor" // RoomConfigOptionNone represents the field option for "none" RoomConfigOptionNone = "0" // RoomConfigOption10 represents the field option for "10" RoomConfigOption10 = "10" // RoomConfigOption20 represents the field option for "20" RoomConfigOption20 = "20" // RoomConfigOption30 represents the field option for "30" RoomConfigOption30 = "30" // RoomConfigOption50 represents the field option for "50" RoomConfigOption50 = "50" // RoomConfigOption100 represents the field option for "100" RoomConfigOption100 = "100" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByOccupantJid ¶
type ByOccupantJid []*Occupant
ByOccupantJid sorts occupants by real JID and then nickname
func (ByOccupantJid) Len ¶
func (s ByOccupantJid) Len() int
func (ByOccupantJid) Less ¶
func (s ByOccupantJid) Less(i, j int) bool
func (ByOccupantJid) Swap ¶
func (s ByOccupantJid) Swap(i, j int)
type ByOccupantNick ¶
type ByOccupantNick []*Occupant
ByOccupantNick sorts occupants by nickname
func (ByOccupantNick) Len ¶
func (s ByOccupantNick) Len() int
func (ByOccupantNick) Less ¶
func (s ByOccupantNick) Less(i, j int) bool
func (ByOccupantNick) Swap ¶
func (s ByOccupantNick) Swap(i, j int)
type ConfigListMultiField ¶
type ConfigListMultiField interface { // UpdateField will update the list fields with the given "values" and "options" UpdateField([]string, []string) }
ConfigListMultiField description
type ConfigListSingleField ¶
type ConfigListSingleField interface { // UpdateField will update the list fields with the given "value" and "options" UpdateField(string, []string) // UpdateValue updates the current field value UpdateValue(string) // Value returns the current list value CurrentValue() string // Options returns the field options Options() []string }
ConfigListSingleField description
type Occupant ¶
type Occupant struct { // Nickname is the nickname of the person Nickname string // RealJid is the real JID of the person, if known. Otherwise it is nil RealJid jid.Full // Affiliation is the current affiliation of the occupant in the room Affiliation data.Affiliation // Role is the current role of the occupant in the room Role data.Role // Status contains the current status of the occupant in the room Status *roster.Status }
Occupant contains information about a specific occupant in a specific room. This structure doesn't make sense without a connection to a room, since the information inside it depends on the room
func (*Occupant) CanBroadcastPresenceToAllOccupants ¶
CanBroadcastPresenceToAllOccupants description
func (*Occupant) CanChangeAvailabilityStatus ¶
CanChangeAvailabilityStatus description
func (*Occupant) CanChangeRoomNickname ¶
CanChangeRoomNickname description
func (*Occupant) CanInviteOtherUsers ¶
CanInviteOtherUsers description
func (*Occupant) CanKickParticipantsAndVisitors ¶
CanKickParticipantsAndVisitors description
func (*Occupant) CanModifySubject ¶
CanModifySubject returns a boolean indicating if the occupant can modify the room's subejct
func (*Occupant) CanPresentInRoom ¶
CanPresentInRoom description
func (*Occupant) CanReceiveMessage ¶
CanReceiveMessage description
func (*Occupant) CanReceiveOccupantPresence ¶
CanReceiveOccupantPresence description
func (*Occupant) CanRevokeVoice ¶
CanRevokeVoice description
func (*Occupant) CanSendMessagesToAll ¶
CanSendMessagesToAll description
func (*Occupant) CanSendPrivateMessages ¶
CanSendPrivateMessages description
func (*Occupant) ChangeAffiliationToAdmin ¶
func (o *Occupant) ChangeAffiliationToAdmin()
ChangeAffiliationToAdmin changes the affiliation to the admin affiliation
func (*Occupant) ChangeAffiliationToMember ¶
func (o *Occupant) ChangeAffiliationToMember()
ChangeAffiliationToMember changes the affiliation to the member affiliation
func (*Occupant) ChangeAffiliationToNone ¶
func (o *Occupant) ChangeAffiliationToNone()
ChangeAffiliationToNone changes the affiliation to the none affiliation
func (*Occupant) ChangeAffiliationToOutcast ¶
func (o *Occupant) ChangeAffiliationToOutcast()
ChangeAffiliationToOutcast changes the affiliation to the outcast affiliation
func (*Occupant) ChangeAffiliationToOwner ¶
func (o *Occupant) ChangeAffiliationToOwner()
ChangeAffiliationToOwner changes the affiliation to the owner affiliation
func (*Occupant) ChangeRoleToModerator ¶
func (o *Occupant) ChangeRoleToModerator()
ChangeRoleToModerator changes the role to the moderator role
func (*Occupant) ChangeRoleToNone ¶
func (o *Occupant) ChangeRoleToNone()
ChangeRoleToNone changes the role to the none role
func (*Occupant) ChangeRoleToParticipant ¶
func (o *Occupant) ChangeRoleToParticipant()
ChangeRoleToParticipant changes the role to the participant role
func (*Occupant) ChangeRoleToVisitor ¶
func (o *Occupant) ChangeRoleToVisitor()
ChangeRoleToVisitor changes the role to the visitor role
func (*Occupant) HasVoice ¶
HasVoice returns a boolean indicating if the occupant has voice based on the role
func (*Occupant) Update ¶
func (o *Occupant) Update(nickname string, affiliation data.Affiliation, role data.Role, status, statusMessage string, realJid jid.Full)
Update will update the information in this occupant object with the given information.
func (*Occupant) UpdateAffiliation ¶
func (o *Occupant) UpdateAffiliation(a data.Affiliation)
UpdateAffiliation will update the occupant's affiliation
func (*Occupant) UpdateRole ¶
UpdateRole will update the occupant's role
type OccupantAffiliationRole ¶
type OccupantAffiliationRole struct { Affiliation data.Affiliation Role data.Role Actor string Reason string }
OccupantAffiliationRole contains information for the Presence Info received when the occupant affialiation or role was updated
type OccupantPresenceInfo ¶
type OccupantPresenceInfo struct { Nickname string RealJid jid.Full AffiliationRole *OccupantAffiliationRole Status string StatusMessage string }
OccupantPresenceInfo containts information for an occupant presence
type Room ¶
type Room struct { ID jid.Bare MaxHistoryFetch int AllowPrivateMessages string // This can be 'anyone', 'participants', 'moderators', 'none' AllowInvites bool ChangeSubject bool EnableLogging bool GetMemberList []string // This is a list of the roles that can get the member list, 'moderator', 'participant' or 'visitor' Language string PubSub string MaxUsers int MembersOnly bool ModeratedRoom bool PasswordProtectedRoom bool PersistentRoom bool PresenceBroadcast []string // This is a list of the roles for which presence is broadcast, 'moderator', 'participant' or 'visitor' PublicRoom bool Description string Name string Whois string // This can either be 'moderators' or 'anyone' // contains filtered or unexported fields }
Room represents a multi user chat room that a session is currently connected to. It contains information about the room configuration itself, and the participants in the room
func (*Room) AddSelfOccupant ¶
AddSelfOccupant set the own occupant of the room
func (*Room) IsSelfOccupantAnOwner ¶
IsSelfOccupantAnOwner returns a boolean indicating if the self occupant is an owner
func (*Room) IsSelfOccupantInTheRoom ¶
IsSelfOccupantInTheRoom returns true if the self occupant is in the room, false in otherwise
func (*Room) Roster ¶
func (r *Room) Roster() *RoomRoster
Roster returns the RoomRoster for this room
func (*Room) SelfOccupant ¶
SelfOccupant returns the self occupant of the room
func (*Room) SelfOccupantNickname ¶
SelfOccupantNickname returns the nickname of the room's self occupant
func (*Room) Subscribe ¶
Subscribe subscribes the observer to room events
type RoomConfigForm ¶
type RoomConfigForm struct { MaxHistoryFetch ConfigListSingleField AllowPrivateMessages ConfigListSingleField OccupantsCanInvite bool OccupantsCanChangeSubject bool Logged bool RetrieveMembersList ConfigListMultiField Language string AssociatedPublishSubscribeNode string MaxOccupantsNumber ConfigListSingleField MembersOnly bool Moderated bool PasswordProtected bool Persistent bool PresenceBroadcast ConfigListMultiField Public bool Admins []jid.Any Description string Title string Owners []jid.Any Password string Whois ConfigListSingleField }
RoomConfigForm represents a room configuration form
func NewRoomConfigRom ¶
func NewRoomConfigRom(form *xmppData.Form) *RoomConfigForm
NewRoomConfigRom creates a new room configuration form instance
func (*RoomConfigForm) GetFormData ¶
func (rcf *RoomConfigForm) GetFormData() *xmppData.Form
GetFormData returns a representation of the room config FORM_TYPE as described in the XMPP specification for MUC
For more information see: https://xmpp.org/extensions/xep-0045.html#createroom-reserved https://xmpp.org/extensions/xep-0045.html#example-163
func (*RoomConfigForm) SetFormFields ¶
func (rcf *RoomConfigForm) SetFormFields(form *xmppData.Form)
SetFormFields extract the form fields and updates the room config form properties based on each data
type RoomListing ¶
type RoomListing struct { Service jid.Any ServiceName string Jid jid.Bare Name string data.RoomDiscoInfo // contains filtered or unexported fields }
RoomListing contains the information about a room for listing it
func NewRoomListing ¶
func NewRoomListing() *RoomListing
NewRoomListing creates and returns a new room listing
func (*RoomListing) GetDiscoInfo ¶
func (rl *RoomListing) GetDiscoInfo() data.RoomDiscoInfo
GetDiscoInfo returns the room disco info from the room listing
func (*RoomListing) OnUpdate ¶
func (rl *RoomListing) OnUpdate(f func(*RoomListing, interface{}), data interface{})
OnUpdate takes a function and some data, and when this room listing is updated, that function will be called with the current room listing and the associated data
func (*RoomListing) SetFeatures ¶
func (rl *RoomListing) SetFeatures(features []xmppData.DiscoveryFeature)
SetFeatures receive a list of features and updates the room listing properties based on each feature
func (*RoomListing) SetFormsData ¶
func (rl *RoomListing) SetFormsData(forms []xmppData.Form)
SetFormsData extract the forms data and updates the room listing properties based on each data
func (*RoomListing) Updated ¶
func (rl *RoomListing) Updated()
Updated should be called after a room listing has been updated, to notify observers of the update
type RoomManager ¶
type RoomManager struct {
// contains filtered or unexported fields
}
RoomManager contains information about each room that is currently active for a user When a window is closed, the room stays in this list. A room will only be removed from this list when the current user leaves that room.
func NewRoomManager ¶
func NewRoomManager() *RoomManager
NewRoomManager returns a newly created room manager
func (*RoomManager) AddRoom ¶
func (rm *RoomManager) AddRoom(r *Room) bool
AddRoom adds the room to the manager. If the room is already in the manager, this method will return false
func (*RoomManager) GetRoom ¶
func (rm *RoomManager) GetRoom(roomID jid.Bare) (*Room, bool)
GetRoom returns the room corresponding to the given identifier, or returns false if it can't be found
func (*RoomManager) LeaveRoom ¶
func (rm *RoomManager) LeaveRoom(room jid.Bare) bool
LeaveRoom will remove the room with the given identifier from the manager. If the room doesn't exist, this method will return false
type RoomRoster ¶
type RoomRoster struct {
// contains filtered or unexported fields
}
RoomRoster contains information about all the occupants in a room
func (*RoomRoster) Admins ¶
func (r *RoomRoster) Admins() []*Occupant
Admins returns all occupants that are administrators in a room, sorted by nickname.
func (*RoomRoster) AllOccupants ¶
func (r *RoomRoster) AllOccupants() []*Occupant
AllOccupants returns a list of all occupants in the room, sorted by nickname
func (*RoomRoster) Banned ¶
func (r *RoomRoster) Banned() []*Occupant
Banned returns all occupants that are banned in a room, sorted by nickname. This should likely not return anything.
func (*RoomRoster) GetOccupant ¶
func (r *RoomRoster) GetOccupant(nickname string) (*Occupant, bool)
GetOccupant return an occupant if this exist in the roster, otherwise return nil and false
func (*RoomRoster) Members ¶
func (r *RoomRoster) Members() []*Occupant
Members returns all occupants that are members in a room, sorted by nickname.
func (*RoomRoster) Moderators ¶
func (r *RoomRoster) Moderators() []*Occupant
Moderators returns all occupants that have the moderator role in a room, sorted by nickname
func (*RoomRoster) NoAffiliation ¶
func (r *RoomRoster) NoAffiliation() []*Occupant
NoAffiliation returns all occupants that have no affiliation in a room, sorted by nickname
func (*RoomRoster) NoRole ¶
func (r *RoomRoster) NoRole() []*Occupant
NoRole returns all occupants that have no role in a room, sorted by nickname
func (*RoomRoster) OccupantsByAffiliation ¶
func (r *RoomRoster) OccupantsByAffiliation() (none, banned, members, admins, owners []*Occupant)
OccupantsByAffiliation returns all occupants, divided into the different affiliations
func (*RoomRoster) OccupantsByRole ¶
func (r *RoomRoster) OccupantsByRole() (none, visitors, participants, moderators []*Occupant)
OccupantsByRole returns all occupants, divided into the different roles
func (*RoomRoster) Owners ¶
func (r *RoomRoster) Owners() []*Occupant
Owners returns all occupants that are owners in a room, sorted by nickname.
func (*RoomRoster) Participants ¶
func (r *RoomRoster) Participants() []*Occupant
Participants returns all occupants that have the participant role in a room, sorted by nickname
func (*RoomRoster) RemoveOccupant ¶
func (r *RoomRoster) RemoveOccupant(nickname string) error
RemoveOccupant delete an occupant if that exists
func (*RoomRoster) UpdateNickname ¶
func (r *RoomRoster) UpdateNickname(nickname, newNickname string) error
UpdateNickname should be called when receiving an unavailable with status code 303 The new nickname should be given without the room name
func (*RoomRoster) UpdateOrAddOccupant ¶
func (r *RoomRoster) UpdateOrAddOccupant(op *OccupantPresenceInfo) bool
UpdateOrAddOccupant return true if the occupant was updated or false if that was added
func (*RoomRoster) UpdatePresence ¶
func (r *RoomRoster) UpdatePresence(op *OccupantPresenceInfo, tp string) (joined, left bool, err error)
UpdatePresence should be called when receiving a regular presence update with no type, or with unavailable as type. It will return indications on whether the presence update means the person joined the room, or left the room. Notice that updating of nick names is done separately and should not be done by calling this method.
func (*RoomRoster) Visitors ¶
func (r *RoomRoster) Visitors() []*Occupant
Visitors returns all occupants that have the visitor role in a room, sorted by nickname