| 1 |
//go:build notmuch |
| 2 |
// +build notmuch |
| 3 |
|
| 4 |
package notmuch |
| 5 |
|
| 6 |
/* |
| 7 |
#cgo LDFLAGS: -lnotmuch |
| 8 |
|
| 9 |
#include <notmuch.h> |
| 10 |
|
| 11 |
*/ |
| 12 |
import "C" |
| 13 |
|
| 14 |
type Properties struct { |
| 15 |
key *C.char |
| 16 |
value *C.char |
| 17 |
properties *C.notmuch_message_properties_t |
| 18 |
} |
| 19 |
|
| 20 |
// Next advances the Properties iterator to the next property. Next returns false if |
| 21 |
// no more properties are available |
| 22 |
func (p *Properties) Next() bool { |
| 23 |
if C.notmuch_message_properties_valid(p.properties) == 0 { |
| 24 |
return false |
| 25 |
} |
| 26 |
p.key = C.notmuch_message_properties_key(p.properties) |
| 27 |
p.value = C.notmuch_message_properties_value(p.properties) |
| 28 |
C.notmuch_message_properties_move_to_next(p.properties) |
| 29 |
return true |
| 30 |
} |
| 31 |
|
| 32 |
// Returns the key of the current iterator location |
| 33 |
func (p *Properties) Key() string { |
| 34 |
return C.GoString(p.key) |
| 35 |
} |
| 36 |
|
| 37 |
func (p *Properties) Value() string { |
| 38 |
return C.GoString(p.value) |
| 39 |
} |