Moved some code around.
--- a/xmpp/status.go Mon Sep 30 20:35:17 2013 -0600
+++ b/xmpp/status.go Wed Oct 02 23:22:27 2013 -0600
@@ -6,6 +6,51 @@
"fmt"
)
+// Status of the connection.
+type Status int
+
+const (
+ statusUnconnected = iota
+ statusConnected
+ statusConnectedTls
+ statusAuthenticated
+ statusBound
+ statusRunning
+ statusShutdown
+ statusError
+)
+
+var (
+ // The client has not yet connected, or it has been
+ // disconnected from the server.
+ StatusUnconnected Status = statusUnconnected
+ // Initial connection established.
+ StatusConnected Status = statusConnected
+ // Like StatusConnected, but with TLS.
+ StatusConnectedTls Status = statusConnectedTls
+ // Authentication succeeded.
+ StatusAuthenticated Status = statusAuthenticated
+ // Resource binding complete.
+ StatusBound Status = statusBound
+ // Session has started and normal message traffic can be sent
+ // and received.
+ StatusRunning Status = statusRunning
+ // The session has closed, or is in the process of closing.
+ StatusShutdown Status = statusShutdown
+ // The session has encountered an error. Otherwise identical
+ // to StatusShutdown.
+ StatusError Status = statusError
+)
+
+func (s Status) fatal() bool {
+ switch s {
+ default:
+ return false
+ case StatusShutdown, StatusError:
+ return true
+ }
+}
+
type statmgr struct {
newStatus chan Status
newlistener chan chan Status
--- a/xmpp/xmpp.go Mon Sep 30 20:35:17 2013 -0600
+++ b/xmpp/xmpp.go Wed Oct 02 23:22:27 2013 -0600
@@ -34,51 +34,6 @@
clientSrv = "xmpp-client"
)
-// Status of the connection.
-type Status int
-
-const (
- statusUnconnected = iota
- statusConnected
- statusConnectedTls
- statusAuthenticated
- statusBound
- statusRunning
- statusShutdown
- statusError
-)
-
-var (
- // The client has not yet connected, or it has been
- // disconnected from the server.
- StatusUnconnected Status = statusUnconnected
- // Initial connection established.
- StatusConnected Status = statusConnected
- // Like StatusConnected, but with TLS.
- StatusConnectedTls Status = statusConnectedTls
- // Authentication succeeded.
- StatusAuthenticated Status = statusAuthenticated
- // Resource binding complete.
- StatusBound Status = statusBound
- // Session has started and normal message traffic can be sent
- // and received.
- StatusRunning Status = statusRunning
- // The session has closed, or is in the process of closing.
- StatusShutdown Status = statusShutdown
- // The session has encountered an error. Otherwise identical
- // to StatusShutdown.
- StatusError Status = statusError
-)
-
-func (s Status) fatal() bool {
- switch s {
- default:
- return false
- case StatusShutdown, StatusError:
- return true
- }
-}
-
// A filter can modify the XMPP traffic to or from the remote
// server. It's part of an Extension. The filter function will be
// called in a new goroutine, so it doesn't need to return. The filter