Exemplo n.º 1
0
func WaitResp(cmd *imap.Command, err error) error {
	if err == nil {
		for cmd.InProgress() {
			cmd.Client().Recv(-1)
			for _, rsp := range cmd.Data {
				log.Println(cmd.Name(true), " Response:", rsp.String())
			}
			cmd.Data = nil
		}
	}
	return err
}
Exemplo n.º 2
0
func ReportOK(cmd *imap.Command, err error) *imap.Command {
	var rsp *imap.Response
	if cmd == nil {
		fmt.Printf("--- ??? ---\n%v\n\n", err)
		panic(err)
	} else if err == nil {
		rsp, err = cmd.Result(imap.OK)
	}
	if err != nil {
		fmt.Printf("--- %s ---\n%v\n\n", cmd.Name(true), err)
		panic(err)
	}
	c := cmd.Client()
	fmt.Printf("--- %s ---\n"+
		"%d command response(s), %d unilateral response(s)\n"+
		"%s %s\n\n",
		cmd.Name(true), len(cmd.Data), len(c.Data), rsp.Status, rsp.Info)
	c.Data = nil
	return cmd
}