Unifying the plug-in API between projects

This commit is contained in:
Pierre Pronchery 2011-01-29 02:16:42 +00:00
parent c247ca4b42
commit f9971b4c33
16 changed files with 202 additions and 173 deletions

View File

@ -11,7 +11,7 @@ clean:
distclean: clean
install: all
install:
$(MKDIR) $(DESTDIR)$(PREFIX)/share/icons/hicolor/24x24/apps
$(INSTALL) -m 0644 -- mailer.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/24x24/apps/mailer.png
$(MKDIR) $(DESTDIR)$(PREFIX)/share/icons/hicolor/24x24/apps

View File

@ -11,7 +11,7 @@ clean:
distclean: clean
install: all
install:
$(MKDIR) $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps
$(INSTALL) -m 0644 -- mailer.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/mailer.png
$(MKDIR) $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps

View File

@ -17,7 +17,7 @@ clean:
distclean:
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) distclean) || exit; done
install: all
install:
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) install) || exit; done
$(MKDIR) $(DESTDIR)$(PREFIX)/share/applications
$(INSTALL) -m 0644 -- mailer.desktop $(DESTDIR)$(PREFIX)/share/applications/mailer.desktop

View File

@ -86,23 +86,27 @@ typedef struct _AccountPluginHelper
GtkIconTheme * theme;
GdkPixbuf * mail_read;
GdkPixbuf * mail_unread;
int (*error)(Mailer * mailer, char const * message, int ret);
} AccountPluginHelper;
typedef struct _AccountPlugin
typedef struct _AccountPlugin AccountPlugin;
struct _AccountPlugin
{
AccountPluginHelper * helper;
char const * type;
char const * name;
char const * icon;
AccountConfig * config;
int (*init)(GtkTreeStore * store, GtkTreeIter * parent,
GtkTextBuffer * buffer);
int (*quit)(void);
GtkTextBuffer * (*select)(AccountFolder * folder,
AccountMessage * message);
GtkTextBuffer * (*select_source)(AccountFolder * folder,
AccountMessage * message);
int (*init)(AccountPlugin * plugin, GtkTreeStore * store,
GtkTreeIter * parent, GtkTextBuffer * buffer);
int (*destroy)(AccountPlugin * plugin);
GtkTextBuffer * (*select)(AccountPlugin * plugin,
AccountFolder * folder, AccountMessage * message);
GtkTextBuffer * (*select_source)(AccountPlugin * plugin,
AccountFolder * folder, AccountMessage * message);
void * priv;
} AccountPlugin;
};
/* constants */

View File

