1// Copyright 2013 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Package xmpp implements the XMPP IM protocol, as specified in RFC 6120 and
6// 6121.
7package xmpp
8
9import (
10	"fmt"
11
12	"github.com/coyim/coyim/xmpp/data"
13)
14
15// RequestRoster requests the user's roster from the server. It returns a
16// channel on which the reply can be read when received and a Cookie that can
17// be used to cancel the request.
18func (c *conn) RequestRoster() (<-chan data.Stanza, data.Cookie, error) {
19	cookie := c.getCookie()
20	if _, err := fmt.Fprintf(c.out, "<iq type='get' id='%x'><query xmlns='jabber:iq:roster'/></iq>", cookie); err != nil {
21		return nil, 0, err
22	}
23
24	return c.createInflight(cookie, "")
25}
26