data

package
v0.0.111-test1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2021 License: GPL-3.0 Imports: 3 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// AffiliationOwner represents XMPP muc 'owner' affiliation
	AffiliationOwner = "owner"
	// AffiliationAdmin represents XMPP muc 'admin' affiliation
	AffiliationAdmin = "admin"
	// AffiliationMember represents XMPP muc 'member' affiliation
	AffiliationMember = "member"
	// AffiliationOutcast represents XMPP muc 'outcast' affiliation
	AffiliationOutcast = "outcast"
	// AffiliationNone represents XMPP muc 'none' affiliation
	AffiliationNone = "none"
)
View Source
const (
	// RoleNone represents XMPP muc 'none' role
	RoleNone = "none"
	// RoleVisitor represents XMPP muc 'visitor' role
	RoleVisitor = "visitor"
	// RoleParticipant represents XMPP muc 'participant' role
	RoleParticipant = "participant"
	// RoleModerator represents XMPP muc 'moderator' role
	RoleModerator = "moderator"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	Nickname    string
	Affiliation Affiliation
	Role        Role
}

Actor represents the occupant that updates the role or affiliation

type AdminAffiliation

type AdminAffiliation struct{}

AdminAffiliation is a representation of MUC's "admin" affiliation

func (*AdminAffiliation) Equals

func (*AdminAffiliation) Equals(a Affiliation) bool

Equals implements Affiliation interface

func (*AdminAffiliation) IsAdmin

func (*AdminAffiliation) IsAdmin() bool

IsAdmin implements Affiliation interface

func (*AdminAffiliation) IsBanned

func (*AdminAffiliation) IsBanned() bool

IsBanned implements Affiliation interface

func (*AdminAffiliation) IsLowerThan

func (*AdminAffiliation) IsLowerThan(a Affiliation) bool

IsLowerThan implements Affiliation interface

func (*AdminAffiliation) IsMember

func (*AdminAffiliation) IsMember() bool

IsMember implements Affiliation interface

func (*AdminAffiliation) IsModerator

func (*AdminAffiliation) IsModerator() bool

IsModerator implements Affiliation interface

func (*AdminAffiliation) IsNone

func (*AdminAffiliation) IsNone() bool

IsNone implements Affiliation interface

func (*AdminAffiliation) IsOutcast

func (*AdminAffiliation) IsOutcast() bool

IsOutcast implements Affiliation interface

func (*AdminAffiliation) IsOwner

func (*AdminAffiliation) IsOwner() bool

IsOwner implements Affiliation interface

func (*AdminAffiliation) Name

func (*AdminAffiliation) Name() string

Name implements Affiliation interface

type Affiliation

type Affiliation interface {
	// IsAdmin will return true if this specific affiliation can modify persistent information
	IsAdmin() bool
	// IsBanned will return true if this specific affiliation means that the jid is banned from the room
	IsBanned() bool
	// IsMember will return true if this specific affiliation means that the jid is a member of the room
	IsMember() bool
	// IsOwner will return true if this specific affiliation means that the jid is an owner of the room
	IsOwner() bool
	// IsNone will return true if if the jid doesn't have affiliation
	IsNone() bool
	// Name returns the string name of the affiliation type
	Name() string
	// IsLowerThan returns a boolean value indicating whether the given affiliation has lower hierarchy than the current one
	IsLowerThan(Affiliation) bool
	// Equals returns a boolean value indicating whether the given affiliation is the same as the current one
	Equals(Affiliation) bool
}

Affiliation represents an affiliation as specificed by section 5.2 in XEP-0045

func AffiliationFromString

func AffiliationFromString(s string) (Affiliation, error)

AffiliationFromString returns an Affiliation from the given string, or an error if the string doesn't match a known affiliation type

type AffiliationRoleUpdate

type AffiliationRoleUpdate struct {
	Nickname            string
	Reason              string
	NewAffiliation      Affiliation
	PreviousAffiliation Affiliation
	NewRole             Role
	PreviousRole        Role
	Actor               *Actor
}

AffiliationRoleUpdate contains information related to a new and previous affiliation and role

type AffiliationUpdate

type AffiliationUpdate struct {
	Nickname string
	Reason   string
	New      Affiliation
	Previous Affiliation
	Actor    *Actor
}