@ -21,7 +21,7 @@ clean:
distclean: clean
$(RM) -- $(TARGETS)
install: all
install: $(TARGETS)
./gettext.sh -P "$(DESTDIR)$(PREFIX)" -i -- "fr.mo"
uninstall:

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Mailer 0.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-05 17:08+0100\n"
"POT-Creation-Date: 2011-01-29 03:13+0100\n"
"PO-Revision-Date: 2010-10-02 23:25+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: French\n"
@ -167,8 +167,8 @@ msgid ""
"Are you sure you want to close?"
msgstr ""
#: ../src/compose.c:453 ../src/compose.c:458 ../src/mailer.c:717
#: ../src/mailer.c:722
#: ../src/compose.c:453 ../src/compose.c:458 ../src/mailer.c:718
#: ../src/mailer.c:723
msgid "Error"
msgstr "Erreur"
@ -276,43 +276,43 @@ msgstr "Préférences"
msgid "Mailer"
msgstr "Mailer"
#: ../src/mailer.c:406
#: ../src/mailer.c:407
msgid "Folders"
msgstr "Dossiers"
#: ../src/mailer.c:474
#: ../src/mailer.c:475
msgid "Subject"
msgstr "Sujet"
#: ../src/mailer.c:476
#: ../src/mailer.c:477
msgid "From"
msgstr "De"
#: ../src/mailer.c:478
#: ../src/mailer.c:479
msgid "To"
msgstr "À"
#: ../src/mailer.c:480
#: ../src/mailer.c:481
msgid "Date"
msgstr "Date"
#: ../src/mailer.c:580
#: ../src/mailer.c:581
msgid " Subject: "
msgstr " Sujet: "
#: ../src/mailer.c:581
#: ../src/mailer.c:582
msgid " From: "
msgstr " De: "
#: ../src/mailer.c:582
#: ../src/mailer.c:583
msgid " To: "
msgstr " À: "
#: ../src/mailer.c:583
#: ../src/mailer.c:584
msgid " Date: "
msgstr " Date: "
#: ../src/mailer.c:821
#: ../src/mailer.c:822
msgid ""
"The messages selected will be deleted.\n"
"Continue?"
@ -320,112 +320,112 @@ msgstr ""
"Les messages sélectionnés vont être effacés.\n"
"Continuer?"
#: ../src/mailer.c:893
#: ../src/mailer.c:894
msgid "Mailer - View source"
msgstr "Mailer - Source"
#: ../src/mailer.c:939
#: ../src/mailer.c:940
msgid "Re: "
msgstr "Re: "
#: ../src/mailer.c:1090
#: ../src/mailer.c:1091
msgid "Mailer preferences"
msgstr "Préférences de Mailer"
#: ../src/mailer.c:1126
#: ../src/mailer.c:1127
msgid "Enabled"
msgstr "Actif"
#: ../src/mailer.c:1130
#: ../src/mailer.c:1131
msgid "Name"
msgstr "Nom"
#: ../src/mailer.c:1134
#: ../src/mailer.c:1135
msgid "Type"
msgstr "Type"
#: ../src/mailer.c:1158
#: ../src/mailer.c:1159
msgid "Accounts"
msgstr "Comptes"
#: ../src/mailer.c:1165
#: ../src/mailer.c:1166
msgid "Messages font:"
msgstr "Police des messages:"
#: ../src/mailer.c:1175
#: ../src/mailer.c:1176
msgid "Display"
msgstr "Affichage"
#: ../src/mailer.c:1257
#: ../src/mailer.c:1258
msgid "No account plug-in available"
msgstr "Aucun greffon de compte disponible"
#: ../src/mailer.c:1412 ../src/mailer.c:1693
#: ../src/mailer.c:1413 ../src/mailer.c:1694
msgid "Account name"
msgstr "Nom du compte"
#: ../src/mailer.c:1419
#: ../src/mailer.c:1420
msgid "Your name"
msgstr "Votre nom"
#: ../src/mailer.c:1426
#: ../src/mailer.c:1427
msgid "e-mail address"
msgstr "Adresse e-mail"
#: ../src/mailer.c:1433
#: ../src/mailer.c:1434
msgid "Type of account"
msgstr "Type de compte"
#: ../src/mailer.c:1582
#: ../src/mailer.c:1583
msgid "Choose file"
msgstr "Choisir un fichier"
#: ../src/mailer.c:1762
#: ../src/mailer.c:1763
msgid "hidden"
msgstr "masqué"
#: ../src/mailer.c:1796
#: ../src/mailer.c:1797
msgid "Yes"
msgstr "Oui"
#: ../src/mailer.c:1796
#: ../src/mailer.c:1797
msgid "No"
msgstr "Non"
#: ../src/mailer.c:1824
#: ../src/mailer.c:1825
msgid "Account type "
msgstr "Type de compte "
#: ../src/mailer.c:1825
#: ../src/mailer.c:1826
msgid " active\n"
msgstr " actif\n"
#: ../src/mailer.c:1869
#: ../src/mailer.c:1870
msgid "Edit account: "
msgstr "Modification du compte: "
#: ../src/mailer.c:1936
#: ../src/mailer.c:1937
msgid "An error occured while saving preferences"
msgstr "Une erreur est survenue pendant la sauvegarde des préférences"
#: ../src/mailer.c:2070 ../src/mailer.c:2075
#: ../src/mailer.c:2071 ../src/mailer.c:2076
msgid "Question"
msgstr "Question"
#: ../src/mailer.c:2144
#: ../src/mailer.c:2145
#, c-format
msgid "%s/%s: %d %s"
msgstr "%s/%s: %d %s"
#: ../src/mailer.c:2147
#: ../src/mailer.c:2148
msgid "messages"
msgstr "messages"
#: ../src/mailer.c:2147
#: ../src/mailer.c:2148
msgid "message"
msgstr "message"
#: ../src/mailer.c:2150
#: ../src/mailer.c:2151
msgid "Ready"
msgstr "Prêt"

View File

