Add downstream self WHO and WHOIS support
This commit is contained in:
parent
a958a01446
commit
9486d657c5
@ -960,6 +960,21 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
|
|||||||
// TODO: support WHO masks
|
// TODO: support WHO masks
|
||||||
entity := msg.Params[0]
|
entity := msg.Params[0]
|
||||||
|
|
||||||
|
if entity == dc.nick {
|
||||||
|
// TODO: support AWAY (H/G) in self WHO reply
|
||||||
|
dc.SendMessage(&irc.Message{
|
||||||
|
Prefix: dc.srv.prefix(),
|
||||||
|
Command: irc.RPL_WHOREPLY,
|
||||||
|
Params: []string{dc.nick, "*", dc.username, dc.hostname, dc.srv.Hostname, dc.nick, "H", "0 " + dc.realname},
|
||||||
|
})
|
||||||
|
dc.SendMessage(&irc.Message{
|
||||||
|
Prefix: dc.srv.prefix(),
|
||||||
|
Command: irc.RPL_ENDOFWHO,
|
||||||
|
Params: []string{dc.nick, dc.nick, "End of /WHO list"},
|
||||||
|
})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
uc, upstreamName, err := dc.unmarshalEntity(entity)
|
uc, upstreamName, err := dc.unmarshalEntity(entity)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -997,6 +1012,25 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
|
|||||||
mask = mask[:i]
|
mask = mask[:i]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if mask == dc.nick {
|
||||||
|
dc.SendMessage(&irc.Message{
|
||||||
|
Prefix: dc.srv.prefix(),
|
||||||
|
Command: irc.RPL_WHOISUSER,
|
||||||
|
Params: []string{dc.nick, dc.nick, dc.username, dc.hostname, "*", dc.realname},
|
||||||
|
})
|
||||||
|
dc.SendMessage(&irc.Message{
|
||||||
|
Prefix: dc.srv.prefix(),
|
||||||
|
Command: irc.RPL_WHOISSERVER,
|
||||||
|
Params: []string{dc.nick, dc.nick, dc.srv.Hostname, "soju"},
|
||||||
|
})
|
||||||
|
dc.SendMessage(&irc.Message{
|
||||||
|
Prefix: dc.srv.prefix(),
|
||||||
|
Command: irc.RPL_ENDOFWHOIS,
|
||||||
|
Params: []string{dc.nick, dc.nick, "End of /WHOIS list"},
|
||||||
|
})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: support WHOIS masks
|
// TODO: support WHOIS masks
|
||||||
uc, upstreamNick, err := dc.unmarshalEntity(mask)
|
uc, upstreamNick, err := dc.unmarshalEntity(mask)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -758,7 +758,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
|||||||
dc.SendMessage(&irc.Message{
|
dc.SendMessage(&irc.Message{
|
||||||
Prefix: dc.srv.prefix(),
|
Prefix: dc.srv.prefix(),
|
||||||
Command: irc.RPL_ENDOFWHO,
|
Command: irc.RPL_ENDOFWHO,
|
||||||
Params: []string{dc.nick, name, "End of WHO list"},
|
Params: []string{dc.nick, name, "End of /WHO list"},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
case irc.RPL_WHOISUSER:
|
case irc.RPL_WHOISUSER:
|
||||||
@ -852,7 +852,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
|||||||
dc.SendMessage(&irc.Message{
|
dc.SendMessage(&irc.Message{
|
||||||
Prefix: dc.srv.prefix(),
|
Prefix: dc.srv.prefix(),
|
||||||
Command: irc.RPL_ENDOFWHOIS,
|
Command: irc.RPL_ENDOFWHOIS,
|
||||||
Params: []string{dc.nick, nick, "End of WHOIS list"},
|
Params: []string{dc.nick, nick, "End of /WHOIS list"},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
case "PRIVMSG":
|
case "PRIVMSG":
|
||||||
|
Loading…
Reference in New Issue
Block a user