Exemplo n.º 1
0
func main() {
	config.Init()
	flag.Parse()

	SetupStores()

	msgChan := make(chan *mail.Message)
	if config.UseIMAP {
		if err := SetupIMAP(msgChan); err != nil {
			log.Fatal(err)
		}
	} else {
		if err := SetupMbox(msgChan); err != nil {
			log.Fatal(err)
		}
	}

	for msg := range msgChan {
		if !msg.FromNiantic() {
			continue
		}
		log.Printf("Parsing message: %s From %s", msg.Id, msg.From)
		actions, err := action.FromMessage(msg)
		if err != nil {
			log.Print(err)
			continue
		}
		for i, a := range actions {
			a.Id.MessageId = msg.Id
			a.Id.ActionId = i
			Store(a)
		}
	}
	CloseStores()
	wg.Wait()
}
Exemplo n.º 2
0
func init() {
	config.Init()
}