AffiliationUpdate contains information related to a new and previous affiliation

type DelayedMessage

type DelayedMessage struct {
	Nickname  string
	Message   string
	Timestamp time.Time
}

DelayedMessage contains the information of a delayed message

type DelayedMessages

type DelayedMessages struct {
	// contains filtered or unexported fields
}

DelayedMessages contains the delayed messages for specific date

func (*DelayedMessages) GetDate

func (dm *DelayedMessages) GetDate() time.Time

GetDate returns the delayed messages group's date

func (*DelayedMessages) GetMessages

func (dm *DelayedMessages) GetMessages() []*DelayedMessage

GetMessages returns a list of delayed messages

type DiscussionHistory

type DiscussionHistory struct {
	// contains filtered or unexported fields
}

DiscussionHistory contains the rooms's discussion history

func NewDiscussionHistory

func NewDiscussionHistory() *DiscussionHistory

NewDiscussionHistory creates a new discussion history instance

func (*DiscussionHistory) AddMessage

func (dh *DiscussionHistory) AddMessage(nickname, message string, timestamp time.Time)

AddMessage add a new delayed message to the history

func (*DiscussionHistory) GetHistory

func (dh *DiscussionHistory) GetHistory() []*DelayedMessages

GetHistory returns the discussion history

type MemberAffiliation

type MemberAffiliation struct{}

MemberAffiliation is a representation of MUC's "member" affiliation

func (*MemberAffiliation) Equals

func (*MemberAffiliation) Equals(a Affiliation) bool

Equals implements Affiliation interface

func (*MemberAffiliation) IsAdmin

func (*MemberAffiliation) IsAdmin() bool

IsAdmin implements Affiliation interface

func (*MemberAffiliation) IsBanned

func (*MemberAffiliation) IsBanned() bool

IsBanned implements Affiliation interface

func (*MemberAffiliation) IsLowerThan

func (*MemberAffiliation) IsLowerThan(a Affiliation) bool

IsLowerThan implements Affiliation interface

func (*MemberAffiliation) IsMember

func (*MemberAffiliation) IsMember() bool

IsMember implements Affiliation interface

func (*MemberAffiliation) IsModerator

func (*MemberAffiliation) IsModerator() bool

IsModerator implements Affiliation interface

func (*MemberAffiliation) IsNone

func (*MemberAffiliation) IsNone() bool

IsNone implements Affiliation interface

func (*MemberAffiliation) IsOutcast

func (*MemberAffiliation) IsOutcast() bool

IsOutcast implements Affiliation interface

func (*MemberAffiliation) IsOwner

func (*MemberAffiliation) IsOwner() bool

IsOwner implements Affiliation interface

func (*MemberAffiliation) Name

func (*MemberAffiliation) Name() string

Name implements Affiliation interface

type ModeratorRole

type ModeratorRole struct{}

ModeratorRole is a representation of MUC's "moderator" role

func (*ModeratorRole) AsModerator

func (*ModeratorRole) AsModerator() Role

AsModerator implements Role interface

func (*ModeratorRole) Equals

func (*ModeratorRole) Equals(r Role) bool

Equals implements Role interface

func (*ModeratorRole) HasVoice

func (*ModeratorRole) HasVoice() bool

HasVoice implements Role interface

func (*ModeratorRole) IsModerator

func (*ModeratorRole) IsModerator() bool

IsModerator implements Role interface

func (*ModeratorRole) IsNone

func (*ModeratorRole) IsNone() bool

IsNone implements Role interface

func (*ModeratorRole) IsParticipant

func (*ModeratorRole) IsParticipant() bool

IsParticipant implements Role interface

func (*ModeratorRole) IsVisitor

func (*ModeratorRole) IsVisitor() bool

IsVisitor implements Role interface

func (*ModeratorRole) Name

func (*ModeratorRole) Name() string

Name implements Role interface

func (*ModeratorRole) WithVoice

func (*ModeratorRole) WithVoice() Role

WithVoice implements Role interface

type NoneAffiliation

type NoneAffiliation struct{}

NoneAffiliation is a representation of MUC's "none" affiliation

func (*NoneAffiliation) Equals

func (*NoneAffiliation) Equals(a Affiliation) bool

