Add downstream INVITE support
This commit is contained in:
parent
3b6e175365
commit
9530df5db0
@ -1236,6 +1236,34 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
|
|||||||
|
|
||||||
uc.network.ring.Produce(echoMsg)
|
uc.network.ring.Produce(echoMsg)
|
||||||
}
|
}
|
||||||
|
case "INVITE":
|
||||||
|
var user, channel string
|
||||||
|
if err := parseMessageParams(msg, &user, &channel); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ucChannel, upstreamChannel, err := dc.unmarshalEntity(channel)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ucUser, upstreamUser, err := dc.unmarshalEntity(user)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if ucChannel != ucUser {
|
||||||
|
return ircError{&irc.Message{
|
||||||
|
Command: irc.ERR_USERNOTINCHANNEL,
|
||||||
|
Params: []string{dc.nick, user, channel, "They aren't on that channel"},
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
uc := ucChannel
|
||||||
|
|
||||||
|
uc.SendMessageLabeled(dc, &irc.Message{
|
||||||
|
Command: "INVITE",
|
||||||
|
Params: []string{upstreamUser, upstreamChannel},
|
||||||
|
})
|
||||||
default:
|
default:
|
||||||
dc.logger.Printf("unhandled message: %v", msg)
|
dc.logger.Printf("unhandled message: %v", msg)
|
||||||
return newUnknownCommandError(msg.Command)
|
return newUnknownCommandError(msg.Command)
|
||||||
|
14
upstream.go
14
upstream.go
@ -1045,6 +1045,20 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
|||||||
Params: []string{dc.marshalNick(uc, nick), dc.marshalChannel(uc, channel)},
|
Params: []string{dc.marshalNick(uc, nick), dc.marshalChannel(uc, channel)},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
case irc.RPL_INVITING:
|
||||||
|
var nick string
|
||||||
|
var channel string
|
||||||
|
if err := parseMessageParams(msg, &nick, &channel); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
|
||||||
|
dc.SendMessage(&irc.Message{
|
||||||
|
Prefix: dc.srv.prefix(),
|
||||||
|
Command: irc.RPL_INVITING,
|
||||||
|
Params: []string{dc.nick, dc.marshalNick(uc, nick), dc.marshalChannel(uc, channel)},
|
||||||
|
})
|
||||||
|
})
|
||||||
case "TAGMSG":
|
case "TAGMSG":
|
||||||
// TODO: relay to downstream connections that accept message-tags
|
// TODO: relay to downstream connections that accept message-tags
|
||||||
case "ACK":
|
case "ACK":
|
||||||
|
Loading…
Reference in New Issue
Block a user