Documentation ¶
Index ¶
- func IterAll(cb func(int, *Peer), ls ...*List)
- type Group
- type List
- func (l *List) AddOrMerge(p *Peer) bool
- func (l *List) AddOrReplace(p *Peer) bool
- func (l *List) AddTo(topLevel *Group, delim string)
- func (l *List) Clear()
- func (l *List) Get(jid jid.WithoutResource) (*Peer, bool)
- func (l *List) GetGroupNames() map[string]bool
- func (l *List) GetPendingSubscribe(jid jid.WithoutResource) (string, bool)
- func (l *List) Grouped(delim string) *Group
- func (l *List) Iter(cb func(int, *Peer))
- func (l *List) LatestError(jid jid.WithoutResource, code, tp, more string)
- func (l *List) PeerBecameUnavailable(j jid.Any) bool
- func (l *List) PeerPresenceUpdate(peer jid.WithResource, status, statusMsg, belongsTo string) bool
- func (l *List) Remove(jid jid.WithoutResource) (*Peer, bool)
- func (l *List) RemovePendingSubscribe(jid jid.WithoutResource) (string, bool)
- func (l *List) SubscribeRequest(jid jid.WithoutResource, id, belongsTo string)
- func (l *List) Subscribed(jid jid.WithoutResource)
- func (l *List) ToSlice() []*Peer
- func (l *List) Unsubscribed(jid jid.WithoutResource)
- type Peer
- func (p *Peer) AddResource(ss jid.Resource, status, statusMsg string)
- func (p *Peer) ClearResources()
- func (p *Peer) Dump() string
- func (p *Peer) HasResources() bool
- func (p *Peer) IsOnline() bool
- func (p *Peer) LastSeen(r jid.Any)
- func (p *Peer) MainStatus() string
- func (p *Peer) MainStatusMsg() string
- func (p *Peer) MergeWith(p2 *Peer) *Peer
- func (p *Peer) NameForPresentation() string
- func (p *Peer) RemoveResource(s jid.Resource)
- func (p *Peer) ResourceToUse() jid.Resource
- func (p *Peer) ResourceToUseFallback() jid.Resource
- func (p *Peer) Resources() []jid.Resource
- func (p *Peer) SetGroups(groups []string)
- func (p *Peer) SetLatestError(code, tp, more string)
- func (p *Peer) ToEntry() data.RosterEntry
- type PeerError
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Group ¶
type Group struct { GroupName string // contains filtered or unexported fields }
Group represents a grouping of accounts and groups
func (*Group) FullGroupName ¶
FullGroupName returns the full group name
func (*Group) UnsortedPeers ¶ added in v0.3.8
UnsortedPeers returns an unsorted list of all the peers in this group
type List ¶
type List struct {
// contains filtered or unexported fields
}
List represent a list of peers. It takes care of both roster and presence information transparently and presents a unified view of this information to any UI List is not ordered, but can be asked to present its information in various orders depending on what policy is in use It also contains information about pending subscribes One invariant is that the list will only ever contain one Peer for each bare jid.
func (*List) AddOrMerge ¶
AddOrMerge will add a new entry or merge with an existing entry the information from the given Peer It returns true if it added the entry and false otherwise
func (*List) AddOrReplace ¶
AddOrReplace will add a new entry or replace an existing entry with the information from the given Peer It returns true if it added the entry and false otherwise
func (*List) Get ¶
func (l *List) Get(jid jid.WithoutResource) (*Peer, bool)
Get returns the peer if it's known and false otherwise
func (*List) GetGroupNames ¶
GetGroupNames return all group names for this peer list.
func (*List) GetPendingSubscribe ¶
func (l *List) GetPendingSubscribe(jid jid.WithoutResource) (string, bool)
GetPendingSubscribe will return a subscribe id without removing it
func (*List) LatestError ¶
func (l *List) LatestError(jid jid.WithoutResource, code, tp, more string)
LatestError will set the latest error on the jid in question
func (*List) PeerBecameUnavailable ¶
PeerBecameUnavailable marks the peer as unavailable if they exist Returns true if they existed, otherwise false
func (*List) PeerPresenceUpdate ¶
func (l *List) PeerPresenceUpdate(peer jid.WithResource, status, statusMsg, belongsTo string) bool
PeerPresenceUpdate updates the status for the peer It returns true if it actually updated the status of the user
func (*List) Remove ¶
func (l *List) Remove(jid jid.WithoutResource) (*Peer, bool)
Remove returns the Peer with the jid from the List It returns true if it could remove the entry and false otherwise. It also returns the removed entry.
func (*List) RemovePendingSubscribe ¶
func (l *List) RemovePendingSubscribe(jid jid.WithoutResource) (string, bool)
RemovePendingSubscribe will return a subscribe id and remove the pending subscribe if it exists It will return false if no such subscribe is in flight
func (*List) SubscribeRequest ¶
func (l *List) SubscribeRequest(jid jid.WithoutResource, id, belongsTo string)
SubscribeRequest adds a new pending subscribe request
func (*List) Subscribed ¶
func (l *List) Subscribed(jid jid.WithoutResource)
Subscribed will mark the jid as subscribed
func (*List) Unsubscribed ¶
func (l *List) Unsubscribed(jid jid.WithoutResource)
Unsubscribed will mark the jid as unsubscribed
type Peer ¶
type Peer struct { Jid jid.WithoutResource Subscription string Name string Nickname string Groups map[string]bool Asked bool PendingSubscribeID string BelongsTo string LatestError *PeerError HasConfigData bool // contains filtered or unexported fields }
Peer represents and contains all the information you have about a specific peer. A Peer is always part of at least one roster.List, which is associated with an account.
func PeerFrom ¶
func PeerFrom(e data.RosterEntry, belongsTo, nickname string, groups []string) *Peer
PeerFrom returns a new Peer that contains the same information as the RosterEntry given
func PeerWithState ¶
func PeerWithState(jid jid.WithoutResource, status, statusMsg, belongsTo string, resource jid.Resource) *Peer
PeerWithState returns a new Peer that contains the given state information
func (*Peer) AddResource ¶ added in v0.3.3
AddResource adds the given resource if it isn't blank
func (*Peer) ClearResources ¶ added in v0.3.3
func (p *Peer) ClearResources()
ClearResources removes all known resources for the given peer
func (*Peer) HasResources ¶ added in v0.3.3
HasResources returns true if this peer has any online resources
func (*Peer) MainStatus ¶ added in v0.3.9
MainStatus returns the status of the current main resource
func (*Peer) MainStatusMsg ¶ added in v0.3.9
MainStatusMsg returns the status message of the current main resource
func (*Peer) MergeWith ¶
MergeWith returns a new Peer that is the merger of the receiver and the argument, giving precedence to the argument when needed
func (*Peer) NameForPresentation ¶
NameForPresentation returns the name if it exists and otherwise the JID
func (*Peer) RemoveResource ¶ added in v0.3.3
RemoveResource removes the given resource
func (*Peer) ResourceToUse ¶ added in v0.3.3
ResourceToUse returns the resource to use for this peer
func (*Peer) ResourceToUseFallback ¶
ResourceToUseFallback returns the resource to use for this peer or any resource if one exists
func (*Peer) SetLatestError ¶
SetLatestError will set the latest error on the jid in question
func (*Peer) ToEntry ¶
func (p *Peer) ToEntry() data.RosterEntry
ToEntry returns a new RosterEntry with the same values