Equals implements Affiliation interface

func (*NoneAffiliation) IsAdmin

func (*NoneAffiliation) IsAdmin() bool

IsAdmin implements Affiliation interface

func (*NoneAffiliation) IsBanned

func (*NoneAffiliation) IsBanned() bool

IsBanned implements Affiliation interface

func (*NoneAffiliation) IsLowerThan

func (*NoneAffiliation) IsLowerThan(a Affiliation) bool

IsLowerThan implements Affiliation interface

func (*NoneAffiliation) IsMember

func (*NoneAffiliation) IsMember() bool

IsMember implements Affiliation interface

func (*NoneAffiliation) IsModerator

func (*NoneAffiliation) IsModerator() bool

IsModerator implements Affiliation interface

func (*NoneAffiliation) IsNone

func (*NoneAffiliation) IsNone() bool

IsNone implements Affiliation interface

func (*NoneAffiliation) IsOutcast

func (*NoneAffiliation) IsOutcast() bool

IsOutcast implements Affiliation interface

func (*NoneAffiliation) IsOwner

func (*NoneAffiliation) IsOwner() bool

IsOwner implements Affiliation interface

func (*NoneAffiliation) Name

func (*NoneAffiliation) Name() string

Name implements Affiliation interface

type NoneRole

type NoneRole struct{}

NoneRole is a representation of MUC's "none" role

func (*NoneRole) AsModerator

func (*NoneRole) AsModerator() Role

AsModerator implements Role interface

func (*NoneRole) Equals

func (*NoneRole) Equals(r Role) bool

Equals implements Role interface

func (*NoneRole) HasVoice

func (*NoneRole) HasVoice() bool

HasVoice implements Role interface

func (*NoneRole) IsModerator

func (*NoneRole) IsModerator() bool

IsModerator implements Role interface

func (*NoneRole) IsNone

func (*NoneRole) IsNone() bool

IsNone implements Role interface

func (*NoneRole) IsParticipant

func (*NoneRole) IsParticipant() bool

IsParticipant implements Role interface

func (*NoneRole) IsVisitor

func (*NoneRole) IsVisitor() bool

IsVisitor implements Role interface

func (*NoneRole) Name

func (*NoneRole) Name() string

Name implements Role interface

func (*NoneRole) WithVoice

func (*NoneRole) WithVoice() Role

WithVoice implements Role interface

type OutcastAffiliation

type OutcastAffiliation struct{}

OutcastAffiliation is a representation of MUC's "banned" affiliation

func (*OutcastAffiliation) Equals

func (*OutcastAffiliation) Equals(a Affiliation) bool

Equals implements Affiliation interface

func (*OutcastAffiliation) IsAdmin

func (*OutcastAffiliation) IsAdmin() bool

IsAdmin implements Affiliation interface

func (*OutcastAffiliation) IsBanned

func (*OutcastAffiliation) IsBanned() bool

IsBanned implements Affiliation interface

func (*OutcastAffiliation) IsLowerThan

func (*OutcastAffiliation) IsLowerThan(Affiliation) bool

IsLowerThan implements Affiliation interface

func (*OutcastAffiliation) IsMember

func (*OutcastAffiliation) IsMember() bool

IsMember implements Affiliation interface

func (*OutcastAffiliation) IsModerator

func (*OutcastAffiliation) IsModerator() bool

IsModerator implements Affiliation interface

func (*OutcastAffiliation) IsNone

func (*OutcastAffiliation) IsNone() bool

IsNone implements Affiliation interface

func (*OutcastAffiliation) IsOutcast

func (*OutcastAffiliation) IsOutcast() bool

IsOutcast implements Affiliation interface

func (*OutcastAffiliation) IsOwner

func (*OutcastAffiliation) IsOwner() bool

IsOwner implements Affiliation interface

func (*OutcastAffiliation) Name

func (*OutcastAffiliation) Name() string

Name implements Affiliation interface

type OwnerAffiliation

type OwnerAffiliation struct{}

OwnerAffiliation is a representation of MUC's "owner" affiliation

func (*OwnerAffiliation) Equals

func (*OwnerAffiliation) Equals(a Affiliation) bool

Equals implements Affiliation interface

func (*OwnerAffiliation) IsAdmin

