Exemplo n.º 1
0
func peerFrom(entry data.RosterEntry, c *config.Account) *roster.Peer {
	belongsTo := c.ID()
	var nickname string
	p, ok := c.GetPeer(entry.Jid)
	if ok {
		nickname = p.Nickname
	}
	return roster.PeerFrom(entry, belongsTo, nickname)
}
Exemplo n.º 2
0
func peerFrom(entry data.RosterEntry, c *config.Account) *roster.Peer {
	belongsTo := c.ID()

	var nickname string
	var groups []string
	if p, ok := c.GetPeer(entry.Jid); ok {
		nickname = p.Nickname
		groups = p.Groups
	}

	return roster.PeerFrom(entry, belongsTo, nickname, groups)
}
Exemplo n.º 3
0
// PeerFrom returns a new Peer that contains the same information as the RosterEntry given
func PeerFrom(e xmpp.RosterEntry, conf *config.Account) *Peer {
	belongsTo := conf.ID()
	var nickname string
	p, ok := conf.GetPeer(e.Jid)
	if ok {
		nickname = p.Nickname
	}
	return &Peer{
		Jid:          xmpp.RemoveResourceFromJid(e.Jid),
		Subscription: e.Subscription,
		Name:         e.Name,
		Nickname:     nickname,
		Groups:       toSet(e.Group...),
		BelongsTo:    belongsTo,
	}
}