本文整理匯總了Golang中github.com/fluffle/goirc/client.Conn.Whois方法的典型用法代碼示例。如果您正苦於以下問題:Golang Conn.Whois方法的具體用法?Golang Conn.Whois怎麽用?Golang Conn.Whois使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/fluffle/goirc/client.Conn
的用法示例。
在下文中一共展示了Conn.Whois方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: checkIdentified
func checkIdentified(irc *client.Conn, nick string) bool {
if !*requireAuth {
return true
}
// We don't cache identification failures since the user can always identify later
if isIdentifiedCache[nick] {
return true
}
log.Println("Checking whether", nick, "is identified")
isIdentifiedChan[nick] = make(chan bool, 1)
timeout := time.After(10 * time.Second)
go irc.Whois(nick)
r := false
for is, ok := false, true; ok; {
select {
case is, ok = <-isIdentifiedChan[nick]:
if is {
r = true
}
case <-timeout:
log.Println("Timeout checking for whether", nick, "is identified")
return false
}
}
delete(isIdentifiedChan, nick)
log.Println("Is nick", nick, "identified:", r)
if r {
isIdentifiedCache[nick] = true
}
return r
}