blob: 672e93451e6961fbfca3f47998598c751a4ddb72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
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)
}
func username(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]
break
}
}
return string(list)
}
|