Rest in peace Dolly Patron
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"gosrc.io/xmpp/stanza"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Implementation of XEP-0203: Delayed Delivery
|
||||
// https://xmpp.org/extensions/xep-0203.html
|
||||
|
||||
type Delayed_Stamp struct {
|
||||
XMLName xml.Name `xml:"urn:xmpp:delay delay"`
|
||||
From string `xml:"from,attr"`
|
||||
Stamp string `xml:"stamp,attr"`
|
||||
}
|
||||
|
||||
func (d *Delayed_Stamp) GetStamp() (*time.Time, error) {
|
||||
stamp := d.Stamp
|
||||
time, err := time.Parse(time.RFC3339, stamp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &time, nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
stanza.TypeRegistry.MapExtension(stanza.PKTMessage, xml.Name{Space: "urn:xmpp:delay", Local: "delay"}, Delayed_Stamp{})
|
||||
}
|
||||
Reference in New Issue
Block a user