Skip to content

Commit 474507f

Browse files
authored
Merge pull request #16 from msp301/mp/update-deprecated-functions
Update to work with notmuch 0.26
2 parents c5bb32b + 6b5d5db commit 474507f

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

db.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func (db *DB) AddMessage(filename string) (*Message, error) {
149149
defer C.free(unsafe.Pointer(cfilename))
150150

151151
var cmsg *C.notmuch_message_t
152-
if err := statusErr(C.notmuch_database_add_message(db.toC(), cfilename, &cmsg)); err != nil {
152+
if err := statusErr(C.notmuch_database_index_file(db.toC(), cfilename, nil, &cmsg)); err != nil {
153153
return nil, err
154154
}
155155
msg := &Message{

db_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func TestNeedsUpgrade(t *testing.T) {
8888
}
8989
defer db.Close()
9090
if want, got := false, db.NeedsUpgrade(); want != got {
91-
t.Errorf("db.NeedsUpgrade(): want %b got %b", want, got)
91+
t.Errorf("db.NeedsUpgrade(): want %t got %t", want, got)
9292
}
9393
}
9494

query.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (q *Query) String() string {
3333
// Threads returns the threads matching the query.
3434
func (q *Query) Threads() (*Threads, error) {
3535
var cthreads *C.notmuch_threads_t
36-
err := statusErr(C.notmuch_query_search_threads_st(q.toC(), &cthreads))
36+
err := statusErr(C.notmuch_query_search_threads(q.toC(), &cthreads))
3737
if err != nil {
3838
return nil, err
3939
}
@@ -47,10 +47,14 @@ func (q *Query) Threads() (*Threads, error) {
4747

4848
// CountThreads returns the number of messages for the current query.
4949
func (q *Query) CountThreads() int {
50-
return int(C.notmuch_query_count_threads(q.toC()))
50+
var ccount C.uint
51+
C.notmuch_query_count_threads(q.toC(), &ccount)
52+
return int(ccount)
5153
}
5254

5355
// CountMessages returns the number of messages for the current query.
5456
func (q *Query) CountMessages() int {
55-
return int(C.notmuch_query_count_messages(q.toC()))
57+
var cCount C.uint
58+
C.notmuch_query_count_messages(q.toC(), &cCount)
59+
return int(cCount)
5660
}

0 commit comments

Comments
 (0)