Index: /trunk/contrib/znc-import.go
===================================================================
--- /trunk/contrib/znc-import.go	(revision 541)
+++ /trunk/contrib/znc-import.go	(revision 542)
@@ -182,4 +182,5 @@
 			n.Realname = netRealname
 			n.Pass = pass
+			n.Enabled = section.Values.Get("IRCConnectEnabled") != "false"
 
 			if err := db.StoreNetwork(userID, n); err != nil {
Index: /trunk/db.go
===================================================================
--- /trunk/db.go	(revision 541)
+++ /trunk/db.go	(revision 542)
@@ -61,4 +61,5 @@
 	ConnectCommands []string
 	SASL            SASL
+	Enabled         bool
 }
 
Index: /trunk/db_sqlite.go
===================================================================
--- /trunk/db_sqlite.go	(revision 541)
+++ /trunk/db_sqlite.go	(revision 542)
@@ -35,4 +35,5 @@
 	sasl_external_cert BLOB DEFAULT NULL,
 	sasl_external_key BLOB DEFAULT NULL,
+	enabled INTEGER NOT NULL DEFAULT 1,
 	FOREIGN KEY(user) REFERENCES User(id),
 	UNIQUE(user, addr, nick),
@@ -132,4 +133,5 @@
 	`,
 	"ALTER TABLE Channel ADD COLUMN detached_internal_msgid VARCHAR(255)",
+	"ALTER TABLE Network ADD COLUMN enabled INTEGER NOT NULL DEFAULT 1",
 }
 
@@ -313,5 +315,5 @@
 	rows, err := db.db.Query(`SELECT id, name, addr, nick, username, realname, pass,
 			connect_commands, sasl_mechanism, sasl_plain_username, sasl_plain_password,
-			sasl_external_cert, sasl_external_key
+			sasl_external_cert, sasl_external_key, enabled
 		FROM Network
 		WHERE user = ?`,
@@ -329,5 +331,5 @@
 		err := rows.Scan(&net.ID, &name, &net.Addr, &net.Nick, &username, &realname,
 			&pass, &connectCommands, &saslMechanism, &saslPlainUsername, &saslPlainPassword,
-			&net.SASL.External.CertBlob, &net.SASL.External.PrivKeyBlob)
+			&net.SASL.External.CertBlob, &net.SASL.External.PrivKeyBlob, &net.Enabled)
 		if err != nil {
 			return nil, err
@@ -383,9 +385,9 @@
 			SET name = ?, addr = ?, nick = ?, username = ?, realname = ?, pass = ?, connect_commands = ?,
 				sasl_mechanism = ?, sasl_plain_username = ?, sasl_plain_password = ?,
-				sasl_external_cert = ?, sasl_external_key = ?
+				sasl_external_cert = ?, sasl_external_key = ?, enabled = ?
 			WHERE id = ?`,
 			netName, network.Addr, network.Nick, netUsername, realname, pass, connectCommands,
 			saslMechanism, saslPlainUsername, saslPlainPassword,
