summaryrefslogtreecommitdiff
path: root/xmpp/jid.go
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp/jid.go')
-rw-r--r--xmpp/jid.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/xmpp/jid.go b/xmpp/jid.go
index f3a5d49..672e934 100644
--- a/xmpp/jid.go
+++ b/xmpp/jid.go
@@ -21,3 +21,23 @@ func domainpart(jid string) string {
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)
+}