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 string) (*Peer, bool)
- func (l *List) GetGroupNames() map[string]bool
- func (l *List) GetPendingSubscribe(jid string) (string, bool)
- func (l *List) Grouped(delim string) *Group
- func (l *List) Iter(cb func(int, *Peer))
- func (l *List) LatestError(jid string, code, tp, more string)
- func (l *List) PeerBecameUnavailable(jid string) bool
- func (l *List) PeerPresenceUpdate(jid, status, statusMsg, belongsTo string) bool
- func (l *List) Remove(jid string) (*Peer, bool)
- func (l *List) RemovePendingSubscribe(jid string) (string, bool)
- func (l *List) StateOf(jid string) (status, statusMsg string, ok bool)
- func (l *List) SubscribeRequest(jid, id, belongsTo string)
- func (l *List) Subscribed(jid string)
- func (l *List) ToSlice() []*Peer
- func (l *List) Unsubscribed(jid string)
- type Peer
- type PeerError
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
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) GetGroupNames ¶
GetGroupNames return all group names for this peer list.
func (*List) GetPendingSubscribe ¶
GetPendingSubscribe will return a subscribe id without removing it
func (*List) LatestError ¶
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 ¶
PeerPresenceUpdate updates the status for the peer It returns true if it actually updated the status of the user
func (*List) Remove ¶
Remove returns the Peer with the jid from the List - it will first turn the jid into a bare jid. It returns true if it could remove the entry and false otherwise. It also returns the removed entry.
func (*List) RemovePendingSubscribe ¶
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) StateOf ¶
StateOf returns the status and status msg of the peer if it exists. It returns not ok if the peer doesn't exist.
func (*List) SubscribeRequest ¶
SubscribeRequest adds a new pending subscribe request
func (*List) Subscribed ¶
Subscribed will mark the jid as subscribed
func (*List) Unsubscribed ¶
Unsubscribed will mark the jid as unsubscribed
type Peer ¶
type Peer struct { // The bare jid of the peer Jid string Subscription string Name string Nickname string Groups map[string]bool Status string StatusMsg string Online bool Asked bool PendingSubscribeID string BelongsTo string LatestError *PeerError }
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 ¶
PeerWithState returns a new Peer that contains the given state information
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) 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