@ -52,7 +52,7 @@ distclean:
$(RM) -- $(mailer_OBJS)
$(RM) -- $(TARGETS)
install: all
install: $(TARGETS)
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) install) || exit; done
$(MKDIR) $(DESTDIR)$(BINDIR)
$(INSTALL) -m 0755 -- mailer $(DESTDIR)$(BINDIR)/mailer

View File

@ -108,8 +108,8 @@ void account_delete(Account * account)
if(account->plugin != NULL)
{
if(account->plugin->quit != NULL)
account->plugin->quit();
if(account->plugin->destroy != NULL)
account->plugin->destroy(account->plugin);
if(account->plugin->config != NULL)
for(p = account->plugin->config; p->name != NULL; p++)
switch(p->type)
@ -287,7 +287,8 @@ int account_init(Account * account, GtkTreeStore * store, GtkTreeIter * parent)
#endif
if(account->plugin->init == NULL)
return 0;
return account->plugin->init(store, parent, account->buffer);
return account->plugin->init(account->plugin, store, parent,
account->buffer);
}
@ -301,7 +302,7 @@ GtkTextBuffer * account_select(Account * account, AccountFolder * folder,
#endif
if(account->plugin->select == NULL)
return NULL;
return account->plugin->select(folder, message);
return account->plugin->select(account->plugin, folder, message);
}
@ -315,5 +316,5 @@ GtkTextBuffer * account_select_source(Account * account, AccountFolder * folder,
#endif
if(account->plugin->select_source == NULL)
return NULL;
return account->plugin->select_source(folder, message);
return account->plugin->select_source(account->plugin, folder, message);
}

View File

