xmpp.go
branchgo.weekly.2012-01-15
changeset 93 fbd51fa6b7ea
parent 81 a74e7fc4ecee
equal deleted inserted replaced
87:d19b556d4ea6 93:fbd51fa6b7ea
    12 	"encoding/xml"
    12 	"encoding/xml"
    13 	"errors"
    13 	"errors"
    14 	"fmt"
    14 	"fmt"
    15 	"io"
    15 	"io"
    16 	"log"
    16 	"log"
    17 	"log/syslog"
       
    18 	"net"
    17 	"net"
    19 	"sync"
    18 	"sync"
    20 )
    19 )
    21 
    20 
    22 const (
    21 const (
    35 	// DNS SRV names
    34 	// DNS SRV names
    36 	serverSrv = "xmpp-server"
    35 	serverSrv = "xmpp-server"
    37 	clientSrv = "xmpp-client"
    36 	clientSrv = "xmpp-client"
    38 )
    37 )
    39 
    38 
       
    39 // This is copied from log/syslog, because that's not implemented on
       
    40 // Windows.
       
    41 type Priority int
       
    42 const (
       
    43 	LOG_EMERG Priority = iota
       
    44 	LOG_ALERT
       
    45 	LOG_CRIT
       
    46 	LOG_ERR
       
    47 	LOG_WARNING
       
    48 	LOG_NOTICE
       
    49 	LOG_INFO
       
    50 	LOG_DEBUG
       
    51 )
       
    52 
    40 var (
    53 var (
    41 	// If non-nil when NewClient() is called, log messages will be
    54 	// If non-nil when NewClient() is called, log messages will be
    42 	// sent to this writer.
    55 	// sent to this writer.
    43 	Log *log.Logger
    56 	Log *log.Logger
    44 	// Threshold for which messages are logged.
    57 	// Threshold for which messages are logged.
    45 	Loglevel syslog.Priority = syslog.LOG_NOTICE
    58 	Loglevel Priority = LOG_NOTICE
    46 	// Use this Config to negotiate TLS connections.
    59 	// Use this Config to negotiate TLS connections.
    47 	TLSConfig *tls.Config = nil
    60 	TLSConfig *tls.Config = nil
    48 )
    61 )
    49 
    62 
    50 // This channel may be used as a convenient way to generate a unique
    63 // This channel may be used as a convenient way to generate a unique