本文整理汇总了Golang中github.com/twstrike/coyim/config.Account.ID方法的典型用法代码示例。如果您正苦于以下问题:Golang Account.ID方法的具体用法?Golang Account.ID怎么用?Golang Account.ID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/twstrike/coyim/config.Account
的用法示例。
在下文中一共展示了Account.ID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: peerFrom
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)
}
示例2: peerFrom
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)
}
示例3: PeerFrom
// 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,
}
}
示例4: removeAccount
func (m *accountManager) removeAccount(conf *config.Account, k func()) {
toRemove, exists := m.getAccountByID(conf.ID())
if !exists {
return
}
m.Lock()
defer m.Unlock()
accs := make([]*account, 0, len(m.accounts)-1)
for _, acc := range m.accounts {
if acc == toRemove {
delete(m.contacts, acc)
continue
}
accs = append(accs, acc)
}
m.accounts = accs
k()
}