mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
lib: replace deprecated n_q_search_messages with status returning version
This function was deprecated in notmuch 0.21. We re-use the name for a status returning version, and deprecate the _st name.
This commit is contained in:
parent
1e982de508
commit
86cbd215eb
14 changed files with 38 additions and 42 deletions
|
@ -164,9 +164,9 @@ class Query(object):
|
||||||
return Threads(threads_p, self)
|
return Threads(threads_p, self)
|
||||||
|
|
||||||
"""notmuch_query_search_messages_st"""
|
"""notmuch_query_search_messages_st"""
|
||||||
_search_messages_st = nmlib.notmuch_query_search_messages_st
|
_search_messages = nmlib.notmuch_query_search_messages
|
||||||
_search_messages_st.argtypes = [NotmuchQueryP, POINTER(NotmuchMessagesP)]
|
_search_messages.argtypes = [NotmuchQueryP, POINTER(NotmuchMessagesP)]
|
||||||
_search_messages_st.restype = c_uint
|
_search_messages.restype = c_uint
|
||||||
|
|
||||||
def search_messages(self):
|
def search_messages(self):
|
||||||
"""Filter messages according to the query and return
|
"""Filter messages according to the query and return
|
||||||
|
@ -177,7 +177,7 @@ class Query(object):
|
||||||
"""
|
"""
|
||||||
self._assert_query_is_initialized()
|
self._assert_query_is_initialized()
|
||||||
msgs_p = NotmuchMessagesP() # == NULL
|
msgs_p = NotmuchMessagesP() # == NULL
|
||||||
status = Query._search_messages_st(self._query, byref(msgs_p))
|
status = Query._search_messages(self._query, byref(msgs_p))
|
||||||
if status != 0:
|
if status != 0:
|
||||||
raise NotmuchError(status)
|
raise NotmuchError(status)
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ notmuch_rb_query_search_messages (VALUE self)
|
||||||
|
|
||||||
Data_Get_Notmuch_Query (self, query);
|
Data_Get_Notmuch_Query (self, query);
|
||||||
|
|
||||||
status = notmuch_query_search_messages_st (query, &messages);
|
status = notmuch_query_search_messages (query, &messages);
|
||||||
if (status)
|
if (status)
|
||||||
notmuch_rb_status_raise (status);
|
notmuch_rb_status_raise (status);
|
||||||
|
|
||||||
|
|
|
@ -1531,7 +1531,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
|
||||||
|
|
||||||
query = notmuch_query_create (notmuch, "");
|
query = notmuch_query_create (notmuch, "");
|
||||||
|
|
||||||
status = notmuch_query_search_messages_st (query, &messages);
|
status = notmuch_query_search_messages (query, &messages);
|
||||||
if (status)
|
if (status)
|
||||||
goto DONE;
|
goto DONE;
|
||||||
for (;
|
for (;
|
||||||
|
|
|
@ -911,23 +911,23 @@ notmuch_query_search_threads_st (notmuch_query_t *query, notmuch_threads_t **out
|
||||||
*
|
*
|
||||||
* If a Xapian exception occurs this function will return NULL.
|
* If a Xapian exception occurs this function will return NULL.
|
||||||
*
|
*
|
||||||
* @since libnotmuch 4.2 (notmuch 0.20)
|
* @since libnotmuch 5 (notmuch 0.25)
|
||||||
*/
|
*/
|
||||||
notmuch_status_t
|
notmuch_status_t
|
||||||
|
notmuch_query_search_messages (notmuch_query_t *query,
|
||||||
|
notmuch_messages_t **out);
|
||||||
|
/**
|
||||||
|
* Deprecated alias for notmuch_query_search_messages
|
||||||
|
*
|
||||||
|
* @deprecated Deprecated as of libnotmuch 5 (notmuch 0.25). Please use
|
||||||
|
* notmuch_query_search_messages instead.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
NOTMUCH_DEPRECATED(5,0)
|
||||||
|
notmuch_status_t
|
||||||
notmuch_query_search_messages_st (notmuch_query_t *query,
|
notmuch_query_search_messages_st (notmuch_query_t *query,
|
||||||
notmuch_messages_t **out);
|
notmuch_messages_t **out);
|
||||||
/**
|
|
||||||
* Like notmuch_query_search_messages, but without a status return.
|
|
||||||
*
|
|
||||||
* If a Xapian exception occurs this function will return NULL.
|
|
||||||
*
|
|
||||||
* @deprecated Deprecated as of libnotmuch 4.3 (notmuch 0.21). Please use
|
|
||||||
* notmuch_query_search_messages_st instead.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
NOTMUCH_DEPRECATED(4,3)
|
|
||||||
notmuch_messages_t *
|
|
||||||
notmuch_query_search_messages (notmuch_query_t *query);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy a notmuch_query_t along with any associated resources.
|
* Destroy a notmuch_query_t along with any associated resources.
|
||||||
|
|
22
lib/query.cc
22
lib/query.cc
|
@ -233,21 +233,17 @@ _notmuch_exclude_tags (notmuch_query_t *query)
|
||||||
return exclude_query;
|
return exclude_query;
|
||||||
}
|
}
|
||||||
|
|
||||||
notmuch_messages_t *
|
|
||||||
notmuch_query_search_messages (notmuch_query_t *query)
|
|
||||||
{
|
|
||||||
notmuch_status_t status;
|
|
||||||
notmuch_messages_t *messages;
|
|
||||||
status = notmuch_query_search_messages_st (query, &messages);
|
|
||||||
if (status)
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
return messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
notmuch_status_t
|
notmuch_status_t
|
||||||
notmuch_query_search_messages_st (notmuch_query_t *query,
|
notmuch_query_search_messages_st (notmuch_query_t *query,
|
||||||
notmuch_messages_t **out)
|
notmuch_messages_t **out)
|
||||||
|
{
|
||||||
|
return notmuch_query_search_messages (query, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
notmuch_status_t
|
||||||
|
notmuch_query_search_messages (notmuch_query_t *query,
|
||||||
|
notmuch_messages_t **out)
|
||||||
{
|
{
|
||||||
return _notmuch_query_search_documents (query, "mail", out);
|
return _notmuch_query_search_documents (query, "mail", out);
|
||||||
}
|
}
|
||||||
|
@ -519,7 +515,7 @@ notmuch_query_search_threads (notmuch_query_t *query,
|
||||||
|
|
||||||
threads->query = query;
|
threads->query = query;
|
||||||
|
|
||||||
status = notmuch_query_search_messages_st (query, &messages);
|
status = notmuch_query_search_messages (query, &messages);
|
||||||
if (status) {
|
if (status) {
|
||||||
talloc_free (threads);
|
talloc_free (threads);
|
||||||
return status;
|
return status;
|
||||||
|
@ -708,7 +704,7 @@ notmuch_query_count_threads_st (notmuch_query_t *query, unsigned *count)
|
||||||
|
|
||||||
sort = query->sort;
|
sort = query->sort;
|
||||||
query->sort = NOTMUCH_SORT_UNSORTED;
|
query->sort = NOTMUCH_SORT_UNSORTED;
|
||||||
ret = notmuch_query_search_messages_st (query, &messages);
|
ret = notmuch_query_search_messages (query, &messages);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
query->sort = sort;
|
query->sort = sort;
|
||||||
|
|
|
@ -505,7 +505,7 @@ _notmuch_thread_create (void *ctx,
|
||||||
* oldest or newest subject is desired. */
|
* oldest or newest subject is desired. */
|
||||||
notmuch_query_set_sort (thread_id_query, NOTMUCH_SORT_OLDEST_FIRST);
|
notmuch_query_set_sort (thread_id_query, NOTMUCH_SORT_OLDEST_FIRST);
|
||||||
|
|
||||||
status = notmuch_query_search_messages_st (thread_id_query, &messages);
|
status = notmuch_query_search_messages (thread_id_query, &messages);
|
||||||
if (status)
|
if (status)
|
||||||
goto DONE;
|
goto DONE;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ count_files (notmuch_query_t *query)
|
||||||
notmuch_status_t status;
|
notmuch_status_t status;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
status = notmuch_query_search_messages_st (query, &messages);
|
status = notmuch_query_search_messages (query, &messages);
|
||||||
if (print_status_query ("notmuch count", query, status))
|
if (print_status_query ("notmuch count", query, status))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
@ -240,7 +240,7 @@ database_dump_file (notmuch_database_t *notmuch, gzFile output,
|
||||||
*/
|
*/
|
||||||
notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED);
|
notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED);
|
||||||
|
|
||||||
status = notmuch_query_search_messages_st (query, &messages);
|
status = notmuch_query_search_messages (query, &messages);
|
||||||
if (print_status_query ("notmuch dump", query, status))
|
if (print_status_query ("notmuch dump", query, status))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
|
|
|
@ -645,7 +645,7 @@ static int do_reply(notmuch_config_t *config,
|
||||||
sp = sprinter_sexp_create (config, stdout);
|
sp = sprinter_sexp_create (config, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = notmuch_query_search_messages_st (query, &messages);
|
status = notmuch_query_search_messages (query, &messages);
|
||||||
if (print_status_query ("notmuch reply", query, status))
|
if (print_status_query ("notmuch reply", query, status))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
@ -538,7 +538,7 @@ do_search_messages (search_context_t *ctx)
|
||||||
ctx->offset = 0;
|
ctx->offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = notmuch_query_search_messages_st (ctx->query, &messages);
|
status = notmuch_query_search_messages (ctx->query, &messages);
|
||||||
if (print_status_query ("notmuch search", ctx->query, status))
|
if (print_status_query ("notmuch search", ctx->query, status))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -629,7 +629,7 @@ do_search_tags (const search_context_t *ctx)
|
||||||
tags = notmuch_database_get_all_tags (notmuch);
|
tags = notmuch_database_get_all_tags (notmuch);
|
||||||
} else {
|
} else {
|
||||||
notmuch_status_t status;
|
notmuch_status_t status;
|
||||||
status = notmuch_query_search_messages_st (query, &messages);
|
status = notmuch_query_search_messages (query, &messages);
|
||||||
if (print_status_query ("notmuch search", query, status))
|
if (print_status_query ("notmuch search", query, status))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
@ -917,7 +917,7 @@ do_show_single (void *ctx,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = notmuch_query_search_messages_st (query, &messages);
|
status = notmuch_query_search_messages (query, &messages);
|
||||||
if (print_status_query ("notmuch show", query, status))
|
if (print_status_query ("notmuch show", query, status))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string,
|
||||||
/* tagging is not interested in any special sort order */
|
/* tagging is not interested in any special sort order */
|
||||||
notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED);
|
notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED);
|
||||||
|
|
||||||
status = notmuch_query_search_messages_st (query, &messages);
|
status = notmuch_query_search_messages (query, &messages);
|
||||||
if (print_status_query ("notmuch tag", query, status))
|
if (print_status_query ("notmuch tag", query, status))
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@ cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
|
||||||
{
|
{
|
||||||
notmuch_messages_t *messages = NULL;
|
notmuch_messages_t *messages = NULL;
|
||||||
notmuch_query_t *query=notmuch_query_create (db, "*");
|
notmuch_query_t *query=notmuch_query_create (db, "*");
|
||||||
stat = notmuch_query_search_messages_st (query, &messages);
|
stat = notmuch_query_search_messages (query, &messages);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' < OUTPUT > OUTPUT.clean
|
sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' < OUTPUT > OUTPUT.clean
|
||||||
|
|
|
@ -35,7 +35,7 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &rw_db));
|
EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &rw_db));
|
||||||
query = notmuch_query_create(rw_db, "");
|
query = notmuch_query_create(rw_db, "");
|
||||||
EXPECT0 (notmuch_query_search_messages_st (query, &messages));
|
EXPECT0 (notmuch_query_search_messages (query, &messages));
|
||||||
|
|
||||||
for (;
|
for (;
|
||||||
notmuch_messages_valid (messages);
|
notmuch_messages_valid (messages);
|
||||||
|
|
Loading…
Reference in a new issue