本文整理汇总了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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例6: fetchRfcSize
func fetchRfcSize(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
return fmt.Sprintf("RFC822.SIZE %d", m.Size())
}
示例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)
}
示例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())
}