/* Get the value of the specified header from 'message'. * * The value will be read from the actual message file, not from the * notmuch database. The header name is case insensitive. * * The returned string belongs to the message so should not be * modified or freed by the caller (nor should it be referenced after * the message is destroyed). * * Returns an empty string ("") if the message does not contain a * header line matching 'header'. Returns NULL if any error occurs. */ func (self *Message) GetHeader(header string) string { if self.message == nil { return "" } var c_header *C.char = C.CString(header) defer C.free(unsafe.Pointer(c_header)) /* we dont own value */ value := C.notmuch_message_get_header(self.message, c_header) if value == nil { return "" } return C.GoString(value) }
// Header returns the value of the header. func (m *Message) Header(name string) string { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) return C.GoString(C.notmuch_message_get_header(m.toC(), cname)) }