mirror of https://github.com/FluuxIO/go-xmpp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
602 B
Go
25 lines
602 B
Go
7 years ago
|
package xmpp // import "fluux.io/xmpp"
|
||
9 years ago
|
|
||
|
import (
|
||
|
"encoding/xml"
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
// XMPP Packet Parsing
|
||
|
type ClientMessage struct {
|
||
|
XMLName xml.Name `xml:"jabber:client message"`
|
||
|
Packet
|
||
|
Subject string `xml:"subject,omitempty"`
|
||
|
Body string `xml:"body,omitempty"`
|
||
|
Thread string `xml:"thread,omitempty"`
|
||
|
}
|
||
|
|
||
|
// TODO: Func new message to create an empty message structure without the XML tag matching elements
|
||
|
|
||
|
func (message *ClientMessage) XMPPFormat() string {
|
||
|
return fmt.Sprintf("<message to='%s' type='chat' xml:lang='en'>"+
|
||
|
"<body>%s</body></message>",
|
||
|
message.To,
|
||
|
xmlEscape(message.Body))
|
||
|
}
|