1 /* The Ruby interface to the notmuch mail library
3 * Copyright © 2010 Ali Polatel
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see http://www.gnu.org/licenses/ .
18 * Author: Ali Polatel <alip@exherbo.org>
24 * call-seq: DIR.mtime => fixnum
26 * Returns the mtime of the directory or +0+ if no mtime has been previously
30 notmuch_rb_directory_get_mtime(VALUE self)
32 notmuch_rb_directory_t *dir;
34 Data_Get_Struct(self, notmuch_rb_directory_t, dir);
36 return UINT2NUM(notmuch_directory_get_mtime(dir->nm_dir));
40 * call-seq: DIR.mtime=(fixnum) => nil
42 * Store an mtime within the database for the directory object.
45 notmuch_rb_directory_set_mtime(VALUE self, VALUE mtimev)
48 notmuch_rb_directory_t *dir;
50 Data_Get_Struct(self, notmuch_rb_directory_t, dir);
52 if (!FIXNUM_P(mtimev))
53 rb_raise(rb_eTypeError, "First argument not a fixnum");
55 ret = notmuch_directory_set_mtime(dir->nm_dir, FIX2UINT(mtimev));
56 notmuch_rb_status_raise(ret);
61 * call-seq: DIR.child_files => FILENAMES
63 * Return a Notmuch::FileNames object, which is an +Enumerable+ listing all the
64 * filenames of messages in the database within the given directory.
67 notmuch_rb_directory_get_child_files(VALUE self)
69 notmuch_rb_directory_t *dir;
70 notmuch_rb_filenames_t *flist;
73 Data_Get_Struct(self, notmuch_rb_directory_t, dir);
75 flistv = Data_Make_Struct(notmuch_rb_cFileNames, notmuch_rb_filenames_t,
76 notmuch_rb_filenames_mark, notmuch_rb_filenames_free, flist);
78 flist->nm_flist = notmuch_directory_get_child_files(dir->nm_dir);
84 * call-seq: DIR.child_directories => FILENAMES
86 * Return a Notmuch::FileNames object, which is an +Enumerable+ listing all the
87 * directories in the database within the given directory.
90 notmuch_rb_directory_get_child_directories(VALUE self)
92 notmuch_rb_directory_t *dir;
93 notmuch_rb_filenames_t *flist;
96 Data_Get_Struct(self, notmuch_rb_directory_t, dir);
98 flistv = Data_Make_Struct(notmuch_rb_cFileNames, notmuch_rb_filenames_t,
99 notmuch_rb_filenames_mark, notmuch_rb_filenames_free, flist);
101 flist->nm_flist = notmuch_directory_get_child_directories(dir->nm_dir);