@ -74,7 +74,7 @@ clean:
distclean: clean
$(RM) -- $(TARGETS)
install: all
install: $(TARGETS)
$(MKDIR) $(DESTDIR)$(LIBDIR)/Mailer/account
$(INSTALL) -m 0644 -- mbox.so $(DESTDIR)$(LIBDIR)/Mailer/account/mbox.so

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Mailer */
/* 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
@ -44,6 +44,7 @@ AccountPlugin account_plugin =
NULL,
_imap4_type,
_imap4_name,
NULL,
_imap4_config,
NULL,
NULL,

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Mailer */
/* 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
@ -30,6 +30,9 @@
/* Mbox */
/* private */
#define _FOLDER_CNT 5
/* types */
typedef enum _ParserContext
{
@ -39,8 +42,12 @@ typedef enum _ParserContext
PC_GARBAGE /* inside crap */
} ParserContext;
typedef struct _Mbox Mbox;
typedef struct _MboxFolder
{
Mbox * mbox;
AccountFolder folder;
AccountConfig * config;
AccountMessage ** messages;
size_t messages_cnt;
@ -62,17 +69,17 @@ typedef struct _MboxFolder
char * pixbuf;
} MboxFolder;
struct _Mbox
{
AccountPlugin * plugin;
MboxFolder folders[_FOLDER_CNT];
};
/* constants */
#define _FOLDER_CNT 5
/* variables */
static char const _mbox_type[] = "MBOX";
static char const _mbox_name[] = "Local folders";
static char const * _error = NULL;
static AccountConfig _mbox_config[_FOLDER_CNT + 1] =
{
{ "mbox", "Inbox file", ACT_FILE, NULL },
@ -83,73 +90,69 @@ static AccountConfig _mbox_config[_FOLDER_CNT + 1] =
{ NULL, NULL, 0, NULL }
};
static MboxFolder _mbox_inbox =
static const MboxFolder _mbox_folder_defaults[_FOLDER_CNT] =
{
{
NULL,
{ AFT_INBOX, "Inbox", NULL, NULL },
&_mbox_config[0], NULL, 0, NULL,
0, NULL, -1,
0, PC_FROM, NULL, 0, NULL,
"mailer-inbox"
};
static MboxFolder _mbox_spool =
},
{
NULL,
{ AFT_INBOX, "Spool", NULL, NULL },
&_mbox_config[1], NULL, 0, NULL,
0, NULL, -1,
0, PC_FROM, NULL, 0, NULL,
"mailer-inbox"
};
static MboxFolder _mbox_drafts =
},
{
NULL,
{ AFT_DRAFTS, "Drafts", NULL, NULL },
&_mbox_config[2], NULL, 0, NULL,
0, NULL, -1,
0, PC_FROM, NULL, 0, NULL,
"stock_mail-handling"
};
static MboxFolder _mbox_sent =
},
{
NULL,
{ AFT_SENT, "Sent", NULL, NULL },
&_mbox_config[3], NULL, 0, NULL,
0, NULL, -1,
0, PC_FROM, NULL, 0, NULL,
"mailer-sent"
};
static MboxFolder _mbox_trash =
},
{
NULL,
{ AFT_TRASH, "Trash", NULL, NULL },
&_mbox_config[4], NULL, 0, NULL,
0, NULL, -1,
0, PC_FROM, NULL, 0, NULL,
"stock_trash_full"
};
static AccountFolder _config_folder[_FOLDER_CNT] =
{
{ AFT_INBOX, "Inbox", NULL, &_mbox_inbox },
{ AFT_INBOX, "Spool", NULL, &_mbox_spool },
{ AFT_DRAFTS, "Drafts", NULL, &_mbox_drafts },
{ AFT_SENT, "Sent", NULL, &_mbox_sent },
{ AFT_TRASH, "Trash", NULL, &_mbox_trash }
}
};
/* plug-in */
static int _mbox_init(GtkTreeStore * store, GtkTreeIter * parent,
GtkTextBuffer * buffer);
static int _mbox_quit(void);
static GtkTextBuffer * _mbox_select(AccountFolder * folder,
AccountMessage * message);
static GtkTextBuffer * _mbox_select_source(AccountFolder * folder,
AccountMessage * message);
static int _mbox_init(AccountPlugin * plugin, GtkTreeStore * store,
GtkTreeIter * parent, GtkTextBuffer * buffer);
static int _mbox_destroy(AccountPlugin * plugin);
static GtkTextBuffer * _mbox_select(AccountPlugin * plugin,
AccountFolder * folder, AccountMessage * message);
static GtkTextBuffer * _mbox_select_source(AccountPlugin * plugin,
AccountFolder * folder, AccountMessage * message);
AccountPlugin account_plugin =
{
NULL,
_mbox_type,
_mbox_name,
"MBOX",
"Local folders",
NULL,
_mbox_config,
_mbox_init,
_mbox_quit,
_mbox_destroy,
_mbox_select,
_mbox_select_source,
NULL
@ -190,31 +193,39 @@ static int _message_set_header(AccountMessage * message, char const * header,
/* Mbox */
/* functions */
/* mbox_init */
static int _mbox_init(GtkTreeStore * store, GtkTreeIter * parent,
GtkTextBuffer * buffer)
static int _mbox_init(AccountPlugin * plugin, GtkTreeStore * store,
GtkTreeIter * parent, GtkTextBuffer * buffer)
{
int ret = 0;
Mbox * mbox;
size_t i;
char * filename;
AccountFolder * af;
MboxFolder * mbox;
MboxFolder * folder;
GdkPixbuf * pixbuf;
GtkTreeIter iter;
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s()\n", __func__);
#endif
if((mbox = malloc(sizeof(*mbox))) == NULL)
return -1;
plugin->priv = mbox;
mbox->plugin = plugin;
memcpy(mbox->folders, _mbox_folder_defaults, sizeof(mbox->folders));
for(i = 0; i < _FOLDER_CNT; i++)
{
af = &_config_folder[i];
mbox = af->data;
mbox->buffer = buffer;
filename = mbox->config->value;
af = &mbox->folders[i].folder;
af->data = &mbox->folders[i];
folder = &mbox->folders[i];
folder->mbox = mbox;
folder->buffer = buffer;
filename = folder->config->value;
if(filename == NULL)
continue;
pixbuf = gtk_icon_theme_load_icon(account_plugin.helper->theme,
(mbox->pixbuf != NULL)
? mbox->pixbuf : "stock_folder", 16,
(folder->pixbuf != NULL)
? folder->pixbuf : "stock_folder", 16,
0, NULL);
gtk_tree_store_append(store, &iter, parent);
gtk_tree_store_set(store, &iter, MF_COL_ACCOUNT, NULL,
@ -222,40 +233,42 @@ static int _mbox_init(GtkTreeStore * store, GtkTreeIter * parent,
MF_COL_NAME, af->name, -1);
g_object_unref(pixbuf);
/* XXX should not be done here? */
_config_folder[i].store = gtk_list_store_new(MH_COL_COUNT,
G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER,
GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING,
G_TYPE_BOOLEAN, G_TYPE_INT);
mbox->source = g_idle_add(_folder_idle, &_config_folder[i]);
af->store = gtk_list_store_new(MH_COL_COUNT, G_TYPE_POINTER,
G_TYPE_POINTER, G_TYPE_POINTER, GDK_TYPE_PIXBUF,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_UINT, G_TYPE_STRING, G_TYPE_BOOLEAN,
G_TYPE_INT);
folder->source = g_idle_add(_folder_idle, af);
}
return ret;
}
/* mbox_quit */
static int _mbox_quit(void)
/* mbox_destroy */
static int _mbox_destroy(AccountPlugin * plugin)
{
Mbox * mbox = plugin->priv;
size_t i;
MboxFolder * mf;
size_t j;
for(i = 0; i < _FOLDER_CNT; i++)
{
mf = _config_folder[i].data;
mf = &mbox->folders[i];
for(j = 0; j < mf->messages_cnt; j++)
_message_delete(mf->messages[j]);
free(mf->messages);
mf->messages = NULL;
mf->messages_cnt = 0;
}
free(mbox);
return 0;
}
/* mbox_select */
static GtkTextBuffer * _mbox_select(AccountFolder * folder,
AccountMessage * message)
static GtkTextBuffer * _mbox_select(AccountPlugin * plugin,
AccountFolder * folder, AccountMessage * message)
{
MboxFolder * mf = folder->data;
char const * filename = mf->config->value;
@ -272,7 +285,10 @@ static GtkTextBuffer * _mbox_select(AccountFolder * folder,
gtk_text_buffer_get_end_iter(mf->buffer, &iter);
/* XXX we may still be reading the file... */
if((fp = fopen(filename, "r")) == NULL)
{
plugin->helper->error(NULL, strerror(errno), 1);
return NULL;
}
if(message->body_offset != 0 && message->body_length > 0
&& fseek(fp, message->body_offset, SEEK_SET) == 0
&& (buf = malloc(message->body_length)) != NULL)
@ -287,8 +303,8 @@ static GtkTextBuffer * _mbox_select(AccountFolder * folder,
/* mbox_select_source */
static GtkTextBuffer * _mbox_select_source(AccountFolder * folder,
AccountMessage * message)
static GtkTextBuffer * _mbox_select_source(AccountPlugin * plugin,
AccountFolder * folder, AccountMessage * message)
{
/* FIXME code duplication with _mbox_select */
GtkTextBuffer * ret;
@ -307,7 +323,10 @@ static GtkTextBuffer * _mbox_select_source(AccountFolder * folder,
gtk_text_buffer_get_end_iter(ret, &iter);
/* XXX we may still be reading the file... */
if((fp = fopen(filename, "r")) == NULL)
{
plugin->helper->error(NULL, strerror(errno), 1);
return NULL;
}
size = message->body_offset - message->offset + message->body_length;
if(fseek(fp, message->offset, SEEK_SET) == 0
&& (buf = malloc(size)) != NULL)
@ -476,9 +495,10 @@ AccountMessage * _folder_message_add(AccountFolder * folder, off_t offset)
static gboolean _folder_idle(gpointer data)
{
AccountFolder * folder = data;
MboxFolder * mbox = folder->data;
MboxFolder * mf = folder->data;
Mbox * mbox = mf->mbox;
struct stat st;
char const * filename = mbox->config->value;
char const * filename = mf->config->value;
GError * error = NULL;
#ifdef DEBUG
@ -488,26 +508,26 @@ static gboolean _folder_idle(gpointer data)
return FALSE;
if(stat(filename, &st) != 0)
{
_error = strerror(errno);
mbox->source = g_timeout_add(1000, _folder_idle, folder);
mbox->plugin->helper->error(NULL, strerror(errno), 1);
mf->source = g_timeout_add(1000, _folder_idle, folder);
return FALSE;
}
if(st.st_mtime == mbox->mtime)
if(st.st_mtime == mf->mtime)
{
mbox->source = g_timeout_add(1000, _folder_idle, folder);
mf->source = g_timeout_add(1000, _folder_idle, folder);
return FALSE;
}
mbox->mtime = st.st_mtime; /* FIXME only when done */
if(mbox->channel == NULL)
if((mbox->channel = g_io_channel_new_file(filename, "r",
mf->mtime = st.st_mtime; /* FIXME only when done */
if(mf->channel == NULL)
if((mf->channel = g_io_channel_new_file(filename, "r",
&error)) == NULL)
{
_error = error->message;
mbox->source = g_timeout_add(1000, _folder_idle, folder);
mbox->plugin->helper->error(NULL, error->message, 1);
mf->source = g_timeout_add(1000, _folder_idle, folder);
return FALSE;
}
g_io_channel_set_encoding(mbox->channel, NULL, NULL);
mbox->source = g_io_add_watch(mbox->channel, G_IO_IN, _folder_watch,
g_io_channel_set_encoding(mf->channel, NULL, NULL);
mf->source = g_io_add_watch(mf->channel, G_IO_IN, _folder_watch,
folder);
return FALSE;
}
@ -529,7 +549,8 @@ static gboolean _folder_watch(GIOChannel * source, GIOCondition condition,
gpointer data)
{
AccountFolder * folder = data;
MboxFolder * mbox = folder->data;
MboxFolder * mf = folder->data;
Mbox * mbox = mf->mbox;
char buf[BUFSIZ];
size_t read;
GError * error = NULL;
@ -537,7 +558,7 @@ static gboolean _folder_watch(GIOChannel * source, GIOCondition condition,
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s() \"%s\"\n", __func__,
(char const *)mbox->config->value);
(char const *)mf->config->value);
#endif
if(condition != G_IO_IN)
return FALSE; /* FIXME implement message deletion */
@ -546,7 +567,7 @@ static gboolean _folder_watch(GIOChannel * source, GIOCondition condition,
switch(status)
{
case G_IO_STATUS_ERROR:
_error = error->message;
mbox->plugin->helper->error(NULL, error->message, 1);
/* FIXME new timeout 1000 function after invalidating
* mtime */
return FALSE;
@ -560,14 +581,12 @@ static gboolean _folder_watch(GIOChannel * source, GIOCondition condition,
if(status == G_IO_STATUS_EOF)
{
/* XXX should not be necessary here */
if(mbox->message != NULL)
_message_set_body(mbox->message,
mbox->message->body_offset,
mbox->offset
- mbox->message->body_offset);
if(mf->message != NULL)
_message_set_body(mf->message, mf->message->body_offset,
mf->offset - mf->message->body_offset);
g_io_channel_close(source);
mbox->channel = NULL;
mbox->source = g_timeout_add(1000, _folder_idle, folder);
mf->channel = NULL;
mf->source = g_timeout_add(1000, _folder_idle, folder);
return FALSE;
}
return TRUE;

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Mailer */
/* 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
@ -42,6 +42,7 @@ AccountPlugin account_plugin =
NULL,
_nntp_type,
_nntp_name,
NULL,
_nntp_config,
NULL,
NULL,

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Mailer */
/* 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
@ -44,6 +44,7 @@ AccountPlugin account_plugin =
NULL,
_pop3_type,
_pop3_name,
NULL,
_pop3_config,
NULL,
NULL,

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Mailer */
/* 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
@ -38,6 +38,7 @@ AccountPlugin account_plugin =
NULL,
_rss_type,
_rss_name,
NULL,
_rss_config,
NULL,
NULL,

View File

@ -1,6 +1,6 @@
/* $Id$ */
static char const _copyright[] =
"Copyright (c) 2010 Pierre Pronchery <khorben@defora.org>";
"Copyright (c) 2011 Pierre Pronchery <khorben@defora.org>";
/* This file is part of DeforaOS Desktop Mailer */
static char const _license[] =
"This program is free software: you can redistribute it and/or modify\n"

View File

@ -349,6 +349,7 @@ static int _new_plugins(Mailer * mailer)
mailer->helper.theme, "mail-read", 16, 0, NULL);
mailer->helper.mail_unread = gtk_icon_theme_load_icon(
mailer->helper.theme, "mail-unread", 16, 0, NULL);
mailer->helper.error = mailer_error;
if((dirname = string_new_append(PLUGINDIR, "/account", NULL)) == NULL)
return -1;
if((dir = opendir(dirname)) == NULL)