本文整理汇总了Golang中kevlar/ircd/parser.Message.DestIDs方法的典型用法代码示例。如果您正苦于以下问题:Golang Message.DestIDs方法的具体用法?Golang Message.DestIDs怎么用?Golang Message.DestIDs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kevlar/ircd/parser.Message
的用法示例。
在下文中一共展示了Message.DestIDs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SQuit
func SQuit(hook string, msg *parser.Message, ircd *IRCd) {
split, reason := msg.Args[0], msg.Args[1]
if split == Config.SID {
split = msg.SenderID
}
// Forward
for sid := range server.Iter() {
if sid != msg.SenderID {
msg := msg.Dup()
msg.DestIDs = []string{sid}
ircd.ToServer <- msg
}
}
if server.IsLocal(split) {
ircd.ToServer <- &parser.Message{
Command: parser.CMD_ERROR,
Args: []string{
"SQUIT: " + reason,
},
}
}
sids := server.Unlink(split)
peers := user.Netsplit(sids)
notify := channel.Netsplit(Config.SID, peers)
log.Debug.Printf("NET SPLIT: %s", split)
log.Debug.Printf(" - SIDs: %v", sids)
log.Debug.Printf(" - Peers: %v", peers)
log.Debug.Printf(" - Notify: %v", notify)
for uid, peers := range notify {
if len(peers) > 0 {
ircd.ToClient <- &parser.Message{
Prefix: uid,
Command: parser.CMD_QUIT,
Args: []string{
"*.net *.split",
},
DestIDs: peers,
}
}
}
// Delete all of the peers
if len(peers) > 0 {
ircd.ToClient <- &parser.Message{
Command: parser.INT_DELUSER,
DestIDs: peers,
}
}
}
示例2: ConnReg
// Handle the NICK, USER, SERVER, and PASS messages
func ConnReg(hook string, msg *parser.Message, ircd *IRCd) {
var err os.Error
var u *user.User
var s *server.Server
switch len(msg.SenderID) {
case 3:
s = server.Get(msg.SenderID, true)
case 9:
u = user.Get(msg.SenderID)
}
switch msg.Command {
case parser.CMD_NICK:
// NICK <nick>
if u != nil {
nick := msg.Args[0]
err = u.SetNick(nick)
}
case parser.CMD_USER:
// USER <user> . . :<real name>
if u != nil {
username, realname := msg.Args[0], msg.Args[3]
err = u.SetUser(username, realname)
}
case parser.CMD_PASS:
if s != nil {
if len(msg.Args) != 4 {
return
}
// PASS <password> TS <ver> <pfx>
err = s.SetPass(msg.Args[0], msg.Args[2], msg.Args[3])
}
case parser.CMD_CAPAB:
if s != nil {
err = s.SetCapab(msg.Args[0])
}
case parser.CMD_SERVER:
if s != nil {
err = s.SetServer(msg.Args[0], msg.Args[1])
}
default:
log.Warn.Printf("Unknown command %q", msg)
}
if u != nil {
if err != nil {
switch err := err.(type) {
case *parser.Numeric:
msg := err.Message()
msg.DestIDs = append(msg.DestIDs, u.ID())
ircd.ToClient <- msg
return
default:
msg := &parser.Message{
Command: parser.CMD_ERROR,
Args: []string{err.String()},
DestIDs: []string{u.ID()},
}
ircd.ToClient <- msg
return
}
}
nickname, username, realname, _ := u.Info()
if nickname != "*" && username != "" {
// Notify servers
for sid := range server.Iter() {
ircd.ToServer <- &parser.Message{
Prefix: Config.SID,
Command: parser.CMD_UID,
Args: []string{
nickname,
"1",
u.TS(),
"+i",
username,
"some.host",
"127.0.0.1",
u.ID(),
realname,
},
DestIDs: []string{sid},
}
}
// Process signon
sendSignon(u, ircd)
return
}
}
if s != nil {
if err != nil {
switch err := err.(type) {
case *parser.Numeric:
msg := err.Message()
msg.DestIDs = append(msg.DestIDs, s.ID())
ircd.ToServer <- msg
//.........这里部分代码省略.........