Commits

Anonymous committed ae09b8b

migrate to goconfig pkg

Comments (0)

Files changed (1)

cmds/notmuch-addrlookup.go

 
 // 3rd-party imports
 import "notmuch"
-import "github.com/jteeuwen/go-pkg-ini/ini"
+//import "github.com/jteeuwen/go-pkg-ini/ini"
+import "github.com/kless/goconfig/config"
 
 type mail_addr_freq struct {
 	addr  string
 }
 
 func new_address_matcher() *address_matcher {
-	var cfg *ini.Config
+	var cfg *config.Config
 	var err os.Error
 
 	// honor NOTMUCH_CONFIG
 		home = os.Getenv("HOME")
 	}
 
-	if cfg,err = ini.Load(path.Join(home, ".notmuch-config")); err != nil {
+	if cfg,err = config.ReadDefault(path.Join(home, ".notmuch-config")); err != nil {
 		log.Exitf("error loading config file:",err)
 	}
 
-	db_path := cfg.S("database", "path", "")
-	primary_email := cfg.S("user", "primary_email", "")
-	addrbook_tag := cfg.S("user", "addrbook_tag", "addressbook")
+	db_path,_ := cfg.String("database", "path")
+	primary_email,_ := cfg.String("user", "primary_email")
+	addrbook_tag,err := cfg.String("user", "addrbook_tag")
+	if err != nil {
+		addrbook_tag = "addressbook"
+	}
 
 	self := &address_matcher{db:nil, 
 	                         user_db_path:db_path,