File: properties.go

package info (click to toggle)
aerc 0.21.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,900 kB
  • sloc: ansic: 1,181; python: 1,000; sh: 553; awk: 360; makefile: 23
file content (39 lines) | stat: -rw-r--r-- 840 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//go:build notmuch
// +build notmuch

package notmuch

/*
#cgo LDFLAGS: -lnotmuch

#include <notmuch.h>

*/
import "C"

type Properties struct {
	key        *C.char
	value      *C.char
	properties *C.notmuch_message_properties_t
}

// Next advances the Properties iterator to the next property. Next returns false if
// no more properties are available
func (p *Properties) Next() bool {
	if C.notmuch_message_properties_valid(p.properties) == 0 {
		return false
	}
	p.key = C.notmuch_message_properties_key(p.properties)
	p.value = C.notmuch_message_properties_value(p.properties)
	C.notmuch_message_properties_move_to_next(p.properties)
	return true
}

// Returns the key of the current iterator location
func (p *Properties) Key() string {
	return C.GoString(p.key)
}

func (p *Properties) Value() string {
	return C.GoString(p.value)
}