2006-06-11 10:37:53 -07:00
|
|
|
#include <e.h>
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
#include "mdir.h"
|
|
|
|
|
2008-10-22 06:53:03 -07:00
|
|
|
static Eina_List *mdirs;
|
2006-06-11 10:37:53 -07:00
|
|
|
|
2006-07-17 17:03:04 -07:00
|
|
|
static void _mail_mdir_check_mail (void *data, Ecore_File_Monitor * monitor,
|
|
|
|
Ecore_File_Event event, const char *path);
|
|
|
|
static int _mail_mdir_get_files (const char *path);
|
2006-06-11 10:37:53 -07:00
|
|
|
|
|
|
|
void
|
2006-07-17 17:03:04 -07:00
|
|
|
_mail_mdir_add_mailbox (void *data, void *data2)
|
2006-06-11 10:37:53 -07:00
|
|
|
{
|
2006-07-17 17:03:04 -07:00
|
|
|
MdirClient *mc;
|
|
|
|
Config_Box *cb;
|
|
|
|
|
|
|
|
cb = data2;
|
|
|
|
if (!cb)
|
|
|
|
return;
|
|
|
|
|
|
|
|
mc = E_NEW (MdirClient, 1);
|
|
|
|
mc->config = cb;
|
|
|
|
mc->data = data;
|
|
|
|
mc->config->num_new = 0;
|
|
|
|
mc->config->num_total = 0;
|
|
|
|
mc->monitor =
|
|
|
|
ecore_file_monitor_add (cb->new_path, _mail_mdir_check_mail, mc);
|
|
|
|
|
2008-10-22 06:53:03 -07:00
|
|
|
mdirs = eina_list_append (mdirs, mc);
|
2006-06-11 10:37:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-07-17 17:03:04 -07:00
|
|
|
_mail_mdir_del_mailbox (void *data)
|
2006-06-11 10:37:53 -07:00
|
|
|
{
|
2006-07-17 17:03:04 -07:00
|
|
|
Config_Box *cb;
|
2008-10-22 06:53:03 -07:00
|
|
|
Eina_List *l;
|
2006-07-17 17:03:04 -07:00
|
|
|
|
|
|
|
cb = data;
|
|
|
|
if (!cb)
|
|
|
|
return;
|
|
|
|
for (l = mdirs; l; l = l->next)
|
|
|
|
{
|
|
|
|
MdirClient *mc;
|
|
|
|
|
|
|
|
mc = l->data;
|
|
|
|
if (!mc)
|
|
|
|
continue;
|
|
|
|
if (mc->config != cb)
|
|
|
|
continue;
|
2008-10-22 06:53:03 -07:00
|
|
|
mdirs = eina_list_remove (mdirs, mc);
|
2006-07-17 17:03:04 -07:00
|
|
|
free (mc);
|
|
|
|
mc = NULL;
|
|
|
|
break;
|
|
|
|
}
|
2006-06-11 10:37:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-07-17 17:03:04 -07:00
|
|
|
_mail_mdir_shutdown ()
|
2006-06-11 10:37:53 -07:00
|
|
|
{
|
2006-07-17 17:03:04 -07:00
|
|
|
if (!mdirs)
|
|
|
|
return;
|
|
|
|
while (mdirs)
|
|
|
|
{
|
|
|
|
MdirClient *mc;
|
|
|
|
|
|
|
|
mc = mdirs->data;
|
|
|
|
if (mc->monitor)
|
|
|
|
ecore_file_monitor_del (mc->monitor);
|
2008-10-22 06:53:03 -07:00
|
|
|
mdirs = eina_list_remove_list (mdirs, mdirs);
|
2006-07-17 17:03:04 -07:00
|
|
|
free (mc);
|
|
|
|
mc = NULL;
|
|
|
|
}
|
2006-06-11 10:37:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* PRIVATES */
|
2006-07-17 17:03:04 -07:00
|
|
|
static void
|
|
|
|
_mail_mdir_check_mail (void *data, Ecore_File_Monitor * monitor,
|
|
|
|
Ecore_File_Event event, const char *path)
|
2006-06-11 10:37:53 -07:00
|
|
|
{
|
2006-07-17 17:03:04 -07:00
|
|
|
MdirClient *mc;
|
2006-06-11 10:37:53 -07:00
|
|
|
|
2006-07-17 17:03:04 -07:00
|
|
|
mc = data;
|
|
|
|
if (!mc)
|
|
|
|
return;
|
2006-06-12 13:45:10 -07:00
|
|
|
|
2006-07-17 17:03:04 -07:00
|
|
|
mc->config->num_total = _mail_mdir_get_files (mc->config->cur_path);
|
|
|
|
mc->config->num_new = _mail_mdir_get_files (mc->config->new_path);
|
|
|
|
|
|
|
|
_mail_set_text (mc->data);
|
|
|
|
if ((mc->config->num_new > 0) && (mc->config->use_exec)
|
|
|
|
&& (mc->config->exec))
|
|
|
|
_mail_start_exe (mc->config);
|
2006-06-11 10:37:53 -07:00
|
|
|
}
|
|
|
|
|
2006-07-17 17:03:04 -07:00
|
|
|
static int
|
|
|
|
_mail_mdir_get_files (const char *path)
|
2006-06-11 10:37:53 -07:00
|
|
|
{
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
Eina_List *l;
|
2006-07-17 17:03:04 -07:00
|
|
|
char *item;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
l = ecore_file_ls (path);
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
EINA_LIST_FREE(l, item)
|
2006-07-17 17:03:04 -07:00
|
|
|
{
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
if (!((!strcmp (item, ".")) || (!strcmp (item, ".."))))
|
2006-07-17 17:03:04 -07:00
|
|
|
i++;
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
free(item);
|
2006-07-17 17:03:04 -07:00
|
|
|
}
|
|
|
|
return i;
|
2006-06-11 10:37:53 -07:00
|
|
|
}
|