# HG changeset patch # User Chris Jones # Date 1380777747 21600 # Node ID 8093a2da46db96146c2b0164c34b6938941927ac # Parent d3182a279bf48039c30f4196913bc000c3e655bd Moved some code around. diff -r d3182a279bf4 -r 8093a2da46db xmpp/status.go --- 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 diff -r d3182a279bf4 -r 8093a2da46db xmpp/xmpp.go --- 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