Updated the example to match the new API, and fixed the roster Update to not require a reference to the client.
authorChris Jones <christian.jones@sri.com>
Mon, 02 Sep 2013 20:45:24 -0700
changeset 124 34e917ca6a11
parent 123 42a9995faa38
child 125 f464f14e39a7
Updated the example to match the new API, and fixed the roster Update to not require a reference to the client.
examples/interact.go
roster.go
--- 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)