func (*OwnerAffiliation) IsAdmin() bool

IsAdmin implements Affiliation interface

func (*OwnerAffiliation) IsBanned

func (*OwnerAffiliation) IsBanned() bool

IsBanned implements Affiliation interface

func (*OwnerAffiliation) IsLowerThan

func (*OwnerAffiliation) IsLowerThan(a Affiliation) bool

IsLowerThan implements Affiliation interface

func (*OwnerAffiliation) IsMember

func (*OwnerAffiliation) IsMember() bool

IsMember implements Affiliation interface

func (*OwnerAffiliation) IsModerator

func (*OwnerAffiliation) IsModerator() bool

IsModerator implements Affiliation interface

func (*OwnerAffiliation) IsNone

func (*OwnerAffiliation) IsNone() bool

IsNone implements Affiliation interface

func (*OwnerAffiliation) IsOutcast

func (*OwnerAffiliation) IsOutcast() bool

IsOutcast implements Affiliation interface

func (*OwnerAffiliation) IsOwner

func (*OwnerAffiliation) IsOwner() bool

IsOwner implements Affiliation interface

func (*OwnerAffiliation) Name

func (*OwnerAffiliation) Name() string

Name implements Affiliation interface

type ParticipantRole

type ParticipantRole struct{}

ParticipantRole is a representation of MUC's "participant" role

func (*ParticipantRole) AsModerator

func (*ParticipantRole) AsModerator() Role

AsModerator implements Role interface

func (*ParticipantRole) Equals

func (*ParticipantRole) Equals(r Role) bool

Equals implements Role interface

func (*ParticipantRole) HasVoice

func (*ParticipantRole) HasVoice() bool

HasVoice implements Role interface

func (*ParticipantRole) IsModerator

func (*ParticipantRole) IsModerator() bool

IsModerator implements Role interface

func (*ParticipantRole) IsNone

func (*ParticipantRole) IsNone() bool

IsNone implements Role interface

func (*ParticipantRole) IsParticipant

func (*ParticipantRole) IsParticipant() bool

IsParticipant implements Role interface

func (*ParticipantRole) IsVisitor

func (*ParticipantRole) IsVisitor() bool

IsVisitor implements Role interface

func (*ParticipantRole) Name

func (*ParticipantRole) Name() string

Name implements Role interface

func (*ParticipantRole) WithVoice

func (*ParticipantRole) WithVoice() Role

WithVoice implements Role interface

type Role

type Role interface {
	// HasVoice returns true if the user can speak in this room
	HasVoice() bool
	// WithVoice returns the closest role upwards that has voice privilege. For Participants and Moderators, it returns itself, otherwise it returns participant
	WithVoice() Role
	// AsModerator returns the closest role upwards that can act as a moderator
	AsModerator() Role
	// Name returns the string name of the role type
	Name() string
	// IsModerator returns true if the user is a moderator
	IsModerator() bool
	// IsParticipant returns true if the user is a participant
	IsParticipant() bool
	// IsVisitor returns true if the user has a visitor role
	IsVisitor() bool
	// IsNone returns true if the user hasn't a role
	IsNone() bool
	// Equals returns a boolean value indicating whether the given role is the same as the current one
	Equals(Role) bool
}

Role represents the specific role that a user has inside a specific room

func RoleFromString

func RoleFromString(s string) (Role, error)

RoleFromString returns the role object that matches the string given, or an error if the string given doesn't match a known role

type RoleUpdate

type RoleUpdate struct {
	Nickname string
	Reason   string
	New      Role
	Previous Role
	Actor    *Actor
}

RoleUpdate contains information related to a new and previous affiliation

type RoomConfigType

type RoomConfigType int

RoomConfigType is used to represent a room configuration field

