Simplified the roster filter.
authorChris Jones <chris@cjones.org>
Mon, 02 Jan 2012 10:01:41 -0700
changeset 50 08d2b9deb710
parent 49 8e140810be02
child 51 1af366d10d32
Simplified the roster filter.
roster.go
--- a/roster.go	Mon Jan 02 09:58:44 2012 -0700
+++ b/roster.go	Mon Jan 02 10:01:41 2012 -0700
@@ -78,25 +78,11 @@
 func (cl *Client) startRosterFilter() {
 	out := make(chan Stanza)
 	in := cl.AddFilter(out)
-	go func(inSave <-chan Stanza, outSave chan<- Stanza) {
+	go func(in <-chan Stanza, out chan<- Stanza) {
 		defer close(out)
-		in := inSave
-		var out chan<- Stanza
-		var st Stanza
-		var ok bool
-		for {
-			select {
-			case st, ok = <- in:
-				if !ok {
-					break
-				}
-				cl.maybeUpdateRoster(st)
-				in = nil
-				out = outSave
-			case out <- st:
-				out = nil
-				in = inSave
-			}
+		for st := range(in) {
+			cl.maybeUpdateRoster(st)
+			out <- st
 		}
 	}(in, out)
 }