unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 7dc55ad1cad0f98f11d0cb19a5643cf01c9dfa81 2081 bytes (raw)
name: lib/mailstore.c 	 # note: path name is non-authoritative(*)

 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
/* mailstore.c - Mailstore abstraction
 *
 * Copyright © 2010 Michal Sojka
 *
 * 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.
 *
 * 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, see http://www.gnu.org/licenses/ .
 *
 * Author: Michal Sojka <sojkam1@fel.cvut.cz>
 */

#include <notmuch.h>
#include "mailstore-private.h"

#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))

static notmuch_mailstore_t *available[] = {
    &mailstore_files,
    &mailstore_maildir,
};

notmuch_mailstore_t *
notmuch_mailstore_get_by_type (const char *type)
{
    unsigned i;

    if (type == NULL)
	return available[0];

    for (i = 0; i < ARRAY_SIZE(available); i++) {
	if (strcasecmp (type, available[i]->type) == 0)
	    return available[i];
    }
    return NULL;
}

const char *
notmuch_mailstore_get_type (notmuch_mailstore_t *mailstore)
{
    if (!mailstore)
	return NULL;

    return mailstore->type;
}

void
notmuch_mailstore_count_files (notmuch_mailstore_t *mailstore,
			      const char *path, int *count,
			      volatile sig_atomic_t *interrupted)
{
    mailstore->count_files (mailstore, path, count, interrupted);
}

notmuch_status_t
notmuch_mailstore_index_new (notmuch_mailstore_t *mailstore,
			    const char *path,
			    notmuch_indexing_context_t *ctx)
{
    notmuch_private_status_t status;
    status = mailstore->index_new (mailstore, path, ctx);
    return COERCE_STATUS (status, "Index new");
}

FILE *
notmuch_mailstore_open_file (notmuch_mailstore_t *mailstore,
			     const char *filename)
{
    return mailstore->open_file (mailstore, filename);
}

debug log:

solving 7dc55ad ...
found 7dc55ad in https://yhetil.org/notmuch/1268926780-20045-4-git-send-email-sojkam1@fel.cvut.cz/ ||
	https://yhetil.org/notmuch/1269639777-25765-3-git-send-email-sojkam1@fel.cvut.cz/ ||
	https://yhetil.org/notmuch/1269722661-6894-3-git-send-email-sojkam1@fel.cvut.cz/
found cdac9a6 in https://yhetil.org/notmuch/1269722661-6894-1-git-send-email-sojkam1@fel.cvut.cz/ ||
	https://yhetil.org/notmuch/1269639777-25765-1-git-send-email-sojkam1@fel.cvut.cz/ ||
	https://yhetil.org/notmuch/1268926780-20045-2-git-send-email-sojkam1@fel.cvut.cz/

applying [1/2] https://yhetil.org/notmuch/1269722661-6894-1-git-send-email-sojkam1@fel.cvut.cz/
diff --git a/lib/mailstore.c b/lib/mailstore.c
new file mode 100644
index 0000000..cdac9a6

Checking patch lib/mailstore.c...
Applied patch lib/mailstore.c cleanly.

skipping https://yhetil.org/notmuch/1269639777-25765-1-git-send-email-sojkam1@fel.cvut.cz/ for cdac9a6
skipping https://yhetil.org/notmuch/1268926780-20045-2-git-send-email-sojkam1@fel.cvut.cz/ for cdac9a6
index at:
100644 cdac9a6652970f9ca988fc8b4a99bc86d49474d9	lib/mailstore.c

applying [2/2] https://yhetil.org/notmuch/1268926780-20045-4-git-send-email-sojkam1@fel.cvut.cz/
diff --git a/lib/mailstore.c b/lib/mailstore.c
index cdac9a6..7dc55ad 100644

Checking patch lib/mailstore.c...
Applied patch lib/mailstore.c cleanly.

skipping https://yhetil.org/notmuch/1269639777-25765-3-git-send-email-sojkam1@fel.cvut.cz/ for 7dc55ad
skipping https://yhetil.org/notmuch/1269722661-6894-3-git-send-email-sojkam1@fel.cvut.cz/ for 7dc55ad
index at:
100644 7dc55ad1cad0f98f11d0cb19a5643cf01c9dfa81	lib/mailstore.c

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).