Add upstream RPL_CREATIONTIME support
This commit is contained in:
parent
2cb0cf3665
commit
3b6e175365
@ -1031,6 +1031,13 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
|
|||||||
Command: irc.RPL_CHANNELMODEIS,
|
Command: irc.RPL_CHANNELMODEIS,
|
||||||
Params: params,
|
Params: params,
|
||||||
})
|
})
|
||||||
|
if ch.creationTime != "" {
|
||||||
|
dc.SendMessage(&irc.Message{
|
||||||
|
Prefix: dc.srv.prefix(),
|
||||||
|
Command: rpl_creationtime,
|
||||||
|
Params: []string{dc.nick, name, ch.creationTime},
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case "TOPIC":
|
case "TOPIC":
|
||||||
var channel string
|
var channel string
|
||||||
|
1
irc.go
1
irc.go
@ -11,6 +11,7 @@ const (
|
|||||||
rpl_statsping = "246"
|
rpl_statsping = "246"
|
||||||
rpl_localusers = "265"
|
rpl_localusers = "265"
|
||||||
rpl_globalusers = "266"
|
rpl_globalusers = "266"
|
||||||
|
rpl_creationtime = "329"
|
||||||
rpl_topicwhotime = "333"
|
rpl_topicwhotime = "333"
|
||||||
err_invalidcapcmd = "410"
|
err_invalidcapcmd = "410"
|
||||||
)
|
)
|
||||||
|
41
upstream.go
41
upstream.go
@ -16,15 +16,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type upstreamChannel struct {
|
type upstreamChannel struct {
|
||||||
Name string
|
Name string
|
||||||
conn *upstreamConn
|
conn *upstreamConn
|
||||||
Topic string
|
Topic string
|
||||||
TopicWho string
|
TopicWho string
|
||||||
TopicTime time.Time
|
TopicTime time.Time
|
||||||
Status channelStatus
|
Status channelStatus
|
||||||
modes channelModes
|
modes channelModes
|
||||||
Members map[string]*membership
|
creationTime string
|
||||||
complete bool
|
Members map[string]*membership
|
||||||
|
complete bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type upstreamConn struct {
|
type upstreamConn struct {
|
||||||
@ -763,6 +764,28 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
case rpl_creationtime:
|
||||||
|
var channel, creationTime string
|
||||||
|
if err := parseMessageParams(msg, nil, &channel, &creationTime); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ch, err := uc.getChannel(channel)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
firstCreationTime := ch.creationTime == ""
|
||||||
|
ch.creationTime = creationTime
|
||||||
|
if firstCreationTime {
|
||||||
|
uc.forEachDownstream(func(dc *downstreamConn) {
|
||||||
|
dc.SendMessage(&irc.Message{
|
||||||
|
Prefix: dc.srv.prefix(),
|
||||||
|
Command: rpl_creationtime,
|
||||||
|
Params: []string{dc.nick, channel, creationTime},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
case rpl_topicwhotime:
|
case rpl_topicwhotime:
|
||||||
var name, who, timeStr string
|
var name, who, timeStr string
|
||||||
if err := parseMessageParams(msg, nil, &name, &who, &timeStr); err != nil {
|
if err := parseMessageParams(msg, nil, &name, &who, &timeStr); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user