Implements send / send raw

This commit is contained in:
Mickael Remond
2018-01-26 09:55:39 +01:00
parent 2cd8eed765
commit ad6e09a0f6
4 changed files with 39 additions and 8 deletions

View File

@@ -13,7 +13,13 @@ import (
)
func main() {
options := xmpp.Options{Address: "localhost:5222", Jid: "test@localhost", Password: "test", PacketLogger: os.Stdout}
options := xmpp.Options{
Address: "localhost:5222",
Jid: "test@localhost",
Password: "test",
PacketLogger: os.Stdout,
Insecure: true,
}
var client *xmpp.Client
var err error
@@ -34,7 +40,7 @@ func main() {
case *xmpp.Message:
fmt.Fprintf(os.Stdout, "Body = %s - from = %s\n", packet.Body, packet.From)
reply := xmpp.Message{PacketAttrs: xmpp.PacketAttrs{To: packet.From}, Body: packet.Body}
client.Send(reply.XMPPFormat())
client.Send(reply)
default:
fmt.Fprintf(os.Stdout, "Ignoring packet: %T\n", packet)
}