summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-05-15 21:27:15 +0200
committerxengineering <me@xengineering.eu>2023-05-15 21:27:15 +0200
commit6580ea9912cc296680414e775244a50534667a10 (patch)
tree85cf24799e16d1e5bb5a677df50ed1962b430ac3
parent01011c81c6fafb7435a98c9bf2309082cf5b13f8 (diff)
downloadlimox-6580ea9912cc296680414e775244a50534667a10.tar
limox-6580ea9912cc296680414e775244a50534667a10.tar.zst
limox-6580ea9912cc296680414e775244a50534667a10.zip
Split JID logic into xmpp/jid.go
-rw-r--r--xmpp/jid.go23
-rw-r--r--xmpp/xmpp.go22
2 files changed, 23 insertions, 22 deletions
diff --git a/xmpp/jid.go b/xmpp/jid.go
new file mode 100644
index 0000000..f3a5d49
--- /dev/null
+++ b/xmpp/jid.go
@@ -0,0 +1,23 @@
+package xmpp
+
+// 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 {
+ list := []rune(jid)
+
+ for i, v := range list {
+ if v == '/' {
+ list = list[:i]
+ break
+ }
+ }
+
+ for i, v := range list {
+ if v == '@' {
+ list = list[i+1:]
+ break
+ }
+ }
+
+ return string(list)
+}
diff --git a/xmpp/xmpp.go b/xmpp/xmpp.go
index fa61e0b..5be12c4 100644
--- a/xmpp/xmpp.go
+++ b/xmpp/xmpp.go
@@ -128,25 +128,3 @@ func sendStreamEnd(enc *xml.Encoder, dbg *xml.Encoder, end xml.EndElement) {
log.Println("Could not flush debug XML encoder!")
}
}
-
-// 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 {
- list := []rune(jid)
-
- for i, v := range list {
- if v == '/' {
- list = list[:i]
- break
- }
- }
-
- for i, v := range list {
- if v == '@' {
- list = list[i+1:]
- break
- }
- }
-
- return string(list)
-}