mirror of
https://github.com/FluuxIO/go-xmpp.git
synced 2024-11-21 18:12:00 -08:00
feat: refactor message body and subject structs as common LocalizedString
This commit is contained in:
parent
da90222053
commit
cef045dc58
@ -8,18 +8,7 @@ import (
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Message Packet
|
// Message Packet
|
||||||
|
|
||||||
// Subject is an element of a message
|
type LocalizedString struct {
|
||||||
type Subject struct {
|
|
||||||
XMLName xml.Name `xml:"subject"`
|
|
||||||
|
|
||||||
Content string `xml:",chardata"`
|
|
||||||
Lang string `xml:"lang,attr,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Body is an element of a message
|
|
||||||
type Body struct {
|
|
||||||
XMLName xml.Name `xml:"body"`
|
|
||||||
|
|
||||||
Content string `xml:",chardata"`
|
Content string `xml:",chardata"`
|
||||||
Lang string `xml:"lang,attr,omitempty"`
|
Lang string `xml:"lang,attr,omitempty"`
|
||||||
}
|
}
|
||||||
@ -29,11 +18,11 @@ type Message struct {
|
|||||||
XMLName xml.Name `xml:"message"`
|
XMLName xml.Name `xml:"message"`
|
||||||
Attrs
|
Attrs
|
||||||
|
|
||||||
Subject []Subject `xml:"subject,omitempty"`
|
Subject []LocalizedString `xml:"subject,omitempty"`
|
||||||
Body []Body `xml:"body,omitempty"`
|
Body []LocalizedString `xml:"body,omitempty"`
|
||||||
Thread string `xml:"thread,omitempty"`
|
Thread string `xml:"thread,omitempty"`
|
||||||
Error Err `xml:"error,omitempty"`
|
Error Err `xml:"error,omitempty"`
|
||||||
Extensions []MsgExtension `xml:",omitempty"`
|
Extensions []MsgExtension `xml:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Message) Name() string {
|
func (Message) Name() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user