summaryrefslogtreecommitdiff
path: root/xmpp/jid.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-07-06 21:45:31 +0200
committerxengineering <me@xengineering.eu>2023-07-06 21:45:31 +0200
commit16d5f079cc51bffe9f07b356f3a42d5a09a45317 (patch)
treeb370e7c5b220351b9c42f8f19fa30672d8310724 /xmpp/jid.go
parentd614346ae08e5384e1dca7306ba64fbdc9931d2e (diff)
parent007f413e457ff0b733447acba61b11d6813dd41c (diff)
downloadlimox-16d5f079cc51bffe9f07b356f3a42d5a09a45317.tar
limox-16d5f079cc51bffe9f07b356f3a42d5a09a45317.tar.zst
limox-16d5f079cc51bffe9f07b356f3a42d5a09a45317.zip
Merge branch 'roster-backend'
Getting the roster (contact list) is crucial to provide a MVP LimoX since the chats should be grouped by contacts. For the MVP it is only relevant to get the roster on connect. Everything else can be done later.
Diffstat (limited to 'xmpp/jid.go')
-rw-r--r--xmpp/jid.go50
1 files changed, 0 insertions, 50 deletions
diff --git a/xmpp/jid.go b/xmpp/jid.go
index 9580ad5..90c1509 100644
--- a/xmpp/jid.go
+++ b/xmpp/jid.go
@@ -1,12 +1,5 @@
package xmpp
-import (
- "encoding/xml"
- "fmt"
- "log"
- "math/rand"
-)
-
// domainpart extracts the domain name from a JID / XMPP address. See
// https://datatracker.ietf.org/doc/html/rfc7622#section-3.2 for details.
func domainpart(jid string) string {
@@ -40,46 +33,3 @@ func username(jid string) string {
return ""
}
-
-type bindRequest struct {
- Bind struct {
- Xmlns string `xml:"xmlns,attr"`
- Resource struct {
- Content string `xml:",chardata"`
- } `xml:"resource"`
- } `xml:"bind"`
-}
-
-func (s *session) sendBind() {
-
- s.resourceReq = fmt.Sprintf("%016x", rand.Uint64())
-
- start := xml.StartElement{
- xml.Name{"jabber:client", "iq"},
- []xml.Attr{
- xml.Attr{xml.Name{"", "id"}, s.resourceReq},
- xml.Attr{xml.Name{"", "type"}, "set"},
- },
- }
-
- inner := bindRequest{}
- inner.Bind.Xmlns = "urn:ietf:params:xml:ns:xmpp-bind"
- inner.Bind.Resource.Content = "limox-" + fmt.Sprintf("%08x", rand.Uint32())
-
- err := s.tx.EncodeElement(inner, start)
- if err != nil {
- log.Println("Could not encode ressource binding!")
- }
-}
-
-type iqResponse struct {
- Jid string `xml:"urn:ietf:params:xml:ns:xmpp-bind bind>jid"`
-}
-
-func handleIqResponse(s *session, i iqResponse) {
- if i.Jid != "" {
- s.jid = i.Jid
- s.sendPresence()
- return
- }
-}