當前位置: 首頁>>代碼示例>>Golang>>正文


Golang mailstore.Message類代碼示例

本文整理匯總了Golang中github.com/jordwest/imap-server/mailstore.Message的典型用法代碼示例。如果您正苦於以下問題:Golang Message類的具體用法?Golang Message怎麽用?Golang Message使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Message類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: fetchFullText

func fetchFullText(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
	mail := fmt.Sprintf("%s\r\n%s\r\n", util.MIMEHeaderToString(m.Header()), m.Body())
	mailLen := len(mail)

	return fmt.Sprintf("BODY[] {%d}\r\n%s",
		mailLen, mail)
}
開發者ID:ivucica,項目名稱:imap-server,代碼行數:7,代碼來源:command_fetch.go

示例2: fetchHeaderSpecificFields

func fetchHeaderSpecificFields(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
	if !peekOnly {
		fmt.Printf("TODO: Peek not requested, mark all as non-recent\n")
	}
	fields := strings.Split(args[1], " ")
	hdrs := m.Header()
	requestedHeaders := make(textproto.MIMEHeader)
	replyFieldList := make([]string, len(fields))
	for i, key := range fields {
		replyFieldList[i] = "\"" + key + "\""
		// If the key exists in the headers, copy it over
		v := hdrs.Get(key)
		if v != "" {
			requestedHeaders.Add(key, v)
		}
	}
	hdr := util.MIMEHeaderToString(requestedHeaders)
	hdrLen := len(hdr)

	return fmt.Sprintf("BODY[HEADER.FIELDS (%s)] {%d}\r\n%s",
		strings.Join(replyFieldList, " "),
		hdrLen,
		hdr)

}
開發者ID:ivucica,項目名稱:imap-server,代碼行數:25,代碼來源:command_fetch.go

示例3: fetchBody

func fetchBody(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
	body := fmt.Sprintf("%s\r\n", m.Body())
	bodyLen := len(body)

	return fmt.Sprintf("BODY[TEXT] {%d}\r\n%s",
		bodyLen, body)
}
開發者ID:ivucica,項目名稱:imap-server,代碼行數:7,代碼來源:command_fetch.go

示例4: fetchHeaders

func fetchHeaders(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
	hdr := fmt.Sprintf("%s\r\n", util.MIMEHeaderToString(m.Header()))
	hdrLen := len(hdr)

	peekStr := ""
	if peekOnly {
		peekStr = ".PEEK"
	}

	return fmt.Sprintf("BODY%s[HEADER] {%d}\r\n%s", peekStr, hdrLen, hdr)
}
開發者ID:ivucica,項目名稱:imap-server,代碼行數:11,代碼來源:command_fetch.go

示例5: fetchInternalDate

func fetchInternalDate(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
	dateStr := m.InternalDate().Format(util.InternalDate)
	return fmt.Sprintf("INTERNALDATE \"%s\"", dateStr)
}
開發者ID:ivucica,項目名稱:imap-server,代碼行數:4,代碼來源:command_fetch.go

示例6: fetchRfcSize

func fetchRfcSize(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
	return fmt.Sprintf("RFC822.SIZE %d", m.Size())
}
開發者ID:ivucica,項目名稱:imap-server,代碼行數:3,代碼來源:command_fetch.go

示例7: fetchFlags

func fetchFlags(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
	flags := append(m.Flags().Strings(), m.Keywords()...)
	flagList := strings.Join(flags, " ")
	return fmt.Sprintf("FLAGS (%s)", flagList)
}
開發者ID:ivucica,項目名稱:imap-server,代碼行數:5,代碼來源:command_fetch.go

示例8: fetchUID

// Fetch the UID of the mail message
func fetchUID(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
	return fmt.Sprintf("UID %d", m.UID())
}
開發者ID:ivucica,項目名稱:imap-server,代碼行數:4,代碼來源:command_fetch.go


注:本文中的github.com/jordwest/imap-server/mailstore.Message類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。