Index: /trunk/downstream.go
===================================================================
--- /trunk/downstream.go	(revision 665)
+++ /trunk/downstream.go	(revision 666)
@@ -1296,5 +1296,5 @@
 				// Fast-forward history to last message
 				targetCM := net.casemap(target)
-				lastID, err := dc.user.msgStore.LastMsgID(net, targetCM, time.Now())
+				lastID, err := dc.user.msgStore.LastMsgID(&net.Network, targetCM, time.Now())
 				if err != nil {
 					dc.logger.Printf("failed to get last message ID: %v", err)
@@ -1331,5 +1331,5 @@
 	limit := 4000
 	targetCM := net.casemap(target)
-	history, err := dc.user.msgStore.LoadLatestID(net, targetCM, msgID, limit)
+	history, err := dc.user.msgStore.LoadLatestID(&net.Network, targetCM, msgID, limit)
 	if err != nil {
 		dc.logger.Printf("failed to send backlog for %q: %v", target, err)
@@ -2338,16 +2338,16 @@
 		switch subcommand {
 		case "BEFORE":
-			history, err = store.LoadBeforeTime(network, entity, bounds[0], time.Time{}, limit, eventPlayback)
+			history, err = store.LoadBeforeTime(&network.Network, entity, bounds[0], time.Time{}, limit, eventPlayback)
 		case "AFTER":
-			history, err = store.LoadAfterTime(network, entity, bounds[0], time.Now(), limit, eventPlayback)
+			history, err = store.LoadAfterTime(&network.Network, entity, bounds[0], time.Now(), limit, eventPlayback)
 		case "BETWEEN":
 			if bounds[0].Before(bounds[1]) {
-				history, err = store.LoadAfterTime(network, entity, bounds[0], bounds[1], limit, eventPlayback)
+				history, err = store.LoadAfterTime(&network.Network, entity, bounds[0], bounds[1], limit, eventPlayback)
 			} else {
-				history, err = store.LoadBeforeTime(network, entity, bounds[0], bounds[1], limit, eventPlayback)
+				history, err = store.LoadBeforeTime(&network.Network, entity, bounds[0], bounds[1], limit, eventPlayback)
 			}
 		case "TARGETS":
 			// TODO: support TARGETS in multi-upstream mode
-			targets, err := store.ListTargets(network, bounds[0], bounds[1], limit, eventPlayback)
+			targets, err := store.ListTargets(&network.Network, bounds[0], bounds[1], limit, eventPlayback)
 			if err != nil {
 				dc.logger.Printf("failed fetching targets for chathistory: %v", err)
Index: /trunk/msgstore.go
===================================================================
--- /trunk/msgstore.go	(revision 665)
+++ /trunk/msgstore.go	(revision 666)
@@ -17,9 +17,9 @@
 	// date. The message ID returned may not refer to a valid message, but can be
 	// used in history queries.
-	LastMsgID(network *network, entity string, t time.Time) (string, error)
+	LastMsgID(network *Network, entity string, t time.Time) (string, error)
 	// LoadLatestID queries the latest non-event messages for the given network,
 	// entity and date, up to a count of limit messages, sorted from oldest to newest.
-	LoadLatestID(network *network, entity, id string, limit int) ([]*irc.Message, error)
-	Append(network *network, entity string, msg *irc.Message) (id string, err error)
+	LoadLatestID(network *Network, entity, id string, limit int) ([]*irc.Message, error)
+	Append(network *Network, entity string, msg *irc.Message) (id string, err error)
 }
 
@@ -38,15 +38,15 @@
 	// both excluded. end may be before or after start.
 	// If events is false, only PRIVMSG/NOTICE messages are considered.
-	ListTargets(network *network, start, end time.Time, limit int, events bool) ([]chatHistoryTarget, error)
+	ListTargets(network *Network, start, end time.Time, limit int, events bool) ([]chatHistoryTarget, error)
 	// LoadBeforeTime loads up to limit messages before start down to end. The
 	// returned messages must be between and excluding the provided bounds.
 	// end is before start.
 	// If events is false, only PRIVMSG/NOTICE messages are considered.
-	LoadBeforeTime(network *network, entity string, start, end time.Time, limit int, events bool) ([]*irc.Message, error)
+	LoadBeforeTime(network *Network, entity string, start, end time.Time, limit int, events bool) ([]*irc.Message, error)
 	// LoadBeforeTime loads up to limit messages after start up to end. The
 	// returned messages must be between and excluding the provided bounds.
 	// end is after start.
 	// If events is false, only PRIVMSG/NOTICE messages are considered.
-	LoadAfterTime(network *network, entity string, start, end time.Time, limit int, events bool) ([]*irc.Message, error)
+	LoadAfterTime(network *Network, entity string, start, end time.Time, limit int, events bool) ([]*irc.Message, error)
 }
 
Index: /trunk/msgstore_fs.go
===================================================================
--- /trunk/msgstore_fs.go	(revision 665)
+++ /trunk/msgstore_fs.go	(revision 666)
@@ -95,5 +95,5 @@
 }
 
-func (ms *fsMessageStore) logPath(network *network, entity string, t time.Time) string {
+func (ms *fsMessageStore) logPath(network *Network, entity string, t time.Time) string {
 	year, month, day := t.Date()
 	filename := fmt.Sprintf("%04d-%02d-%02d.log", year, month, day)
@@ -102,5 +102,5 @@
 
 // nextMsgID queries the message ID for the next message to be written to f.
-func nextFSMsgID(network *network, entity string, t time.Time, f *os.File) (string, error) {
+func nextFSMsgID(network *Network, entity string, t time.Time, f *os.File) (string, error) {
 	offset, err := f.Seek(0, io.SeekEnd)
 	if err != nil {
@@ -110,5 +110,5 @@
 }
 
-func (ms *fsMessageStore) LastMsgID(network *network, entity string, t time.Time) (string, error) {
+func (ms *fsMessageStore) LastMsgID(network *Network, entity string, t time.Time) (string, error) {
 	p := ms.logPath(network, entity, t)
 	fi, err := os.Stat(p)
@@ -121,5 +121,5 @@
 }
 
-func (ms *fsMessageStore) Append(network *network, entity string, msg *irc.Message) (string, error) {
+func (ms *fsMessageStore) Append(network *Network, entity string, msg *irc.Message) (string, error) {
 	s := formatMessage(msg)
 	if s == "" {
@@ -389,5 +389,5 @@
 }
 
-func (ms *fsMessageStore) parseMessagesBefore(network *network, entity string, ref time.Time, end time.Time, events bool, limit int, afterOffset int64) ([]*irc.Message, error) {
+func (ms *fsMessageStore) parseMessagesBefore(network *Network, entity string, ref time.Time, end time.Time, events bool, limit int, afterOffset int64) ([]*irc.Message, error) {
 	path := ms.logPath(network, entity, ref)
 	f, err := os.Open(path)
@@ -445,5 +445,5 @@
 }
 
-func (ms *fsMessageStore) parseMessagesAfter(network *network, entity string, ref time.Time, end time.Time, events bool, limit int) ([]*irc.Message, error) {
+func (ms *fsMessageStore) parseMessagesAfter(network *Network, entity string, ref time.Time, end time.Time, events bool, limit int) ([]*irc.Message, error) {
 	path := ms.logPath(network, entity, ref)
 	f, err := os.Open(path)
@@ -477,5 +477,5 @@
 }
 
-func (ms *fsMessageStore) LoadBeforeTime(network *network, entity string, start time.Time, end time.Time, limit int, events bool) ([]*irc.Message, error) {
+func (ms *fsMessageStore) LoadBeforeTime(network *Network, entity string, start time.Time, end time.Time, limit int, events bool) ([]*irc.Message, error) {
 	start = start.In(time.Local)
 	end = end.In(time.Local)
@@ -502,5 +502,5 @@
 }
 
-func (ms *fsMessageStore) LoadAfterTime(network *network, entity string, start time.Time, end time.Time, limit int, events bool) ([]*irc.Message, error) {
+func (ms *fsMessageStore) LoadAfterTime(network *Network, entity string, start time.Time, end time.Time, limit int, events bool) ([]*irc.Message, error) {
 	start = start.In(time.Local)
 	end = end.In(time.Local)
@@ -526,5 +526,5 @@
 }
 
-func (ms *fsMessageStore) LoadLatestID(network *network, entity, id string, limit int) ([]*irc.Message, error) {
+func (ms *fsMessageStore) LoadLatestID(network *Network, entity, id string, limit int) ([]*irc.Message, error) {
 	var afterTime time.Time
 	var afterOffset int64
@@ -570,5 +570,5 @@
 }
 
-func (ms *fsMessageStore) ListTargets(network *network, start, end time.Time, limit int, events bool) ([]chatHistoryTarget, error) {
+func (ms *fsMessageStore) ListTargets(network *Network, start, end time.Time, limit int, events bool) ([]chatHistoryTarget, error) {
 	start = start.In(time.Local)
 	end = end.In(time.Local)
@@ -645,5 +645,5 @@
 }
 
-func (ms *fsMessageStore) RenameNetwork(oldNet, newNet *network) error {
+func (ms *fsMessageStore) RenameNetwork(oldNet, newNet *Network) error {
 	oldDir := filepath.Join(ms.root, escapeFilename(oldNet.GetName()))
 	newDir := filepath.Join(ms.root, escapeFilename(newNet.GetName()))
Index: /trunk/msgstore_memory.go
===================================================================
--- /trunk/msgstore_memory.go	(revision 665)
+++ /trunk/msgstore_memory.go	(revision 666)
@@ -55,5 +55,5 @@
 }
 
-func (ms *memoryMessageStore) get(network *network, entity string) *messageRingBuffer {
+func (ms *memoryMessageStore) get(network *Network, entity string) *messageRingBuffer {
 	k := ringBufferKey{networkID: network.ID, entity: entity}
 	if rb, ok := ms.buffers[k]; ok {
@@ -65,5 +65,5 @@
 }
 
-func (ms *memoryMessageStore) LastMsgID(network *network, entity string, t time.Time) (string, error) {
+func (ms *memoryMessageStore) LastMsgID(network *Network, entity string, t time.Time) (string, error) {
 	var seq uint64
 	k := ringBufferKey{networkID: network.ID, entity: entity}
@@ -74,5 +74,5 @@
 }
 
-func (ms *memoryMessageStore) Append(network *network, entity string, msg *irc.Message) (string, error) {
+func (ms *memoryMessageStore) Append(network *Network, entity string, msg *irc.Message) (string, error) {
 	switch msg.Command {
 	case "PRIVMSG", "NOTICE":
@@ -92,5 +92,5 @@
 }
 
-func (ms *memoryMessageStore) LoadLatestID(network *network, entity, id string, limit int) ([]*irc.Message, error) {
+func (ms *memoryMessageStore) LoadLatestID(network *Network, entity, id string, limit int) ([]*irc.Message, error) {
 	_, _, seq, err := parseMemoryMsgID(id)
 	if err != nil {
Index: /trunk/upstream.go
===================================================================
--- /trunk/upstream.go	(revision 665)
+++ /trunk/upstream.go	(revision 666)
@@ -1788,5 +1788,5 @@
 		// message ID in delivery receipts, so that we can send the new message
 		// in the backlog if an offline client reconnects.
-		lastID, err := uc.user.msgStore.LastMsgID(uc.network, entityCM, time.Now())
+		lastID, err := uc.user.msgStore.LastMsgID(&uc.network.Network, entityCM, time.Now())
 		if err != nil {
 			uc.logger.Printf("failed to log message: failed to get last message ID: %v", err)
@@ -1799,5 +1799,5 @@
 	}
 
-	msgID, err := uc.user.msgStore.Append(uc.network, entityCM, msg)
+	msgID, err := uc.user.msgStore.Append(&uc.network.Network, entityCM, msg)
 	if err != nil {
 		uc.logger.Printf("failed to log message: %v", err)
Index: /trunk/user.go
===================================================================
--- /trunk/user.go	(revision 665)
+++ /trunk/user.go	(revision 666)
@@ -262,5 +262,5 @@
 	if net.user.msgStore != nil {
 		nameCM := net.casemap(ch.Name)
-		lastID, err := net.user.msgStore.LastMsgID(net, nameCM, time.Now())
+		lastID, err := net.user.msgStore.LastMsgID(&net.Network, nameCM, time.Now())
 		if err != nil {
 			net.logger.Printf("failed to get last message ID for channel %q: %v", ch.Name, err)
@@ -860,5 +860,5 @@
 	fsMsgStore, isFS := u.msgStore.(*fsMessageStore)
 	if isFS && updatedNetwork.GetName() != network.GetName() {
-		if err := fsMsgStore.RenameNetwork(network, updatedNetwork); err != nil {
+		if err := fsMsgStore.RenameNetwork(&network.Network, &updatedNetwork.Network); err != nil {
 			network.logger.Printf("failed to update FS message store network name to %q: %v", updatedNetwork.GetName(), err)
 		}
