Start working on laying out the pretend-filesystem-tree into an N-ary tree courtesy of GLib
The basic idea is maintain a GHashTable of accounts->trees in imuse.c and allow for the getattr(2), read(2), open(2), readdir(2) calls to navigate the trees appropriately. Take the following crappy diagram: Accounts/ |--> (d) github.com |--> (f) NewEmail.template |--> (d) INBOX | |--> (d) INBOX.other |--> (d) Junk |--> (d) Sent |--> (f) Some_Email_Subject-(2009-01-16).email Look at muse_tree.c for more details on how I /think/ this should work Signed-off-by: R. Tyler Ballance <tyler@monkeypox.org>
This commit is contained in:
parent
653ab7c2f8
commit
81423d644f
4
Makefile
4
Makefile
|
@ -4,8 +4,8 @@ TAR ?= tar
|
|||
RM ?= -rm
|
||||
CFLAGS := -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=22 -ggdb `pkg-config --cflags glib-2.0`
|
||||
LDFLAGS := -lfuse `pkg-config --libs glib-2.0`
|
||||
SRCS := imuse.c imapper.c muse_send.c
|
||||
OBJS := imuse.o imapper.o muse_send.o
|
||||
SRCS := imuse.c imapper.c muse_send.c muse_tree.c
|
||||
OBJS := imuse.o imapper.o muse_send.o muse_tree.o
|
||||
OUT ?= imuse
|
||||
README := /dev/null
|
||||
|
||||
|
|
4
imuse.c
4
imuse.c
|
@ -19,6 +19,8 @@
|
|||
#include "imapper.h"
|
||||
|
||||
static GHashTable *__special_directories = NULL;
|
||||
static GHashTable *_accounts = NULL;
|
||||
|
||||
struct stat *default_stat_entry(struct stat *stat_defaults)
|
||||
{
|
||||
if (stat_defaults)
|
||||
|
@ -97,6 +99,8 @@ static struct fuse_operations imuse_operations = { .getattr = imuse_getattr, .re
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
__special_directories = g_hash_table_new(NULL, g_str_equal);
|
||||
_accounts = g_hash_table_new(NULL, g_str_equal);
|
||||
|
||||
/* Our keys will eventually turn into "special properties" about our make believe directories */
|
||||
g_hash_table_insert(__special_directories, "Accounts", g_hash_table_new(NULL, NULL));
|
||||
g_hash_table_insert(__special_directories, "Settings", g_hash_table_new(NULL, NULL));
|
||||
|
|
|
@ -7,6 +7,14 @@
|
|||
#ifndef __MUSE_SEND_H
|
||||
#define __MUSE_SEND_H
|
||||
|
||||
struct muse_send_config {
|
||||
char *hostname;
|
||||
char *sender_handle;
|
||||
char *sender_host;
|
||||
long options;
|
||||
};
|
||||
|
||||
extern struct muse_send_config *config_by_account;
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* imuse -- A FUSE filesystem for exposing IMAP accounts as a locally browsable filesystem, neat!
|
||||
*
|
||||
* (c) 2009 - R. Tyler Ballance <tyler@monkeypox.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* muse_tree:
|
||||
* Defines functions for dealing with IMAP's as a GNode-based tree
|
||||
*
|
||||
* Abstract:
|
||||
* The basic idea is to store some basic IMAP meta-data in memory as a large GNode N-ary tree:
|
||||
* Accounts/
|
||||
* |--> (d) github.com
|
||||
* |--> (f) NewEmail.template
|
||||
* |--> (d) INBOX
|
||||
* | |--> (d) INBOX.other
|
||||
* |--> (d) Junk
|
||||
* |--> (d) Sent
|
||||
* |--> (f) Some_Email_Subject-(2009-01-16).email
|
||||
*
|
||||
* The file "NewEmail.template" will represent a blank email and be a "special" file, whereas the
|
||||
* directories will be different typed nodes in the tree, files would be another node type.
|
||||
*
|
||||
* This way the FUSE integration will simply need to know how to navigate these trees and parse out
|
||||
* pathes in such a way that it can map back to a particular level in the tree. Operations like open(2)
|
||||
* or read(2) will need to pass through to their appropriate node-type handlers (email_open(), dir_open(),
|
||||
* and special_open())
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "muse_tree.h"
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* imuse -- A FUSE filesystem for exposing IMAP accounts as a locally browsable filesystem, neat!
|
||||
*
|
||||
* (c) 2009 - R. Tyler Ballance <tyler@monkeypox.org>
|
||||
*/
|
||||
|
||||
#ifndef __MUSE_TREE_H
|
||||
#define __MUSE_TREE_H
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue