本文整理汇总了Golang中github.com/jordwest/imap-server/mailstore.Message.Header方法的典型用法代码示例。如果您正苦于以下问题:Golang Message.Header方法的具体用法?Golang Message.Header怎么用?Golang Message.Header使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jordwest/imap-server/mailstore.Message
的用法示例。
在下文中一共展示了Message.Header方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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)
}
示例2: 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)
}
示例3: 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)
}