changeset 179 | 4477c9f31f43 |
parent 178 | ccfebbd9f49b |
child 180 | 3010996c1928 |
--- a/xmpp/structs.go Sat Nov 09 12:09:37 2013 -0700 +++ b/xmpp/structs.go Sat Nov 09 12:22:01 2013 -0700 @@ -183,6 +183,15 @@ return string(j[slash+1:]) } +// Returns the bare JID, which is the JID without the resource part. +func (j JID) Bare() JID { + node := j.Node() + if node == "" { + return JID(j.Domain()) + } + return JID(fmt.Sprintf("%s@%s", node, j.Domain())) +} + func (s *stream) String() string { var buf bytes.Buffer buf.WriteString(`<stream:stream xmlns="`)