X-Git-Url: https://rtime.felk.cvut.cz/gitweb/notmuch.git/blobdiff_plain/c39fd2a479cf28978236de0e9fc0304a8eda4e6e..5ddaf59915b477d9eccfafaf7e5ac8094ea8f6ca:/contrib/notmuch-deliver/src/main.c diff --git a/contrib/notmuch-deliver/src/main.c b/contrib/notmuch-deliver/src/main.c index f7a4eaa6..032b9d62 100644 --- a/contrib/notmuch-deliver/src/main.c +++ b/contrib/notmuch-deliver/src/main.c @@ -1,22 +1,23 @@ -/* vim: set cino= fo=croql sw=8 ts=8 sts=0 noet cin fdm=syntax : */ - -/* - * Copyright (c) 2010 Ali Polatel +/* notmuch-deliver - If you make the user a promise... make sure you deliver it! + * + * Copyright © 2010 Ali Polatel * Based in part upon deliverquota of maildrop which is: * Copyright 1998 - 2009 Double Precision, Inc. * - * This file is part of the notmuch-deliver. notmuch-deliver is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * notmuch-deliver is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ . + * + * Author: Ali Polatel */ #ifdef HAVE_CONFIG_H @@ -358,6 +359,7 @@ main(int argc, char **argv) GOptionContext *ctx; GError *error = NULL; notmuch_database_t *db; + notmuch_status_t status; ctx = g_option_context_new("[FOLDER]"); g_option_context_add_main_entries(ctx, options, PACKAGE); @@ -428,7 +430,14 @@ main(int argc, char **argv) maildir = g_strdup(db_path); g_debug("Opening notmuch database `%s'", db_path); - db = notmuch_database_open(db_path, NOTMUCH_DATABASE_MODE_READ_WRITE); + status = notmuch_database_open(db_path, NOTMUCH_DATABASE_MODE_READ_WRITE, + &db); + if (status) { + g_critical("Failed to open database `%s': %s", + db_path, notmuch_status_to_string(status)); + g_free(maildir); + return EX_SOFTWARE; + } g_free(db_path); if (db == NULL) return EX_SOFTWARE; @@ -454,7 +463,7 @@ main(int argc, char **argv) g_strfreev(opt_rtags); g_free(mail); - notmuch_database_close(db); + notmuch_database_destroy(db); return 0; }