-			network.SASL.External.CertBlob, network.SASL.External.PrivKeyBlob,
+			network.SASL.External.CertBlob, network.SASL.External.PrivKeyBlob, network.Enabled,
 			network.ID)
 	} else {
@@ -393,9 +395,9 @@
 		res, err = db.db.Exec(`INSERT INTO Network(user, name, addr, nick, username,
 				realname, pass, connect_commands, sasl_mechanism, sasl_plain_username,
-				sasl_plain_password, sasl_external_cert, sasl_external_key)
-			VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
+				sasl_plain_password, sasl_external_cert, sasl_external_key, enabled)
+			VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
 			userID, netName, network.Addr, network.Nick, netUsername, realname, pass, connectCommands,
 			saslMechanism, saslPlainUsername, saslPlainPassword, network.SASL.External.CertBlob,
-			network.SASL.External.PrivKeyBlob)
+			network.SASL.External.PrivKeyBlob, network.Enabled)
 		if err != nil {
 			return err
Index: /trunk/doc/soju.1.scd
===================================================================
--- /trunk/doc/soju.1.scd	(revision 541)
+++ /trunk/doc/soju.1.scd	(revision 542)
@@ -159,4 +159,8 @@
 		is used.
 
+	*-enabled* true|false
+		Enable or disable the network. If the network is disabled, the bouncer
+		won't connect to it. By default, the network is enabled.
+
 	*-connect-command* <command>
 		Send the specified command as a raw IRC message right after connecting
Index: /trunk/downstream.go
===================================================================
--- /trunk/downstream.go	(revision 541)
+++ /trunk/downstream.go	(revision 542)
@@ -1002,6 +1002,7 @@
 		var err error
 		network, err = dc.user.createNetwork(&Network{
-			Addr: dc.networkName,
-			Nick: nick,
+			Addr:    dc.networkName,
+			Nick:    nick,
+			Enabled: true,
 		})
 		if err != nil {
@@ -2175,4 +2176,5 @@
 				Realname: realname,
 				Pass:     pass,
+				Enabled:  true,
 			}
 			network, err := dc.user.createNetwork(record)
Index: /trunk/service.go
===================================================================
--- /trunk/service.go	(revision 541)
+++ /trunk/service.go	(revision 542)
@@ -19,4 +19,5 @@
 	"math/big"
 	"sort"
+	"strconv"
 	"strings"
 	"time"
@@ -150,5 +151,5 @@
 			children: serviceCommandSet{
 				"create": {
-					usage:  "-addr <addr> [-name name] [-username username] [-pass pass] [-realname realname] [-nick nick] [-connect-command command]...",
+					usage:  "-addr <addr> [-name name] [-username username] [-pass pass] [-realname realname] [-nick nick] [-enabled enabled] [-connect-command command]...",
 					desc:   "add a new network",
 					handle: handleServiceNetworkCreate,
@@ -159,5 +160,5 @@
 				},
 				"update": {
-					usage:  "<name> [-addr addr] [-name name] [-username username] [-pass pass] [-realname realname] [-nick nick] [-connect-command command]...",
+					usage:  "<name> [-addr addr] [-name name] [-username username] [-pass pass] [-realname realname] [-nick nick] [-enabled enabled] [-connect-command command]...",
 					desc:   "update a network",
 					handle: handleServiceNetworkUpdate,
@@ -318,7 +319,28 @@
 }
 
+type boolPtrFlag struct {
+	ptr **bool
+}
+
+func (f boolPtrFlag) String() string {
+	if f.ptr == nil || *f.ptr == nil {
+		return "<nil>"
+	}
+	return strconv.FormatBool(**f.ptr)
+}
+
+func (f boolPtrFlag) Set(s string) error {
+	v, err := strconv.ParseBool(s)
+	if err != nil {
+		return err
+	}
+	*f.ptr = &v
+	return nil
+}
+
 type networkFlagSet struct {
 	*flag.FlagSet
 	Addr, Name, Nick, Username, Pass, Realname *string
+	Enabled                                    *bool
 	ConnectCommands                            []string
 }
@@ -332,4 +354,5 @@
 	fs.Var(stringPtrFlag{&fs.Pass}, "pass", "")
 	fs.Var(stringPtrFlag{&fs.Realname}, "realname", "")
+	fs.Var(boolPtrFlag{&fs.Enabled}, "enabled", "")
 	fs.Var((*stringSliceFlag)(&fs.ConnectCommands), "connect-command", "")
 	return fs
@@ -362,4 +385,7 @@
 	if fs.Realname != nil {
 		network.Realname = *fs.Realname
+	}
+	if fs.Enabled != nil {
+		network.Enabled = *fs.Enabled
 	}
 	if fs.ConnectCommands != nil {
@@ -389,6 +415,7 @@
 
 	record := &Network{
-		Addr: *fs.Addr,
-		Nick: dc.nick,
+		Addr:    *fs.Addr,
+		Nick:    dc.nick,
+		Enabled: true,
 	}
 	if err := fs.update(record); err != nil {
@@ -416,4 +443,6 @@
 			}
 			details = fmt.Sprintf("%v channels", uc.channels.Len())
+		} else if !net.Enabled {
+			statuses = append(statuses, "disabled")
 		} else {
 			statuses = append(statuses, "disconnected")
Index: /trunk/user.go
===================================================================
--- /trunk/user.go	(revision 541)
+++ /trunk/user.go	(revision 542)
@@ -173,4 +173,8 @@
 
 func (net *network) run() {
+	if !net.Enabled {
+		return
+	}
+
 	var lastTry time.Time
 	for {
