Updated the example to match the new API, and fixed the roster Update to not require a reference to the client.
--- a/examples/interact.go Mon Sep 02 20:38:57 2013 -0700
+++ b/examples/interact.go Mon Sep 02 20:45:24 2013 -0700
@@ -53,11 +53,12 @@
}
defer close(c.Out)
- err = c.StartSession(true, &xmpp.Presence{})
+ err = c.StartSession(&xmpp.Presence{})
if err != nil {
log.Fatalf("StartSession: %v", err)
}
- roster := xmpp.Roster(c)
+ c.Roster.Update()
+ roster := c.Roster.Get()
fmt.Printf("%d roster entries:\n", len(roster))
for i, entry := range roster {
fmt.Printf("%d: %v\n", i, entry)
--- a/roster.go Mon Sep 02 20:38:57 2013 -0700
+++ b/roster.go Mon Sep 02 20:45:24 2013 -0700
@@ -138,9 +138,9 @@
// Synchronously fetch this entity's roster from the server and cache
// that information. The client can access the roster by watching for
// RosterQuery objects or by calling Get().
-func (r *Roster) Update(client *Client) {
- iq := &Iq{Header: Header{From: client.Jid.String(), Type: "get",
- Id: NextId(), Nested: []interface{}{RosterQuery{}}}}
+func (r *Roster) Update() {
+ iq := &Iq{Header: Header{Type: "get", Id: NextId(),
+ Nested: []interface{}{RosterQuery{}}}}
waitchan := make(chan int)
done := func() {
close(waitchan)