const (
	// RoomConfigSupportsVoiceRequests represents rooms "SupportsVoiceRequests" config
	RoomConfigSupportsVoiceRequests RoomConfigType = iota
	// RoomConfigAllowsRegistration represents rooms "AllowsRegistration" config
	RoomConfigAllowsRegistration
	// RoomConfigPersistent represents rooms "Persistent" config
	RoomConfigPersistent
	// RoomConfigModerated represents rooms "Moderated" config
	RoomConfigModerated
	// RoomConfigOpen represents rooms "Open" config
	RoomConfigOpen
	// RoomConfigPasswordProtected represents rooms "PasswordProtected" config
	RoomConfigPasswordProtected
	// RoomConfigPublic represents rooms "Public" config
	RoomConfigPublic
	// RoomConfigLanguage represents rooms "Language" config
	RoomConfigLanguage
	// RoomConfigOccupantsCanChangeSubject represents rooms "OccupantsCanChangeSubject" config
	RoomConfigOccupantsCanChangeSubject
	// RoomConfigTitle represents rooms "Title" config
	RoomConfigTitle
	// RoomConfigDescription represents rooms "Description" config
	RoomConfigDescription
	// RoomConfigMembersCanInvite represents rooms "OccupantsCanInvite" config
	RoomConfigMembersCanInvite
	// RoomConfigAllowPrivateMessages represents rooms "AllowPrivateMessages" config
	RoomConfigAllowPrivateMessages
	// RoomConfigLogged represents rooms "Logged" config
	RoomConfigLogged
	// RoomConfigMaxHistoryFetch represents the maximum number of history messages returned by Room
	RoomConfigMaxHistoryFetch
)

type RoomDiscoInfo

type RoomDiscoInfo struct {
	SupportsVoiceRequests bool
	AllowsRegistration    bool
	AnonymityLevel        string
	Persistent            bool
	Moderated             bool
	Open                  bool
	PasswordProtected     bool
	Public                bool

	Language                  string
	OccupantsCanChangeSubject bool
	Logged                    bool // Notice that this will not always be correct for all servers
	Title                     string
	Description               string
	Occupants                 int
	MembersCanInvite          bool
	OccupantsCanInvite        bool
	AllowPrivateMessages      string // This can be 'anyone', 'participants', 'moderators', 'none'
	ContactJid                string
	MaxHistoryFetch           int
}

RoomDiscoInfo represents the room discovery information values

type RoomInfo

type RoomInfo struct {
	// muc#maxhistoryfetch
	// Maximum Number of History Messages Returned by Room
	MaxHistoryFetch int

	// muc#roominfo_contactjid
	// Contact Addresses (normally, room owner or owners)
	ContactJid string

	// muc#roominfo_description
	// Short Description of Room
	Description string

	//muc#roominfo_lang
	// Natural Language for Room Discussions
	Language string

	// muc#roominfo_ldapgroup
	// An associated LDAP group that defines room membership; this should be an LDAP
	// Distinguished Name according to an implementation-specific or
	// deployment-specific definition of a group.
	LdapGroup string

	// muc#roominfo_logs
	// URL for Archived Discussion Logs
	Logs string

	// muc#roominfo_occupants
	// Current Number of Occupants in Room
	Occupants int

	// muc#roominfo_subject
	// Current Discussion Topic
	Topic string

	// muc#roominfo_subjectmod
	// The room subject can be modified by participants
	OccupantsCanChangeSubject bool
}

RoomInfo represents the room's information form values (https://xmpp.org/extensions/xep-0045.html#registrar-formtype-roominfo)

type VisitorRole

type VisitorRole struct{}

VisitorRole is a representation of MUC's "visitor" role

func (*VisitorRole) AsModerator

func (*VisitorRole) AsModerator() Role

AsModerator implements Role interface

func (*VisitorRole) Equals

func (*VisitorRole) Equals(r Role) bool

Equals implements Role interface

func (*VisitorRole) HasVoice

func (*VisitorRole) HasVoice() bool

HasVoice implements Role interface

func (*VisitorRole) IsModerator

func (*VisitorRole) IsModerator() bool

IsModerator implements Role interface

func (*VisitorRole) IsNone

func (*VisitorRole) IsNone() bool

IsNone implements Role interface

func (*VisitorRole) IsParticipant

func (*VisitorRole) IsParticipant() bool

IsParticipant implements Role interface

func (*VisitorRole) IsVisitor

func (*VisitorRole) IsVisitor() bool

IsVisitor implements Role interface

func (*VisitorRole) Name

func (*VisitorRole) Name() string

Name implements Role interface

func (*VisitorRole) WithVoice

func (*VisitorRole) WithVoice() Role

WithVoice implements Role interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL