diff -r ccfebbd9f49b -r 4477c9f31f43 xmpp/structs.go --- 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(`