From 107f97f2cd3ff8dbbdb39269e622462c48b0d41c Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 4 Jul 2023 22:30:44 +0200 Subject: Implement (chat) message receiving backend This sets a handler and the routing up to be able to log chat messages with body and sender reference. This can later be used for the GUI. --- xmpp/message.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 xmpp/message.go (limited to 'xmpp/message.go') diff --git a/xmpp/message.go b/xmpp/message.go new file mode 100644 index 0000000..58dc657 --- /dev/null +++ b/xmpp/message.go @@ -0,0 +1,17 @@ +package xmpp + +import ( + "log" +) + +type message struct { + Type string `xml:"type,attr"` + From string `xml:"from,attr"` + Body string `xml:"body"` +} + +func handleMessage(s *session, m message) { + if m.Type == "chat" { + log.Printf("Got message '%s' from '%s'.\n", m.Body, m.From) + } +} -- cgit v1.2.3-70-g09d2