mirror of
https://github.com/ergochat/ergo.git
synced 2025-01-03 16:42:38 +01:00
capability: Add server-time
This commit is contained in:
parent
e04ef1ca11
commit
ef592d160c
@ -20,6 +20,7 @@ Initial release of Oragono!
|
|||||||
* We now advertise the [`RPL_ISUPPORT`](http://modern.ircdocs.horse/#rplisupport-005) numeric.
|
* We now advertise the [`RPL_ISUPPORT`](http://modern.ircdocs.horse/#rplisupport-005) numeric.
|
||||||
* Parse new mode change syntax commonly used these days (i.e. `+h-ov dan dan dan`).
|
* Parse new mode change syntax commonly used these days (i.e. `+h-ov dan dan dan`).
|
||||||
* User mode for clients connected via TLS (`+Z`).
|
* User mode for clients connected via TLS (`+Z`).
|
||||||
|
* Support for [`server-time`](http://ircv3.net/specs/extensions/server-time-3.2.html).
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Added channel Founder/Admin/Halfops (`qah`) privileges, and removed channel creator (`O`) privilege (from RFC2812, not used in the real world).
|
* Added channel Founder/Admin/Halfops (`qah`) privileges, and removed channel creator (`O`) privilege (from RFC2812, not used in the real world).
|
||||||
|
@ -16,11 +16,13 @@ type Capability string
|
|||||||
const (
|
const (
|
||||||
MultiPrefix Capability = "multi-prefix"
|
MultiPrefix Capability = "multi-prefix"
|
||||||
SASL Capability = "sasl"
|
SASL Capability = "sasl"
|
||||||
|
ServerTime Capability = "server-time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
SupportedCapabilities = CapabilitySet{
|
SupportedCapabilities = CapabilitySet{
|
||||||
MultiPrefix: true,
|
MultiPrefix: true,
|
||||||
|
ServerTime: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -343,6 +343,16 @@ func (client *Client) destroy() {
|
|||||||
|
|
||||||
// Send sends an IRC line to the client.
|
// Send sends an IRC line to the client.
|
||||||
func (client *Client) Send(tags *map[string]ircmsg.TagValue, prefix string, command string, params ...string) error {
|
func (client *Client) Send(tags *map[string]ircmsg.TagValue, prefix string, command string, params ...string) error {
|
||||||
|
// attach server-time
|
||||||
|
if client.capabilities[ServerTime] {
|
||||||
|
if tags == nil {
|
||||||
|
tags = ircmsg.MakeTags("time", time.Now().Format(time.RFC3339))
|
||||||
|
} else {
|
||||||
|
(*tags)["time"] = ircmsg.MakeTagValue(time.Now().Format(time.RFC3339))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// send out the message
|
||||||
ircmsg := ircmsg.MakeMessage(tags, prefix, command, params...)
|
ircmsg := ircmsg.MakeMessage(tags, prefix, command, params...)
|
||||||
line, err := ircmsg.Line()
|
line, err := ircmsg.Line()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user