parent
961e23fb01
commit
0e4e640217
|
@ -15,8 +15,10 @@ struct _E_Config_Dialog_Data
|
||||||
|
|
||||||
static void *_create_data (E_Config_Dialog * cfd);
|
static void *_create_data (E_Config_Dialog * cfd);
|
||||||
static void _free_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata);
|
static void _free_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata);
|
||||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
static Evas_Object *_basic_create_widgets (E_Config_Dialog * cfd, Evas * evas,
|
||||||
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
E_Config_Dialog_Data * cfdata);
|
||||||
|
static int _basic_apply_data (E_Config_Dialog * cfd,
|
||||||
|
E_Config_Dialog_Data * cfdata);
|
||||||
|
|
||||||
static void _load_boxes (E_Config_Dialog * cfd);
|
static void _load_boxes (E_Config_Dialog * cfd);
|
||||||
static int _ilist_header_exists (Evas_Object * il, const char *name);
|
static int _ilist_header_exists (Evas_Object * il, const char *name);
|
||||||
|
@ -34,14 +36,16 @@ _config_mail_module(Config_Item *ci)
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
v = E_NEW (E_Config_Dialog_View, 1);
|
v = E_NEW (E_Config_Dialog_View, 1);
|
||||||
if (!v) return;
|
if (!v)
|
||||||
|
return;
|
||||||
|
|
||||||
v->create_cfdata = _create_data;
|
v->create_cfdata = _create_data;
|
||||||
v->free_cfdata = _free_data;
|
v->free_cfdata = _free_data;
|
||||||
v->basic.apply_cfdata = _basic_apply_data;
|
v->basic.apply_cfdata = _basic_apply_data;
|
||||||
v->basic.create_widgets = _basic_create_widgets;
|
v->basic.create_widgets = _basic_create_widgets;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/module.eap", e_module_dir_get(mail_config->module));
|
snprintf (buf, sizeof (buf), "%s/module.eap",
|
||||||
|
e_module_dir_get (mail_config->module));
|
||||||
con = e_container_current_get (e_manager_current_get ());
|
con = e_container_current_get (e_manager_current_get ());
|
||||||
cfd = e_config_dialog_new (con, _("Mail Configuration"), buf, 0, v, ci);
|
cfd = e_config_dialog_new (con, _("Mail Configuration"), buf, 0, v, ci);
|
||||||
mail_config->config_dialog = cfd;
|
mail_config->config_dialog = cfd;
|
||||||
|
@ -70,24 +74,29 @@ _create_data(E_Config_Dialog *cfd)
|
||||||
static void
|
static void
|
||||||
_free_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
|
_free_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
|
||||||
{
|
{
|
||||||
if (!mail_config) return;
|
if (!mail_config)
|
||||||
|
return;
|
||||||
mail_config->config_dialog = NULL;
|
mail_config->config_dialog = NULL;
|
||||||
free (cfdata);
|
free (cfdata);
|
||||||
cfdata = NULL;
|
cfdata = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
_basic_create_widgets (E_Config_Dialog * cfd, Evas * evas,
|
||||||
|
E_Config_Dialog_Data * cfdata)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *of, *ob, *ot;
|
Evas_Object *o, *of, *ob, *ot;
|
||||||
|
|
||||||
o = e_widget_list_add (evas, 0, 0);
|
o = e_widget_list_add (evas, 0, 0);
|
||||||
of = e_widget_framelist_add (evas, _("General Settings"), 0);
|
of = e_widget_framelist_add (evas, _("General Settings"), 0);
|
||||||
ob = e_widget_check_add(evas, _("Always Show Labels"), &(cfdata->show_label));
|
ob =
|
||||||
|
e_widget_check_add (evas, _("Always Show Labels"), &(cfdata->show_label));
|
||||||
e_widget_framelist_object_append (of, ob);
|
e_widget_framelist_object_append (of, ob);
|
||||||
ob = e_widget_label_add (evas, _("Check Interval"));
|
ob = e_widget_label_add (evas, _("Check Interval"));
|
||||||
e_widget_framelist_object_append (of, ob);
|
e_widget_framelist_object_append (of, ob);
|
||||||
ob = e_widget_slider_add(evas, 1, 0, _("%2.0f minutes"), 1.0, 60.0, 1.0, 0, &(cfdata->check_time), NULL, 100);
|
ob =
|
||||||
|
e_widget_slider_add (evas, 1, 0, _("%2.0f minutes"), 1.0, 60.0, 1.0, 0,
|
||||||
|
&(cfdata->check_time), NULL, 100);
|
||||||
e_widget_framelist_object_append (of, ob);
|
e_widget_framelist_object_append (of, ob);
|
||||||
e_widget_list_object_append (o, of, 1, 1, 0.5);
|
e_widget_list_object_append (o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
@ -100,13 +109,19 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
e_widget_frametable_object_append (of, ob, 0, 0, 1, 4, 1, 1, 1, 1);
|
e_widget_frametable_object_append (of, ob, 0, 0, 1, 4, 1, 1, 1, 1);
|
||||||
|
|
||||||
ot = e_widget_table_add (evas, 0);
|
ot = e_widget_table_add (evas, 0);
|
||||||
ob = e_widget_button_add(evas, _("Add"), "widget/add", _cb_add_box, cfd, NULL);
|
ob =
|
||||||
|
e_widget_button_add (evas, _("Add"), "widget/add", _cb_add_box, cfd,
|
||||||
|
NULL);
|
||||||
e_widget_table_object_append (ot, ob, 0, 0, 1, 1, 1, 1, 1, 0);
|
e_widget_table_object_append (ot, ob, 0, 0, 1, 1, 1, 1, 1, 0);
|
||||||
ob = e_widget_button_add(evas, _("Delete"), "widget/del", _cb_del_box, cfd, NULL);
|
ob =
|
||||||
|
e_widget_button_add (evas, _("Delete"), "widget/del", _cb_del_box, cfd,
|
||||||
|
NULL);
|
||||||
e_widget_disabled_set (ob, 1);
|
e_widget_disabled_set (ob, 1);
|
||||||
cfdata->del = ob;
|
cfdata->del = ob;
|
||||||
e_widget_table_object_append (ot, ob, 0, 1, 1, 1, 1, 1, 1, 0);
|
e_widget_table_object_append (ot, ob, 0, 1, 1, 1, 1, 1, 1, 0);
|
||||||
ob = e_widget_button_add(evas, _("Configure..."), "widget/config", _cb_edit_box, cfd, NULL);
|
ob =
|
||||||
|
e_widget_button_add (evas, _("Configure..."), "widget/config",
|
||||||
|
_cb_edit_box, cfd, NULL);
|
||||||
e_widget_disabled_set (ob, 1);
|
e_widget_disabled_set (ob, 1);
|
||||||
cfdata->configure = ob;
|
cfdata->configure = ob;
|
||||||
e_widget_table_object_append (ot, ob, 0, 2, 1, 1, 1, 1, 1, 0);
|
e_widget_table_object_append (ot, ob, 0, 2, 1, 1, 1, 1, 1, 0);
|
||||||
|
@ -141,14 +156,19 @@ _load_boxes(E_Config_Dialog *cfd)
|
||||||
|
|
||||||
cfdata = cfd->cfdata;
|
cfdata = cfd->cfdata;
|
||||||
il = cfdata->il;
|
il = cfdata->il;
|
||||||
if (!il) return;
|
if (!il)
|
||||||
|
return;
|
||||||
|
|
||||||
ci = cfd->data;
|
ci = cfd->data;
|
||||||
if (!ci) return;
|
if (!ci)
|
||||||
if (!ci->boxes) return;
|
return;
|
||||||
if (evas_list_count(ci->boxes) <= 0) return;
|
if (!ci->boxes)
|
||||||
|
return;
|
||||||
|
if (evas_list_count (ci->boxes) <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/module.eap", e_module_dir_get(mail_config->module));
|
snprintf (buf, sizeof (buf), "%s/module.eap",
|
||||||
|
e_module_dir_get (mail_config->module));
|
||||||
|
|
||||||
e_widget_ilist_clear (il);
|
e_widget_ilist_clear (il);
|
||||||
|
|
||||||
|
@ -183,11 +203,14 @@ _load_boxes(E_Config_Dialog *cfd)
|
||||||
Evas_Object *ic;
|
Evas_Object *ic;
|
||||||
|
|
||||||
cb = box->data;
|
cb = box->data;
|
||||||
if (cb->type != i) continue;
|
if (cb->type != i)
|
||||||
if (!cb->name) continue;
|
continue;
|
||||||
|
if (!cb->name)
|
||||||
|
continue;
|
||||||
ic = edje_object_add (cfd->dia->win->evas);
|
ic = edje_object_add (cfd->dia->win->evas);
|
||||||
edje_object_file_set (ic, buf, "icon");
|
edje_object_file_set (ic, buf, "icon");
|
||||||
e_widget_ilist_append(il, ic, cb->name, _ilist_cb_selected, cfd, NULL);
|
e_widget_ilist_append (il, ic, cb->name, _ilist_cb_selected, cfd,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e_widget_ilist_go (il);
|
e_widget_ilist_go (il);
|
||||||
|
@ -198,24 +221,28 @@ _ilist_header_exists(Evas_Object *il, const char *name)
|
||||||
{
|
{
|
||||||
int c, i, found = 0;
|
int c, i, found = 0;
|
||||||
|
|
||||||
if (!il) return -1;
|
if (!il)
|
||||||
|
return -1;
|
||||||
|
|
||||||
c = e_widget_ilist_count (il);
|
c = e_widget_ilist_count (il);
|
||||||
if (c <= 0) return -1;
|
if (c <= 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < c; i++)
|
for (i = 0; i < c; i++)
|
||||||
{
|
{
|
||||||
const char *n;
|
const char *n;
|
||||||
|
|
||||||
n = e_widget_ilist_nth_label_get (il, i);
|
n = e_widget_ilist_nth_label_get (il, i);
|
||||||
if (!n) continue;
|
if (!n)
|
||||||
|
continue;
|
||||||
if (!strcmp (n, name))
|
if (!strcmp (n, name))
|
||||||
{
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found) return i;
|
if (found)
|
||||||
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +267,8 @@ _cb_add_box(void *data, void *data2)
|
||||||
Config_Item *ci;
|
Config_Item *ci;
|
||||||
|
|
||||||
cfd = data;
|
cfd = data;
|
||||||
if (!cfd) return;
|
if (!cfd)
|
||||||
|
return;
|
||||||
|
|
||||||
ci = cfd->data;
|
ci = cfd->data;
|
||||||
cfdata = cfd->cfdata;
|
cfdata = cfd->cfdata;
|
||||||
|
@ -259,21 +287,24 @@ _cb_edit_box(void *data, void *data2)
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
cfd = data;
|
cfd = data;
|
||||||
if (!cfd) return;
|
if (!cfd)
|
||||||
|
return;
|
||||||
|
|
||||||
ci = cfd->data;
|
ci = cfd->data;
|
||||||
cfdata = cfd->cfdata;
|
cfdata = cfd->cfdata;
|
||||||
il = cfdata->il;
|
il = cfdata->il;
|
||||||
s = e_widget_ilist_selected_label_get (il);
|
s = e_widget_ilist_selected_label_get (il);
|
||||||
|
|
||||||
if (!s) return;
|
if (!s)
|
||||||
|
return;
|
||||||
|
|
||||||
for (l = ci->boxes; l; l = l->next)
|
for (l = ci->boxes; l; l = l->next)
|
||||||
{
|
{
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = l->data;
|
cb = l->data;
|
||||||
if (!cb->name) continue;
|
if (!cb->name)
|
||||||
|
continue;
|
||||||
if (!strcmp (s, cb->name))
|
if (!strcmp (s, cb->name))
|
||||||
{
|
{
|
||||||
_config_box (ci, cb, cfd);
|
_config_box (ci, cb, cfd);
|
||||||
|
@ -293,7 +324,8 @@ _cb_del_box(void *data, void *data2)
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
cfd = data;
|
cfd = data;
|
||||||
if (!cfd) return;
|
if (!cfd)
|
||||||
|
return;
|
||||||
|
|
||||||
ci = cfd->data;
|
ci = cfd->data;
|
||||||
cfdata = cfd->cfdata;
|
cfdata = cfd->cfdata;
|
||||||
|
@ -305,7 +337,8 @@ _cb_del_box(void *data, void *data2)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = l->data;
|
cb = l->data;
|
||||||
if (!cb->name) continue;
|
if (!cb->name)
|
||||||
|
continue;
|
||||||
if (!strcmp (s, cb->name))
|
if (!strcmp (s, cb->name))
|
||||||
{
|
{
|
||||||
_mail_box_deleted (ci->id, cb->name);
|
_mail_box_deleted (ci->id, cb->name);
|
||||||
|
|
|
@ -27,8 +27,10 @@ struct _E_Config_Dialog_Data
|
||||||
|
|
||||||
static void *_create_data (E_Config_Dialog * cfd);
|
static void *_create_data (E_Config_Dialog * cfd);
|
||||||
static void _free_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata);
|
static void _free_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata);
|
||||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
static Evas_Object *_basic_create_widgets (E_Config_Dialog * cfd, Evas * evas,
|
||||||
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
E_Config_Dialog_Data * cfdata);
|
||||||
|
static int _basic_apply_data (E_Config_Dialog * cfd,
|
||||||
|
E_Config_Dialog_Data * cfdata);
|
||||||
static void _type_cb_change (void *data, Evas_Object * obj);
|
static void _type_cb_change (void *data, Evas_Object * obj);
|
||||||
static void _use_exec_cb_change (void *data, Evas_Object * obj);
|
static void _use_exec_cb_change (void *data, Evas_Object * obj);
|
||||||
|
|
||||||
|
@ -43,7 +45,8 @@ _config_box(Config_Item *ci, Config_Box *cb, E_Config_Dialog *mcfd)
|
||||||
E_Container *con;
|
E_Container *con;
|
||||||
|
|
||||||
v = E_NEW (E_Config_Dialog_View, 1);
|
v = E_NEW (E_Config_Dialog_View, 1);
|
||||||
if (!v) return;
|
if (!v)
|
||||||
|
return;
|
||||||
|
|
||||||
prev_dlg = mcfd;
|
prev_dlg = mcfd;
|
||||||
mail_ci = ci;
|
mail_ci = ci;
|
||||||
|
@ -125,21 +128,26 @@ _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
_basic_create_widgets (E_Config_Dialog * cfd, Evas * evas,
|
||||||
|
E_Config_Dialog_Data * cfdata)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *of, *ob, *ot;
|
Evas_Object *o, *of, *ob, *ot;
|
||||||
E_Radio_Group *rg;
|
E_Radio_Group *rg;
|
||||||
|
|
||||||
o = e_widget_list_add (evas, 0, 0);
|
o = e_widget_list_add (evas, 0, 0);
|
||||||
of = e_widget_framelist_add (evas, _("General Settings"), 0);
|
of = e_widget_framelist_add (evas, _("General Settings"), 0);
|
||||||
ob = e_widget_check_add(evas, _("Start Program When New Mail Arrives"), &(cfdata->use_exec));
|
ob =
|
||||||
|
e_widget_check_add (evas, _("Start Program When New Mail Arrives"),
|
||||||
|
&(cfdata->use_exec));
|
||||||
e_widget_framelist_object_append (of, ob);
|
e_widget_framelist_object_append (of, ob);
|
||||||
e_widget_on_change_hook_set (ob, _use_exec_cb_change, cfdata);
|
e_widget_on_change_hook_set (ob, _use_exec_cb_change, cfdata);
|
||||||
ot = e_widget_table_add (evas, 1);
|
ot = e_widget_table_add (evas, 1);
|
||||||
cfdata->exec_label = e_widget_label_add (evas, _("Program:"));
|
cfdata->exec_label = e_widget_label_add (evas, _("Program:"));
|
||||||
e_widget_table_object_append(ot, cfdata->exec_label, 0, 0, 1, 1, 0, 0, 1, 0);
|
e_widget_table_object_append (ot, cfdata->exec_label, 0, 0, 1, 1, 0, 0, 1,
|
||||||
|
0);
|
||||||
cfdata->exec_entry = e_widget_entry_add (evas, &cfdata->exec);
|
cfdata->exec_entry = e_widget_entry_add (evas, &cfdata->exec);
|
||||||
e_widget_table_object_append(ot, cfdata->exec_entry, 1, 0, 1, 1, 0, 0, 1, 0);
|
e_widget_table_object_append (ot, cfdata->exec_entry, 1, 0, 1, 1, 0, 0, 1,
|
||||||
|
0);
|
||||||
e_widget_framelist_object_append (of, ot);
|
e_widget_framelist_object_append (of, ot);
|
||||||
e_widget_list_object_append (o, of, 1, 1, 0.5);
|
e_widget_list_object_append (o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
@ -199,9 +207,11 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
e_widget_frametable_object_append (of, ob, 1, 3, 1, 1, 0, 0, 1, 0);
|
e_widget_frametable_object_append (of, ob, 1, 3, 1, 1, 0, 0, 1, 0);
|
||||||
|
|
||||||
cfdata->new_path_label = e_widget_label_add (evas, _("New Mail Path:"));
|
cfdata->new_path_label = e_widget_label_add (evas, _("New Mail Path:"));
|
||||||
e_widget_frametable_object_append(of, cfdata->new_path_label, 0, 4, 1, 1, 0, 0, 1, 0);
|
e_widget_frametable_object_append (of, cfdata->new_path_label, 0, 4, 1, 1,
|
||||||
|
0, 0, 1, 0);
|
||||||
cfdata->new_path_entry = e_widget_entry_add (evas, &cfdata->new_path);
|
cfdata->new_path_entry = e_widget_entry_add (evas, &cfdata->new_path);
|
||||||
e_widget_frametable_object_append(of, cfdata->new_path_entry, 1, 4, 1, 1, 0, 0, 1, 0);
|
e_widget_frametable_object_append (of, cfdata->new_path_entry, 1, 4, 1, 1,
|
||||||
|
0, 0, 1, 0);
|
||||||
if (cfdata->type == 0)
|
if (cfdata->type == 0)
|
||||||
{
|
{
|
||||||
e_widget_disabled_set (cfdata->new_path_label, 1);
|
e_widget_disabled_set (cfdata->new_path_label, 1);
|
||||||
|
@ -209,9 +219,11 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdata->cur_path_label = e_widget_label_add (evas, _("Current Mail Path:"));
|
cfdata->cur_path_label = e_widget_label_add (evas, _("Current Mail Path:"));
|
||||||
e_widget_frametable_object_append(of, cfdata->cur_path_label, 0, 5, 1, 1, 0, 0, 1, 0);
|
e_widget_frametable_object_append (of, cfdata->cur_path_label, 0, 5, 1, 1,
|
||||||
|
0, 0, 1, 0);
|
||||||
cfdata->cur_path_entry = e_widget_entry_add (evas, &cfdata->cur_path);
|
cfdata->cur_path_entry = e_widget_entry_add (evas, &cfdata->cur_path);
|
||||||
e_widget_frametable_object_append(of, cfdata->cur_path_entry, 1, 5, 1, 1, 0, 0, 1, 0);
|
e_widget_frametable_object_append (of, cfdata->cur_path_entry, 1, 5, 1, 1,
|
||||||
|
0, 0, 1, 0);
|
||||||
if ((cfdata->type == 1) || (cfdata->type == 3))
|
if ((cfdata->type == 1) || (cfdata->type == 3))
|
||||||
{
|
{
|
||||||
e_widget_disabled_set (cfdata->cur_path_label, 1);
|
e_widget_disabled_set (cfdata->cur_path_label, 1);
|
||||||
|
@ -241,7 +253,8 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
is_new = 1;
|
is_new = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cb->name) evas_stringshare_del(cb->name);
|
if (cb->name)
|
||||||
|
evas_stringshare_del (cb->name);
|
||||||
if (cfdata->name != NULL)
|
if (cfdata->name != NULL)
|
||||||
cb->name = evas_stringshare_add (cfdata->name);
|
cb->name = evas_stringshare_add (cfdata->name);
|
||||||
else
|
else
|
||||||
|
@ -251,37 +264,43 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
cb->port = atoi (cfdata->port);
|
cb->port = atoi (cfdata->port);
|
||||||
cb->ssl = cfdata->ssl;
|
cb->ssl = cfdata->ssl;
|
||||||
cb->use_exec = cfdata->use_exec;
|
cb->use_exec = cfdata->use_exec;
|
||||||
if (cb->exec) evas_stringshare_del(cb->exec);
|
if (cb->exec)
|
||||||
|
evas_stringshare_del (cb->exec);
|
||||||
if (cfdata->exec != NULL)
|
if (cfdata->exec != NULL)
|
||||||
cb->exec = evas_stringshare_add (cfdata->exec);
|
cb->exec = evas_stringshare_add (cfdata->exec);
|
||||||
else
|
else
|
||||||
cb->exec = evas_stringshare_add ("");
|
cb->exec = evas_stringshare_add ("");
|
||||||
|
|
||||||
if (cb->host) evas_stringshare_del(cb->host);
|
if (cb->host)
|
||||||
|
evas_stringshare_del (cb->host);
|
||||||
if (cfdata->host != NULL)
|
if (cfdata->host != NULL)
|
||||||
cb->host = evas_stringshare_add (cfdata->host);
|
cb->host = evas_stringshare_add (cfdata->host);
|
||||||
else
|
else
|
||||||
cb->host = evas_stringshare_add ("");
|
cb->host = evas_stringshare_add ("");
|
||||||
|
|
||||||
if (cb->user) evas_stringshare_del(cb->user);
|
if (cb->user)
|
||||||
|
evas_stringshare_del (cb->user);
|
||||||
if (cfdata->user != NULL)
|
if (cfdata->user != NULL)
|
||||||
cb->user = evas_stringshare_add (cfdata->user);
|
cb->user = evas_stringshare_add (cfdata->user);
|
||||||
else
|
else
|
||||||
cb->user = evas_stringshare_add ("");
|
cb->user = evas_stringshare_add ("");
|
||||||
|
|
||||||
if (cb->pass) evas_stringshare_del(cb->pass);
|
if (cb->pass)
|
||||||
|
evas_stringshare_del (cb->pass);
|
||||||
if (cfdata->pass != NULL)
|
if (cfdata->pass != NULL)
|
||||||
cb->pass = evas_stringshare_add (cfdata->pass);
|
cb->pass = evas_stringshare_add (cfdata->pass);
|
||||||
else
|
else
|
||||||
cb->pass = evas_stringshare_add ("");
|
cb->pass = evas_stringshare_add ("");
|
||||||
|
|
||||||
if (cb->new_path) evas_stringshare_del(cb->new_path);
|
if (cb->new_path)
|
||||||
|
evas_stringshare_del (cb->new_path);
|
||||||
if (cfdata->new_path != NULL)
|
if (cfdata->new_path != NULL)
|
||||||
cb->new_path = evas_stringshare_add (cfdata->new_path);
|
cb->new_path = evas_stringshare_add (cfdata->new_path);
|
||||||
else
|
else
|
||||||
cb->new_path = evas_stringshare_add ("");
|
cb->new_path = evas_stringshare_add ("");
|
||||||
|
|
||||||
if (cb->cur_path) evas_stringshare_del(cb->cur_path);
|
if (cb->cur_path)
|
||||||
|
evas_stringshare_del (cb->cur_path);
|
||||||
if (cfdata->cur_path != NULL)
|
if (cfdata->cur_path != NULL)
|
||||||
cb->cur_path = evas_stringshare_add (cfdata->cur_path);
|
cb->cur_path = evas_stringshare_add (cfdata->cur_path);
|
||||||
else
|
else
|
||||||
|
|
193
e_mod_main.c
193
e_mod_main.c
|
@ -25,17 +25,22 @@
|
||||||
#include "mbox.h"
|
#include "mbox.h"
|
||||||
|
|
||||||
/* Func Protos for Gadcon */
|
/* Func Protos for Gadcon */
|
||||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
static E_Gadcon_Client *_gc_init (E_Gadcon * gc, const char *name,
|
||||||
|
const char *id, const char *style);
|
||||||
static void _gc_shutdown (E_Gadcon_Client * gcc);
|
static void _gc_shutdown (E_Gadcon_Client * gcc);
|
||||||
static void _gc_orient (E_Gadcon_Client * gcc);
|
static void _gc_orient (E_Gadcon_Client * gcc);
|
||||||
static char *_gc_label (void);
|
static char *_gc_label (void);
|
||||||
static Evas_Object *_gc_icon (Evas * evas);
|
static Evas_Object *_gc_icon (Evas * evas);
|
||||||
|
|
||||||
/* Func Protos for Module */
|
/* Func Protos for Module */
|
||||||
static void _mail_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _mail_cb_mouse_down (void *data, Evas * e, Evas_Object * obj,
|
||||||
static void _mail_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
void *event_info);
|
||||||
static void _mail_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _mail_cb_mouse_in (void *data, Evas * e, Evas_Object * obj,
|
||||||
static void _mail_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi);
|
void *event_info);
|
||||||
|
static void _mail_cb_mouse_out (void *data, Evas * e, Evas_Object * obj,
|
||||||
|
void *event_info);
|
||||||
|
static void _mail_menu_cb_configure (void *data, E_Menu * m,
|
||||||
|
E_Menu_Item * mi);
|
||||||
static void _mail_menu_cb_post (void *data, E_Menu * m);
|
static void _mail_menu_cb_post (void *data, E_Menu * m);
|
||||||
static void _mail_menu_cb_exec (void *data, E_Menu * m, E_Menu_Item * mi);
|
static void _mail_menu_cb_exec (void *data, E_Menu * m, E_Menu_Item * mi);
|
||||||
static Config_Item *_mail_config_item_get (const char *id);
|
static Config_Item *_mail_config_item_get (const char *id);
|
||||||
|
@ -52,8 +57,7 @@ Config *mail_config = NULL;
|
||||||
|
|
||||||
static Ecore_Event_Handler *exit_handler;
|
static Ecore_Event_Handler *exit_handler;
|
||||||
|
|
||||||
static const E_Gadcon_Client_Class _gc_class =
|
static const E_Gadcon_Client_Class _gc_class = {
|
||||||
{
|
|
||||||
GADCON_CLIENT_CLASS_VERSION,
|
GADCON_CLIENT_CLASS_VERSION,
|
||||||
"mail", {_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon}
|
"mail", {_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon}
|
||||||
};
|
};
|
||||||
|
@ -70,7 +74,8 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
|
|
||||||
inst = E_NEW (Instance, 1);
|
inst = E_NEW (Instance, 1);
|
||||||
ci = _mail_config_item_get (id);
|
ci = _mail_config_item_get (id);
|
||||||
if (!ci->id) ci->id = evas_stringshare_add(id);
|
if (!ci->id)
|
||||||
|
ci->id = evas_stringshare_add (id);
|
||||||
|
|
||||||
mail = _mail_new (gc->evas);
|
mail = _mail_new (gc->evas);
|
||||||
mail->inst = inst;
|
mail->inst = inst;
|
||||||
|
@ -81,9 +86,12 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
inst->gcc = gcc;
|
inst->gcc = gcc;
|
||||||
inst->mail_obj = mail->mail_obj;
|
inst->mail_obj = mail->mail_obj;
|
||||||
|
|
||||||
evas_object_event_callback_add(inst->mail_obj, EVAS_CALLBACK_MOUSE_DOWN, _mail_cb_mouse_down, inst);
|
evas_object_event_callback_add (inst->mail_obj, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
evas_object_event_callback_add(inst->mail_obj, EVAS_CALLBACK_MOUSE_IN, _mail_cb_mouse_in, inst);
|
_mail_cb_mouse_down, inst);
|
||||||
evas_object_event_callback_add(inst->mail_obj, EVAS_CALLBACK_MOUSE_OUT, _mail_cb_mouse_out, inst);
|
evas_object_event_callback_add (inst->mail_obj, EVAS_CALLBACK_MOUSE_IN,
|
||||||
|
_mail_cb_mouse_in, inst);
|
||||||
|
evas_object_event_callback_add (inst->mail_obj, EVAS_CALLBACK_MOUSE_OUT,
|
||||||
|
_mail_cb_mouse_out, inst);
|
||||||
|
|
||||||
if (ci->show_label)
|
if (ci->show_label)
|
||||||
edje_object_signal_emit (inst->mail_obj, "label_active", "");
|
edje_object_signal_emit (inst->mail_obj, "label_active", "");
|
||||||
|
@ -107,13 +115,17 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
have_imap = 1;
|
have_imap = 1;
|
||||||
_mail_imap_add_mailbox (cb);
|
_mail_imap_add_mailbox (cb);
|
||||||
if (!inst->check_timer)
|
if (!inst->check_timer)
|
||||||
inst->check_timer = ecore_timer_add((ci->check_time * 60.0), _mail_cb_check, inst);
|
inst->check_timer =
|
||||||
|
ecore_timer_add ((ci->check_time * 60.0), _mail_cb_check,
|
||||||
|
inst);
|
||||||
break;
|
break;
|
||||||
case MAIL_TYPE_POP:
|
case MAIL_TYPE_POP:
|
||||||
have_pop = 1;
|
have_pop = 1;
|
||||||
_mail_pop_add_mailbox (cb);
|
_mail_pop_add_mailbox (cb);
|
||||||
if (!inst->check_timer)
|
if (!inst->check_timer)
|
||||||
inst->check_timer = ecore_timer_add((ci->check_time * 60.0), _mail_cb_check, inst);
|
inst->check_timer =
|
||||||
|
ecore_timer_add ((ci->check_time * 60.0), _mail_cb_check,
|
||||||
|
inst);
|
||||||
break;
|
break;
|
||||||
case MAIL_TYPE_MDIR:
|
case MAIL_TYPE_MDIR:
|
||||||
_mail_mdir_add_mailbox (inst, cb);
|
_mail_mdir_add_mailbox (inst, cb);
|
||||||
|
@ -123,8 +135,10 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (have_pop) _mail_pop_check_mail(inst);
|
if (have_pop)
|
||||||
if (have_imap) _mail_imap_check_mail(inst);
|
_mail_pop_check_mail (inst);
|
||||||
|
if (have_imap)
|
||||||
|
_mail_imap_check_mail (inst);
|
||||||
}
|
}
|
||||||
return gcc;
|
return gcc;
|
||||||
}
|
}
|
||||||
|
@ -136,9 +150,12 @@ _gc_shutdown(E_Gadcon_Client *gcc)
|
||||||
|
|
||||||
inst = gcc->data;
|
inst = gcc->data;
|
||||||
|
|
||||||
evas_object_event_callback_del(inst->mail_obj, EVAS_CALLBACK_MOUSE_DOWN, _mail_cb_mouse_down);
|
evas_object_event_callback_del (inst->mail_obj, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
evas_object_event_callback_del(inst->mail_obj, EVAS_CALLBACK_MOUSE_IN, _mail_cb_mouse_in);
|
_mail_cb_mouse_down);
|
||||||
evas_object_event_callback_del(inst->mail_obj, EVAS_CALLBACK_MOUSE_OUT, _mail_cb_mouse_out);
|
evas_object_event_callback_del (inst->mail_obj, EVAS_CALLBACK_MOUSE_IN,
|
||||||
|
_mail_cb_mouse_in);
|
||||||
|
evas_object_event_callback_del (inst->mail_obj, EVAS_CALLBACK_MOUSE_OUT,
|
||||||
|
_mail_cb_mouse_out);
|
||||||
|
|
||||||
mail_config->instances = evas_list_remove (mail_config->instances, inst);
|
mail_config->instances = evas_list_remove (mail_config->instances, inst);
|
||||||
_mail_free (inst->mail);
|
_mail_free (inst->mail);
|
||||||
|
@ -166,20 +183,23 @@ _gc_icon(Evas *evas)
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
o = edje_object_add (evas);
|
o = edje_object_add (evas);
|
||||||
snprintf(buf, sizeof(buf), "%s/module.eap", e_module_dir_get(mail_config->module));
|
snprintf (buf, sizeof (buf), "%s/module.eap",
|
||||||
|
e_module_dir_get (mail_config->module));
|
||||||
edje_object_file_set (o, buf, "icon");
|
edje_object_file_set (o, buf, "icon");
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_mail_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
_mail_cb_mouse_down (void *data, Evas * e, Evas_Object * obj,
|
||||||
|
void *event_info)
|
||||||
{
|
{
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
Config_Item *ci;
|
Config_Item *ci;
|
||||||
Evas_Event_Mouse_Down *ev = event_info;
|
Evas_Event_Mouse_Down *ev = event_info;
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
|
|
||||||
if (!inst) return;
|
if (!inst)
|
||||||
|
return;
|
||||||
if ((ev->button == 3) && (!mail_config->menu))
|
if ((ev->button == 3) && (!mail_config->menu))
|
||||||
{
|
{
|
||||||
E_Menu *mn, *sn;
|
E_Menu *mn, *sn;
|
||||||
|
@ -196,7 +216,8 @@ _mail_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
E_Menu_Item *mm;
|
E_Menu_Item *mm;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/module.eap", e_module_dir_get(mail_config->module));
|
snprintf (buf, sizeof (buf), "%s/module.eap",
|
||||||
|
e_module_dir_get (mail_config->module));
|
||||||
mm = e_menu_item_new (mn);
|
mm = e_menu_item_new (mn);
|
||||||
e_menu_item_label_set (mm, _("Mailboxes"));
|
e_menu_item_label_set (mm, _("Mailboxes"));
|
||||||
e_menu_item_icon_edje_set (mm, buf, "icon");
|
e_menu_item_icon_edje_set (mm, buf, "icon");
|
||||||
|
@ -207,9 +228,11 @@ _mail_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = l->data;
|
cb = l->data;
|
||||||
if (!cb) continue;
|
if (!cb)
|
||||||
|
continue;
|
||||||
mi = e_menu_item_new (sn);
|
mi = e_menu_item_new (sn);
|
||||||
snprintf(buf, sizeof(buf), "%s: %d/%d", cb->name, cb->num_new, cb->num_total);
|
snprintf (buf, sizeof (buf), "%s: %d/%d", cb->name, cb->num_new,
|
||||||
|
cb->num_total);
|
||||||
e_menu_item_label_set (mi, buf);
|
e_menu_item_label_set (mi, buf);
|
||||||
if ((cb->exec) && (cb->use_exec))
|
if ((cb->exec) && (cb->use_exec))
|
||||||
e_menu_item_callback_set (mi, _mail_menu_cb_exec, cb);
|
e_menu_item_callback_set (mi, _mail_menu_cb_exec, cb);
|
||||||
|
@ -230,10 +253,12 @@ _mail_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
e_gadcon_client_util_menu_items_append (inst->gcc, mn, 0);
|
e_gadcon_client_util_menu_items_append (inst->gcc, mn, 0);
|
||||||
e_gadcon_canvas_zone_geometry_get (inst->gcc->gadcon, &x, &y, &w, &h);
|
e_gadcon_canvas_zone_geometry_get (inst->gcc->gadcon, &x, &y, &w, &h);
|
||||||
e_menu_activate_mouse (mn,
|
e_menu_activate_mouse (mn,
|
||||||
e_util_zone_current_get(e_manager_current_get()),
|
e_util_zone_current_get (e_manager_current_get
|
||||||
x + ev->output.x, y + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN,
|
()), x + ev->output.x,
|
||||||
ev->timestamp);
|
y + ev->output.y, 1, 1,
|
||||||
evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, EVAS_BUTTON_NONE, ev->timestamp, NULL);
|
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
|
||||||
|
evas_event_feed_mouse_up (inst->gcc->gadcon->evas, ev->button,
|
||||||
|
EVAS_BUTTON_NONE, ev->timestamp, NULL);
|
||||||
}
|
}
|
||||||
else if (ev->button == 1)
|
else if (ev->button == 1)
|
||||||
_mail_cb_check (inst);
|
_mail_cb_check (inst);
|
||||||
|
@ -244,7 +269,8 @@ _mail_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
|
|
||||||
if (!inst) return;
|
if (!inst)
|
||||||
|
return;
|
||||||
edje_object_signal_emit (inst->mail_obj, "label_active", "");
|
edje_object_signal_emit (inst->mail_obj, "label_active", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +280,8 @@ _mail_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
Config_Item *ci;
|
Config_Item *ci;
|
||||||
|
|
||||||
if (!inst) return;
|
if (!inst)
|
||||||
|
return;
|
||||||
ci = _mail_config_item_get (inst->gcc->id);
|
ci = _mail_config_item_get (inst->gcc->id);
|
||||||
if (!ci->show_label)
|
if (!ci->show_label)
|
||||||
edje_object_signal_emit (inst->mail_obj, "label_passive", "");
|
edje_object_signal_emit (inst->mail_obj, "label_passive", "");
|
||||||
|
@ -263,7 +290,8 @@ _mail_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
static void
|
static void
|
||||||
_mail_menu_cb_post (void *data, E_Menu * m)
|
_mail_menu_cb_post (void *data, E_Menu * m)
|
||||||
{
|
{
|
||||||
if (!mail_config->menu) return;
|
if (!mail_config->menu)
|
||||||
|
return;
|
||||||
e_object_del (E_OBJECT (mail_config->menu));
|
e_object_del (E_OBJECT (mail_config->menu));
|
||||||
mail_config->menu = NULL;
|
mail_config->menu = NULL;
|
||||||
}
|
}
|
||||||
|
@ -274,7 +302,8 @@ _mail_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
Config_Item *ci;
|
Config_Item *ci;
|
||||||
|
|
||||||
if (!inst) return;
|
if (!inst)
|
||||||
|
return;
|
||||||
ci = _mail_config_item_get (inst->gcc->id);
|
ci = _mail_config_item_get (inst->gcc->id);
|
||||||
_config_mail_module (ci);
|
_config_mail_module (ci);
|
||||||
}
|
}
|
||||||
|
@ -288,8 +317,10 @@ _mail_config_item_get(const char *id)
|
||||||
for (l = mail_config->items; l; l = l->next)
|
for (l = mail_config->items; l; l = l->next)
|
||||||
{
|
{
|
||||||
ci = l->data;
|
ci = l->data;
|
||||||
if (!ci->id) continue;
|
if (!ci->id)
|
||||||
if (!strcmp(ci->id, id)) return ci;
|
continue;
|
||||||
|
if (!strcmp (ci->id, id))
|
||||||
|
return ci;
|
||||||
}
|
}
|
||||||
|
|
||||||
ci = E_NEW (Config_Item, 1);
|
ci = E_NEW (Config_Item, 1);
|
||||||
|
@ -302,8 +333,7 @@ _mail_config_item_get(const char *id)
|
||||||
return ci;
|
return ci;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI E_Module_Api e_modapi =
|
EAPI E_Module_Api e_modapi = {
|
||||||
{
|
|
||||||
E_MODULE_API_VERSION,
|
E_MODULE_API_VERSION,
|
||||||
"Mail"
|
"Mail"
|
||||||
};
|
};
|
||||||
|
@ -407,19 +437,28 @@ e_modapi_shutdown(E_Module *m)
|
||||||
_mail_mbox_del_mailbox (cb);
|
_mail_mbox_del_mailbox (cb);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (cb->name) evas_stringshare_del(cb->name);
|
if (cb->name)
|
||||||
if (cb->host) evas_stringshare_del(cb->host);
|
evas_stringshare_del (cb->name);
|
||||||
if (cb->user) evas_stringshare_del(cb->user);
|
if (cb->host)
|
||||||
if (cb->pass) evas_stringshare_del(cb->pass);
|
evas_stringshare_del (cb->host);
|
||||||
if (cb->new_path) evas_stringshare_del(cb->new_path);
|
if (cb->user)
|
||||||
if (cb->cur_path) evas_stringshare_del(cb->cur_path);
|
evas_stringshare_del (cb->user);
|
||||||
if (cb->exec) evas_stringshare_del(cb->exec);
|
if (cb->pass)
|
||||||
|
evas_stringshare_del (cb->pass);
|
||||||
|
if (cb->new_path)
|
||||||
|
evas_stringshare_del (cb->new_path);
|
||||||
|
if (cb->cur_path)
|
||||||
|
evas_stringshare_del (cb->cur_path);
|
||||||
|
if (cb->exec)
|
||||||
|
evas_stringshare_del (cb->exec);
|
||||||
ci->boxes = evas_list_remove_list (ci->boxes, ci->boxes);
|
ci->boxes = evas_list_remove_list (ci->boxes, ci->boxes);
|
||||||
free (cb);
|
free (cb);
|
||||||
cb = NULL;
|
cb = NULL;
|
||||||
}
|
}
|
||||||
if (ci->id) evas_stringshare_del(ci->id);
|
if (ci->id)
|
||||||
mail_config->items = evas_list_remove_list(mail_config->items, mail_config->items);
|
evas_stringshare_del (ci->id);
|
||||||
|
mail_config->items =
|
||||||
|
evas_list_remove_list (mail_config->items, mail_config->items);
|
||||||
free (ci);
|
free (ci);
|
||||||
ci = NULL;
|
ci = NULL;
|
||||||
}
|
}
|
||||||
|
@ -447,7 +486,8 @@ e_modapi_save(E_Module *m)
|
||||||
|
|
||||||
inst = l->data;
|
inst = l->data;
|
||||||
ci = _mail_config_item_get (inst->gcc->id);
|
ci = _mail_config_item_get (inst->gcc->id);
|
||||||
if (ci->id) evas_stringshare_del(ci->id);
|
if (ci->id)
|
||||||
|
evas_stringshare_del (ci->id);
|
||||||
ci->id = evas_stringshare_add (inst->gcc->id);
|
ci->id = evas_stringshare_add (inst->gcc->id);
|
||||||
}
|
}
|
||||||
e_config_domain_save ("module.mail", conf_edd, mail_config);
|
e_config_domain_save ("module.mail", conf_edd, mail_config);
|
||||||
|
@ -458,7 +498,8 @@ EAPI int
|
||||||
e_modapi_about (E_Module * m)
|
e_modapi_about (E_Module * m)
|
||||||
{
|
{
|
||||||
e_module_dialog_show (m, D_ ("Enlightenment Mail Module"),
|
e_module_dialog_show (m, D_ ("Enlightenment Mail Module"),
|
||||||
D_("This is a module to notify when you have new mail."));
|
D_
|
||||||
|
("This is a module to notify when you have new mail."));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,8 +512,10 @@ _mail_new(Evas *evas)
|
||||||
mail = E_NEW (Mail, 1);
|
mail = E_NEW (Mail, 1);
|
||||||
mail->mail_obj = edje_object_add (evas);
|
mail->mail_obj = edje_object_add (evas);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/mail.edj", e_module_dir_get(mail_config->module));
|
snprintf (buf, sizeof (buf), "%s/mail.edj",
|
||||||
if (!e_theme_edje_object_set(mail->mail_obj, "base/theme/modules/mail", "modules/mail/main"))
|
e_module_dir_get (mail_config->module));
|
||||||
|
if (!e_theme_edje_object_set
|
||||||
|
(mail->mail_obj, "base/theme/modules/mail", "modules/mail/main"))
|
||||||
edje_object_file_set (mail->mail_obj, buf, "modules/mail/main");
|
edje_object_file_set (mail->mail_obj, buf, "modules/mail/main");
|
||||||
evas_object_show (mail->mail_obj);
|
evas_object_show (mail->mail_obj);
|
||||||
|
|
||||||
|
@ -495,10 +538,12 @@ _mail_cb_check(void *data)
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
int have_imap = 0, have_pop = 0;
|
int have_imap = 0, have_pop = 0;
|
||||||
|
|
||||||
if (!inst) return 1;
|
if (!inst)
|
||||||
|
return 1;
|
||||||
|
|
||||||
ci = _mail_config_item_get (inst->gcc->id);
|
ci = _mail_config_item_get (inst->gcc->id);
|
||||||
if (!ci->boxes) return 1;
|
if (!ci->boxes)
|
||||||
|
return 1;
|
||||||
|
|
||||||
edje_object_signal_emit (inst->mail->mail_obj, "check_mail", "");
|
edje_object_signal_emit (inst->mail->mail_obj, "check_mail", "");
|
||||||
|
|
||||||
|
@ -507,7 +552,8 @@ _mail_cb_check(void *data)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = l->data;
|
cb = l->data;
|
||||||
if (!cb) continue;
|
if (!cb)
|
||||||
|
continue;
|
||||||
switch (cb->type)
|
switch (cb->type)
|
||||||
{
|
{
|
||||||
case MAIL_TYPE_MDIR:
|
case MAIL_TYPE_MDIR:
|
||||||
|
@ -522,8 +568,10 @@ _mail_cb_check(void *data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (have_imap) _mail_imap_check_mail(inst);
|
if (have_imap)
|
||||||
if (have_pop) _mail_pop_check_mail(inst);
|
_mail_imap_check_mail (inst);
|
||||||
|
if (have_pop)
|
||||||
|
_mail_pop_check_mail (inst);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,16 +584,19 @@ _mail_set_text(void *data)
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (!inst) return;
|
if (!inst)
|
||||||
|
return;
|
||||||
|
|
||||||
ci = _mail_config_item_get (inst->gcc->id);
|
ci = _mail_config_item_get (inst->gcc->id);
|
||||||
if (!ci) return;
|
if (!ci)
|
||||||
|
return;
|
||||||
for (l = ci->boxes; l; l = l->next)
|
for (l = ci->boxes; l; l = l->next)
|
||||||
{
|
{
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = l->data;
|
cb = l->data;
|
||||||
if (!cb) continue;
|
if (!cb)
|
||||||
|
continue;
|
||||||
count += cb->num_new;
|
count += cb->num_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,9 +619,11 @@ _mail_start_exe(void *data)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = data;
|
cb = data;
|
||||||
if (!cb) return;
|
if (!cb)
|
||||||
|
return;
|
||||||
|
|
||||||
exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _mail_cb_exe_exit, cb);
|
exit_handler =
|
||||||
|
ecore_event_handler_add (ECORE_EXE_EVENT_DEL, _mail_cb_exe_exit, cb);
|
||||||
cb->exe = ecore_exe_run (cb->exec, cb);
|
cb->exe = ecore_exe_run (cb->exec, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,7 +633,8 @@ _mail_cb_exe_exit(void *data, int type, void *event)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = data;
|
cb = data;
|
||||||
if (!cb) return 0;
|
if (!cb)
|
||||||
|
return 0;
|
||||||
cb->exe = NULL;
|
cb->exe = NULL;
|
||||||
ecore_event_handler_del (exit_handler);
|
ecore_event_handler_del (exit_handler);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -642,7 +696,8 @@ _mail_box_deleted(const char *ci_name, const char *box_name)
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
|
|
||||||
inst = i->data;
|
inst = i->data;
|
||||||
if (!inst->gcc->id) continue;
|
if (!inst->gcc->id)
|
||||||
|
continue;
|
||||||
if (!strcmp (inst->gcc->id, ci_name))
|
if (!strcmp (inst->gcc->id, ci_name))
|
||||||
{
|
{
|
||||||
Config_Item *ci;
|
Config_Item *ci;
|
||||||
|
@ -692,7 +747,8 @@ _mail_config_updated(const char *id)
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
Config_Item *ci;
|
Config_Item *ci;
|
||||||
|
|
||||||
if (!mail_config) return;
|
if (!mail_config)
|
||||||
|
return;
|
||||||
|
|
||||||
ci = _mail_config_item_get (id);
|
ci = _mail_config_item_get (id);
|
||||||
for (l = mail_config->instances; l; l = l->next)
|
for (l = mail_config->instances; l; l = l->next)
|
||||||
|
@ -700,13 +756,16 @@ _mail_config_updated(const char *id)
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
|
|
||||||
inst = l->data;
|
inst = l->data;
|
||||||
if (!inst->gcc->id) continue;
|
if (!inst->gcc->id)
|
||||||
|
continue;
|
||||||
if (!strcmp (inst->gcc->id, ci->id))
|
if (!strcmp (inst->gcc->id, ci->id))
|
||||||
{
|
{
|
||||||
if (inst->check_timer)
|
if (inst->check_timer)
|
||||||
{
|
{
|
||||||
ecore_timer_del (inst->check_timer);
|
ecore_timer_del (inst->check_timer);
|
||||||
inst->check_timer = ecore_timer_add((ci->check_time * 60.0), _mail_cb_check, inst);
|
inst->check_timer =
|
||||||
|
ecore_timer_add ((ci->check_time * 60.0), _mail_cb_check,
|
||||||
|
inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ci->show_label)
|
if (ci->show_label)
|
||||||
|
@ -724,8 +783,10 @@ _mail_menu_cb_exec(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = data;
|
cb = data;
|
||||||
if (!cb) return;
|
if (!cb)
|
||||||
|
return;
|
||||||
|
|
||||||
exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _mail_cb_exe_exit, cb);
|
exit_handler =
|
||||||
|
ecore_event_handler_add (ECORE_EXE_EVENT_DEL, _mail_cb_exe_exit, cb);
|
||||||
cb->exe = ecore_exe_run (cb->exec, cb);
|
cb->exe = ecore_exe_run (cb->exec, cb);
|
||||||
}
|
}
|
||||||
|
|
66
imap.c
66
imap.c
|
@ -27,11 +27,17 @@ _mail_imap_check_mail(void *data)
|
||||||
if (!is->server)
|
if (!is->server)
|
||||||
{
|
{
|
||||||
if (!is->add_handler)
|
if (!is->add_handler)
|
||||||
is->add_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, _mail_imap_server_add, NULL);
|
is->add_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_ADD,
|
||||||
|
_mail_imap_server_add, NULL);
|
||||||
if (!is->del_handler)
|
if (!is->del_handler)
|
||||||
is->del_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, _mail_imap_server_del, NULL);
|
is->del_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DEL,
|
||||||
|
_mail_imap_server_del, NULL);
|
||||||
if (!is->data_handler)
|
if (!is->data_handler)
|
||||||
is->data_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, _mail_imap_server_data, NULL);
|
is->data_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA,
|
||||||
|
_mail_imap_server_data, NULL);
|
||||||
|
|
||||||
for (j = is->clients; j; j = j->next)
|
for (j = is->clients; j; j = j->next)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +47,9 @@ _mail_imap_check_mail(void *data)
|
||||||
if (ecore_con_ssl_available_get () && (ic->config->ssl))
|
if (ecore_con_ssl_available_get () && (ic->config->ssl))
|
||||||
type |= ECORE_CON_USE_SSL;
|
type |= ECORE_CON_USE_SSL;
|
||||||
ic->server->state = IMAP_STATE_DISCONNECTED;
|
ic->server->state = IMAP_STATE_DISCONNECTED;
|
||||||
ic->server->server = ecore_con_server_connect(type, ic->config->host, ic->config->port, NULL);
|
ic->server->server =
|
||||||
|
ecore_con_server_connect (type, ic->config->host,
|
||||||
|
ic->config->port, NULL);
|
||||||
ic->server->cmd = 0;
|
ic->server->cmd = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +66,8 @@ _mail_imap_add_mailbox(void *data)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = data;
|
cb = data;
|
||||||
if (!cb) return;
|
if (!cb)
|
||||||
|
return;
|
||||||
ic = _mail_imap_client_get (cb);
|
ic = _mail_imap_client_get (cb);
|
||||||
ic->server->clients = evas_list_append (ic->server->clients, ic);
|
ic->server->clients = evas_list_append (ic->server->clients, ic);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +79,8 @@ _mail_imap_del_mailbox(void *data)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = data;
|
cb = data;
|
||||||
if (!cb) return;
|
if (!cb)
|
||||||
|
return;
|
||||||
ic = _mail_imap_client_get (cb);
|
ic = _mail_imap_client_get (cb);
|
||||||
ic->server->clients = evas_list_remove (ic->server->clients, ic);
|
ic->server->clients = evas_list_remove (ic->server->clients, ic);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +88,8 @@ _mail_imap_del_mailbox(void *data)
|
||||||
void
|
void
|
||||||
_mail_imap_shutdown ()
|
_mail_imap_shutdown ()
|
||||||
{
|
{
|
||||||
if (!iservers) return;
|
if (!iservers)
|
||||||
|
return;
|
||||||
while (iservers)
|
while (iservers)
|
||||||
{
|
{
|
||||||
ImapServer *is;
|
ImapServer *is;
|
||||||
|
@ -123,7 +134,8 @@ _mail_imap_client_get(void *data)
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
cb = data;
|
cb = data;
|
||||||
if (!cb) return NULL;
|
if (!cb)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if ((!iservers) || (evas_list_count (iservers) <= 0))
|
if ((!iservers) || (evas_list_count (iservers) <= 0))
|
||||||
{
|
{
|
||||||
|
@ -137,11 +149,13 @@ _mail_imap_client_get(void *data)
|
||||||
for (l = iservers; l; l = l->next)
|
for (l = iservers; l; l = l->next)
|
||||||
{
|
{
|
||||||
is = l->data;
|
is = l->data;
|
||||||
if (!is->clients) continue;
|
if (!is->clients)
|
||||||
|
continue;
|
||||||
for (j = is->clients; j; j = j->next)
|
for (j = is->clients; j; j = j->next)
|
||||||
{
|
{
|
||||||
ic = j->data;
|
ic = j->data;
|
||||||
if (!ic->config) continue;
|
if (!ic->config)
|
||||||
|
continue;
|
||||||
if ((!strcmp (ic->config->host, cb->host)) &&
|
if ((!strcmp (ic->config->host, cb->host)) &&
|
||||||
(!strcmp (ic->config->user, cb->user)) &&
|
(!strcmp (ic->config->user, cb->user)) &&
|
||||||
(!strcmp (ic->config->pass, cb->pass)))
|
(!strcmp (ic->config->pass, cb->pass)))
|
||||||
|
@ -150,7 +164,8 @@ _mail_imap_client_get(void *data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found) break;
|
if (found)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
|
@ -170,7 +185,8 @@ _mail_imap_server_add(void *data, int type, void *event)
|
||||||
ImapServer *is;
|
ImapServer *is;
|
||||||
|
|
||||||
is = _mail_imap_server_get (ev->server);
|
is = _mail_imap_server_get (ev->server);
|
||||||
if (!is) return 1;
|
if (!is)
|
||||||
|
return 1;
|
||||||
|
|
||||||
is->state = IMAP_STATE_CONNECTED;
|
is->state = IMAP_STATE_CONNECTED;
|
||||||
is->cmd = 0;
|
is->cmd = 0;
|
||||||
|
@ -184,7 +200,8 @@ _mail_imap_server_del(void *data, int type, void *event)
|
||||||
ImapServer *is;
|
ImapServer *is;
|
||||||
|
|
||||||
is = _mail_imap_server_get (ev->server);
|
is = _mail_imap_server_get (ev->server);
|
||||||
if (!is) return 1;
|
if (!is)
|
||||||
|
return 1;
|
||||||
|
|
||||||
if (is->state == IMAP_STATE_DISCONNECTED)
|
if (is->state == IMAP_STATE_DISCONNECTED)
|
||||||
printf ("Imap Server Disconnected\n");
|
printf ("Imap Server Disconnected\n");
|
||||||
|
@ -209,8 +226,10 @@ _mail_imap_server_data(void *data, int type, void *event)
|
||||||
size_t slen;
|
size_t slen;
|
||||||
|
|
||||||
is = _mail_imap_server_get (ev->server);
|
is = _mail_imap_server_get (ev->server);
|
||||||
if (!is) return 1;
|
if (!is)
|
||||||
if (is->state == IMAP_STATE_DISCONNECTED) return 1;
|
return 1;
|
||||||
|
if (is->state == IMAP_STATE_DISCONNECTED)
|
||||||
|
return 1;
|
||||||
|
|
||||||
len = sizeof (in) - 1;
|
len = sizeof (in) - 1;
|
||||||
len = (len > ev->size) ? (ev->size) : (len);
|
len = (len > ev->size) ? (ev->size) : (len);
|
||||||
|
@ -241,15 +260,20 @@ _mail_imap_server_data(void *data, int type, void *event)
|
||||||
switch (is->state)
|
switch (is->state)
|
||||||
{
|
{
|
||||||
case IMAP_STATE_SERVER_READY:
|
case IMAP_STATE_SERVER_READY:
|
||||||
len = snprintf(out, sizeof(out), "A%03i LOGIN %s %s\r\n", ++is->cmd, ic->config->user, ic->config->pass);
|
len =
|
||||||
|
snprintf (out, sizeof (out), "A%03i LOGIN %s %s\r\n", ++is->cmd,
|
||||||
|
ic->config->user, ic->config->pass);
|
||||||
ecore_con_server_send (ev->server, out, len);
|
ecore_con_server_send (ev->server, out, len);
|
||||||
break;
|
break;
|
||||||
case IMAP_STATE_LOGGED_IN:
|
case IMAP_STATE_LOGGED_IN:
|
||||||
len = snprintf(out, sizeof(out), "A%03i STATUS %s (MESSAGES UNSEEN)\r\n", ++is->cmd, ic->config->new_path);
|
len =
|
||||||
|
snprintf (out, sizeof (out), "A%03i STATUS %s (MESSAGES UNSEEN)\r\n",
|
||||||
|
++is->cmd, ic->config->new_path);
|
||||||
ecore_con_server_send (ev->server, out, len);
|
ecore_con_server_send (ev->server, out, len);
|
||||||
break;
|
break;
|
||||||
case IMAP_STATE_STATUS_OK:
|
case IMAP_STATE_STATUS_OK:
|
||||||
if (sscanf(in, "* STATUS %*s (MESSAGES %i UNSEEN %i)", &total, &num) == 2)
|
if (sscanf (in, "* STATUS %*s (MESSAGES %i UNSEEN %i)", &total, &num) ==
|
||||||
|
2)
|
||||||
{
|
{
|
||||||
ic->config->num_new = num;
|
ic->config->num_new = num;
|
||||||
ic->config->num_total = total;
|
ic->config->num_total = total;
|
||||||
|
@ -279,7 +303,8 @@ _mail_imap_server_data(void *data, int type, void *event)
|
||||||
ic = NULL;
|
ic = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ic) break;
|
if (!ic)
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -292,7 +317,8 @@ _mail_imap_server_logout(ImapServer *is)
|
||||||
int len;
|
int len;
|
||||||
char out[1024];
|
char out[1024];
|
||||||
|
|
||||||
if (!is) return;
|
if (!is)
|
||||||
|
return;
|
||||||
|
|
||||||
if (is->state >= IMAP_STATE_LOGGED_IN)
|
if (is->state >= IMAP_STATE_LOGGED_IN)
|
||||||
{
|
{
|
||||||
|
|
39
mbox.c
39
mbox.c
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
static Evas_List *mboxes;
|
static Evas_List *mboxes;
|
||||||
|
|
||||||
static void _mail_mbox_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event event, const char *path);
|
static void _mail_mbox_check_mail (void *data, Ecore_File_Monitor * monitor,
|
||||||
|
Ecore_File_Event event, const char *path);
|
||||||
|
|
||||||
void
|
void
|
||||||
_mail_mbox_add_mailbox (void *data, void *data2)
|
_mail_mbox_add_mailbox (void *data, void *data2)
|
||||||
|
@ -13,14 +14,16 @@ _mail_mbox_add_mailbox(void *data, void *data2)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = data2;
|
cb = data2;
|
||||||
if (!cb) return;
|
if (!cb)
|
||||||
|
return;
|
||||||
|
|
||||||
mb = E_NEW (MboxClient, 1);
|
mb = E_NEW (MboxClient, 1);
|
||||||
mb->config = cb;
|
mb->config = cb;
|
||||||
mb->data = data;
|
mb->data = data;
|
||||||
mb->config->num_new = 0;
|
mb->config->num_new = 0;
|
||||||
mb->config->num_total = 0;
|
mb->config->num_total = 0;
|
||||||
mb->monitor = ecore_file_monitor_add(cb->new_path, _mail_mbox_check_mail, mb);
|
mb->monitor =
|
||||||
|
ecore_file_monitor_add (cb->new_path, _mail_mbox_check_mail, mb);
|
||||||
|
|
||||||
mboxes = evas_list_append (mboxes, mb);
|
mboxes = evas_list_append (mboxes, mb);
|
||||||
}
|
}
|
||||||
|
@ -32,14 +35,17 @@ _mail_mbox_del_mailbox(void *data)
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
|
|
||||||
cb = data;
|
cb = data;
|
||||||
if (!cb) return;
|
if (!cb)
|
||||||
|
return;
|
||||||
for (l = mboxes; l; l = l->next)
|
for (l = mboxes; l; l = l->next)
|
||||||
{
|
{
|
||||||
MboxClient *mb;
|
MboxClient *mb;
|
||||||
|
|
||||||
mb = l->data;
|
mb = l->data;
|
||||||
if (!mb) continue;
|
if (!mb)
|
||||||
if (mb->config != cb) continue;
|
continue;
|
||||||
|
if (mb->config != cb)
|
||||||
|
continue;
|
||||||
if (mb->monitor)
|
if (mb->monitor)
|
||||||
ecore_file_monitor_del (mb->monitor);
|
ecore_file_monitor_del (mb->monitor);
|
||||||
mboxes = evas_list_remove (mboxes, mb);
|
mboxes = evas_list_remove (mboxes, mb);
|
||||||
|
@ -52,7 +58,8 @@ _mail_mbox_del_mailbox(void *data)
|
||||||
void
|
void
|
||||||
_mail_mbox_shutdown ()
|
_mail_mbox_shutdown ()
|
||||||
{
|
{
|
||||||
if (!mboxes) return;
|
if (!mboxes)
|
||||||
|
return;
|
||||||
while (mboxes)
|
while (mboxes)
|
||||||
{
|
{
|
||||||
MboxClient *mb;
|
MboxClient *mb;
|
||||||
|
@ -68,7 +75,8 @@ _mail_mbox_shutdown()
|
||||||
|
|
||||||
/* PRIVATES */
|
/* PRIVATES */
|
||||||
static void
|
static void
|
||||||
_mail_mbox_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event event, const char *path)
|
_mail_mbox_check_mail (void *data, Ecore_File_Monitor * monitor,
|
||||||
|
Ecore_File_Event event, const char *path)
|
||||||
{
|
{
|
||||||
MboxClient *mb;
|
MboxClient *mb;
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
@ -77,11 +85,14 @@ _mail_mbox_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event
|
||||||
int header;
|
int header;
|
||||||
|
|
||||||
mb = data;
|
mb = data;
|
||||||
if (!mb) return;
|
if (!mb)
|
||||||
|
return;
|
||||||
|
|
||||||
cb = mb->config;
|
cb = mb->config;
|
||||||
if (!cb) return;
|
if (!cb)
|
||||||
if (!cb->new_path) return;
|
return;
|
||||||
|
if (!cb->new_path)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!(f = fopen (cb->new_path, "r")))
|
if (!(f = fopen (cb->new_path, "r")))
|
||||||
return;
|
return;
|
||||||
|
@ -99,12 +110,14 @@ _mail_mbox_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event
|
||||||
mb->config->num_total++;
|
mb->config->num_total++;
|
||||||
mb->config->num_new++;
|
mb->config->num_new++;
|
||||||
}
|
}
|
||||||
else if ((header) && (!strncmp(buf, "Status: ", 7)) && (strchr(buf, 'R')))
|
else if ((header) && (!strncmp (buf, "Status: ", 7))
|
||||||
|
&& (strchr (buf, 'R')))
|
||||||
mb->config->num_new--;
|
mb->config->num_new--;
|
||||||
}
|
}
|
||||||
fclose (f);
|
fclose (f);
|
||||||
|
|
||||||
_mail_set_text (mb->data);
|
_mail_set_text (mb->data);
|
||||||
if ((mb->config->num_new > 0) && (mb->config->use_exec) && (mb->config->exec))
|
if ((mb->config->num_new > 0) && (mb->config->use_exec)
|
||||||
|
&& (mb->config->exec))
|
||||||
_mail_start_exe (mb->config);
|
_mail_start_exe (mb->config);
|
||||||
}
|
}
|
||||||
|
|
33
mdir.c
33
mdir.c
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
static Evas_List *mdirs;
|
static Evas_List *mdirs;
|
||||||
|
|
||||||
static void _mail_mdir_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event event, const char *path);
|
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);
|
static int _mail_mdir_get_files (const char *path);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -14,14 +15,16 @@ _mail_mdir_add_mailbox(void *data, void *data2)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = data2;
|
cb = data2;
|
||||||
if (!cb) return;
|
if (!cb)
|
||||||
|
return;
|
||||||
|
|
||||||
mc = E_NEW (MdirClient, 1);
|
mc = E_NEW (MdirClient, 1);
|
||||||
mc->config = cb;
|
mc->config = cb;
|
||||||
mc->data = data;
|
mc->data = data;
|
||||||
mc->config->num_new = 0;
|
mc->config->num_new = 0;
|
||||||
mc->config->num_total = 0;
|
mc->config->num_total = 0;
|
||||||
mc->monitor = ecore_file_monitor_add(cb->new_path, _mail_mdir_check_mail, mc);
|
mc->monitor =
|
||||||
|
ecore_file_monitor_add (cb->new_path, _mail_mdir_check_mail, mc);
|
||||||
|
|
||||||
mdirs = evas_list_append (mdirs, mc);
|
mdirs = evas_list_append (mdirs, mc);
|
||||||
}
|
}
|
||||||
|
@ -33,14 +36,17 @@ _mail_mdir_del_mailbox(void *data)
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
|
|
||||||
cb = data;
|
cb = data;
|
||||||
if (!cb) return;
|
if (!cb)
|
||||||
|
return;
|
||||||
for (l = mdirs; l; l = l->next)
|
for (l = mdirs; l; l = l->next)
|
||||||
{
|
{
|
||||||
MdirClient *mc;
|
MdirClient *mc;
|
||||||
|
|
||||||
mc = l->data;
|
mc = l->data;
|
||||||
if (!mc) continue;
|
if (!mc)
|
||||||
if (mc->config != cb) continue;
|
continue;
|
||||||
|
if (mc->config != cb)
|
||||||
|
continue;
|
||||||
mdirs = evas_list_remove (mdirs, mc);
|
mdirs = evas_list_remove (mdirs, mc);
|
||||||
free (mc);
|
free (mc);
|
||||||
mc = NULL;
|
mc = NULL;
|
||||||
|
@ -51,7 +57,8 @@ _mail_mdir_del_mailbox(void *data)
|
||||||
void
|
void
|
||||||
_mail_mdir_shutdown ()
|
_mail_mdir_shutdown ()
|
||||||
{
|
{
|
||||||
if (!mdirs) return;
|
if (!mdirs)
|
||||||
|
return;
|
||||||
while (mdirs)
|
while (mdirs)
|
||||||
{
|
{
|
||||||
MdirClient *mc;
|
MdirClient *mc;
|
||||||
|
@ -67,18 +74,21 @@ _mail_mdir_shutdown()
|
||||||
|
|
||||||
/* PRIVATES */
|
/* PRIVATES */
|
||||||
static void
|
static void
|
||||||
_mail_mdir_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event event, const char *path)
|
_mail_mdir_check_mail (void *data, Ecore_File_Monitor * monitor,
|
||||||
|
Ecore_File_Event event, const char *path)
|
||||||
{
|
{
|
||||||
MdirClient *mc;
|
MdirClient *mc;
|
||||||
|
|
||||||
mc = data;
|
mc = data;
|
||||||
if (!mc) return;
|
if (!mc)
|
||||||
|
return;
|
||||||
|
|
||||||
mc->config->num_total = _mail_mdir_get_files (mc->config->cur_path);
|
mc->config->num_total = _mail_mdir_get_files (mc->config->cur_path);
|
||||||
mc->config->num_new = _mail_mdir_get_files (mc->config->new_path);
|
mc->config->num_new = _mail_mdir_get_files (mc->config->new_path);
|
||||||
|
|
||||||
_mail_set_text (mc->data);
|
_mail_set_text (mc->data);
|
||||||
if ((mc->config->num_new > 0) && (mc->config->use_exec) && (mc->config->exec))
|
if ((mc->config->num_new > 0) && (mc->config->use_exec)
|
||||||
|
&& (mc->config->exec))
|
||||||
_mail_start_exe (mc->config);
|
_mail_start_exe (mc->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +103,8 @@ _mail_mdir_get_files(const char *path)
|
||||||
ecore_list_goto_first (l);
|
ecore_list_goto_first (l);
|
||||||
while ((item = (char *) ecore_list_next (l)) != NULL)
|
while ((item = (char *) ecore_list_next (l)) != NULL)
|
||||||
{
|
{
|
||||||
if ((!strcmp(item, ".")) || (!strcmp(item, ".."))) continue;
|
if ((!strcmp (item, ".")) || (!strcmp (item, "..")))
|
||||||
|
continue;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
ecore_list_destroy (l);
|
ecore_list_destroy (l);
|
||||||
|
|
91
pop.c
91
pop.c
|
@ -19,27 +19,37 @@ _mail_pop_check_mail(void *data)
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
|
|
||||||
inst = data;
|
inst = data;
|
||||||
if (!inst) return;
|
if (!inst)
|
||||||
|
return;
|
||||||
|
|
||||||
for (l = pclients; l; l = l->next)
|
for (l = pclients; l; l = l->next)
|
||||||
{
|
{
|
||||||
PopClient *pc;
|
PopClient *pc;
|
||||||
|
|
||||||
pc = l->data;
|
pc = l->data;
|
||||||
if (!pc) continue;
|
if (!pc)
|
||||||
|
continue;
|
||||||
pc->data = inst;
|
pc->data = inst;
|
||||||
if (!pc->server)
|
if (!pc->server)
|
||||||
{
|
{
|
||||||
if (!pc->add_handler)
|
if (!pc->add_handler)
|
||||||
pc->add_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, _mail_pop_server_add, NULL);
|
pc->add_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_ADD,
|
||||||
|
_mail_pop_server_add, NULL);
|
||||||
if (!pc->del_handler)
|
if (!pc->del_handler)
|
||||||
pc->del_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, _mail_pop_server_del, NULL);
|
pc->del_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DEL,
|
||||||
|
_mail_pop_server_del, NULL);
|
||||||
if (!pc->data_handler)
|
if (!pc->data_handler)
|
||||||
pc->data_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, _mail_pop_server_data, NULL);
|
pc->data_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA,
|
||||||
|
_mail_pop_server_data, NULL);
|
||||||
|
|
||||||
if ((ecore_con_ssl_available_get ()) && (pc->config->ssl))
|
if ((ecore_con_ssl_available_get ()) && (pc->config->ssl))
|
||||||
type |= ECORE_CON_USE_SSL;
|
type |= ECORE_CON_USE_SSL;
|
||||||
pc->server = ecore_con_server_connect(type, pc->config->host, pc->config->port, pc);
|
pc->server =
|
||||||
|
ecore_con_server_connect (type, pc->config->host,
|
||||||
|
pc->config->port, pc);
|
||||||
pc->state = POP_STATE_DISCONNECTED;
|
pc->state = POP_STATE_DISCONNECTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +62,8 @@ _mail_pop_add_mailbox(void *data)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = data;
|
cb = data;
|
||||||
if (!cb) return;
|
if (!cb)
|
||||||
|
return;
|
||||||
pc = _mail_pop_client_get (cb);
|
pc = _mail_pop_client_get (cb);
|
||||||
pc->config->num_new = 0;
|
pc->config->num_new = 0;
|
||||||
pc->config->num_total = 0;
|
pc->config->num_total = 0;
|
||||||
|
@ -66,7 +77,8 @@ _mail_pop_del_mailbox(void *data)
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
|
||||||
cb = data;
|
cb = data;
|
||||||
if (!cb) return;
|
if (!cb)
|
||||||
|
return;
|
||||||
pc = _mail_pop_client_get (cb);
|
pc = _mail_pop_client_get (cb);
|
||||||
if (pc->server)
|
if (pc->server)
|
||||||
_mail_pop_client_quit (pc);
|
_mail_pop_client_quit (pc);
|
||||||
|
@ -82,14 +94,16 @@ _mail_pop_del_mailbox(void *data)
|
||||||
void
|
void
|
||||||
_mail_pop_shutdown ()
|
_mail_pop_shutdown ()
|
||||||
{
|
{
|
||||||
if (!pclients) return;
|
if (!pclients)
|
||||||
|
return;
|
||||||
|
|
||||||
while (pclients)
|
while (pclients)
|
||||||
{
|
{
|
||||||
PopClient *pc;
|
PopClient *pc;
|
||||||
|
|
||||||
pc = pclients->data;
|
pc = pclients->data;
|
||||||
if (!pc) continue;
|
if (!pc)
|
||||||
|
continue;
|
||||||
if (pc->server)
|
if (pc->server)
|
||||||
_mail_pop_client_quit (pc);
|
_mail_pop_client_quit (pc);
|
||||||
if (pc->add_handler)
|
if (pc->add_handler)
|
||||||
|
@ -112,7 +126,8 @@ _mail_pop_server_add(void *data, int type, void *event)
|
||||||
PopClient *pc;
|
PopClient *pc;
|
||||||
|
|
||||||
pc = _mail_pop_client_get_from_server (ev->server);
|
pc = _mail_pop_client_get_from_server (ev->server);
|
||||||
if (!pc) return 1;
|
if (!pc)
|
||||||
|
return 1;
|
||||||
|
|
||||||
pc->state = POP_STATE_CONNECTED;
|
pc->state = POP_STATE_CONNECTED;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -125,7 +140,8 @@ _mail_pop_server_del(void *data, int type, void *event)
|
||||||
PopClient *pc;
|
PopClient *pc;
|
||||||
|
|
||||||
pc = _mail_pop_client_get_from_server (ev->server);
|
pc = _mail_pop_client_get_from_server (ev->server);
|
||||||
if (!pc) return 1;
|
if (!pc)
|
||||||
|
return 1;
|
||||||
|
|
||||||
if (pc->state == POP_STATE_DISCONNECTED)
|
if (pc->state == POP_STATE_DISCONNECTED)
|
||||||
printf ("Pop Server Disconnected\n");
|
printf ("Pop Server Disconnected\n");
|
||||||
|
@ -146,8 +162,10 @@ _mail_pop_server_data(void *data, int type, void *event)
|
||||||
int len, num = 0, total = 0;
|
int len, num = 0, total = 0;
|
||||||
|
|
||||||
pc = _mail_pop_client_get_from_server (ev->server);
|
pc = _mail_pop_client_get_from_server (ev->server);
|
||||||
if (!pc) return 1;
|
if (!pc)
|
||||||
if (pc->state == POP_STATE_DISCONNECTED) return 1;
|
return 1;
|
||||||
|
if (pc->state == POP_STATE_DISCONNECTED)
|
||||||
|
return 1;
|
||||||
|
|
||||||
len = sizeof (in) - 1;
|
len = sizeof (in) - 1;
|
||||||
len = (((len) > (ev->size)) ? ev->size : len);
|
len = (((len) > (ev->size)) ? ev->size : len);
|
||||||
|
@ -207,7 +225,8 @@ _mail_pop_client_get(void *data)
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
cb = data;
|
cb = data;
|
||||||
if (!cb) return NULL;
|
if (!cb)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if ((!pclients) || (evas_list_count (pclients) <= 0))
|
if ((!pclients) || (evas_list_count (pclients) <= 0))
|
||||||
{
|
{
|
||||||
|
@ -216,18 +235,26 @@ _mail_pop_client_get(void *data)
|
||||||
pc->state = POP_STATE_DISCONNECTED;
|
pc->state = POP_STATE_DISCONNECTED;
|
||||||
pc->config = cb;
|
pc->config = cb;
|
||||||
if (!pc->add_handler)
|
if (!pc->add_handler)
|
||||||
pc->add_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, _mail_pop_server_add, NULL);
|
pc->add_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_ADD,
|
||||||
|
_mail_pop_server_add, NULL);
|
||||||
if (!pc->del_handler)
|
if (!pc->del_handler)
|
||||||
pc->del_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, _mail_pop_server_del, NULL);
|
pc->del_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DEL,
|
||||||
|
_mail_pop_server_del, NULL);
|
||||||
if (!pc->data_handler)
|
if (!pc->data_handler)
|
||||||
pc->data_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, _mail_pop_server_data, NULL);
|
pc->data_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA,
|
||||||
|
_mail_pop_server_data, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (l = pclients; l; l = l->next)
|
for (l = pclients; l; l = l->next)
|
||||||
{
|
{
|
||||||
pc = l->data;
|
pc = l->data;
|
||||||
if (!pc) continue;
|
if (!pc)
|
||||||
if (!pc->config) continue;
|
continue;
|
||||||
|
if (!pc->config)
|
||||||
|
continue;
|
||||||
if ((!strcmp (pc->config->host, cb->host)) &&
|
if ((!strcmp (pc->config->host, cb->host)) &&
|
||||||
(!strcmp (pc->config->user, cb->user)) &&
|
(!strcmp (pc->config->user, cb->user)) &&
|
||||||
(!strcmp (pc->config->pass, cb->pass)))
|
(!strcmp (pc->config->pass, cb->pass)))
|
||||||
|
@ -243,11 +270,17 @@ _mail_pop_client_get(void *data)
|
||||||
pc->state = POP_STATE_DISCONNECTED;
|
pc->state = POP_STATE_DISCONNECTED;
|
||||||
pc->config = cb;
|
pc->config = cb;
|
||||||
if (!pc->add_handler)
|
if (!pc->add_handler)
|
||||||
pc->add_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, _mail_pop_server_add, NULL);
|
pc->add_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_ADD,
|
||||||
|
_mail_pop_server_add, NULL);
|
||||||
if (!pc->del_handler)
|
if (!pc->del_handler)
|
||||||
pc->del_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, _mail_pop_server_del, NULL);
|
pc->del_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DEL,
|
||||||
|
_mail_pop_server_del, NULL);
|
||||||
if (!pc->data_handler)
|
if (!pc->data_handler)
|
||||||
pc->data_handler = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, _mail_pop_server_data, NULL);
|
pc->data_handler =
|
||||||
|
ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA,
|
||||||
|
_mail_pop_server_data, NULL);
|
||||||
}
|
}
|
||||||
return pc;
|
return pc;
|
||||||
}
|
}
|
||||||
|
@ -258,14 +291,17 @@ _mail_pop_client_get_from_server(void *data)
|
||||||
Ecore_Con_Server *server = data;
|
Ecore_Con_Server *server = data;
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
|
|
||||||
if (!pclients) return NULL;
|
if (!pclients)
|
||||||
|
return NULL;
|
||||||
for (l = pclients; l; l = l->next)
|
for (l = pclients; l; l = l->next)
|
||||||
{
|
{
|
||||||
PopClient *pc;
|
PopClient *pc;
|
||||||
|
|
||||||
pc = l->data;
|
pc = l->data;
|
||||||
if (!pc) continue;
|
if (!pc)
|
||||||
if (!pc->server) continue;
|
continue;
|
||||||
|
if (!pc->server)
|
||||||
|
continue;
|
||||||
if (pc->server == server)
|
if (pc->server == server)
|
||||||
return pc;
|
return pc;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +316,8 @@ _mail_pop_client_quit(void *data)
|
||||||
char out[1024];
|
char out[1024];
|
||||||
|
|
||||||
pc = data;
|
pc = data;
|
||||||
if (!pc) return;
|
if (!pc)
|
||||||
|
return;
|
||||||
if (pc->state >= POP_STATE_CONNECTED)
|
if (pc->state >= POP_STATE_CONNECTED)
|
||||||
{
|
{
|
||||||
len = snprintf (out, sizeof (out), "QUIT\r\n");
|
len = snprintf (out, sizeof (out), "QUIT\r\n");
|
||||||
|
|
Loading…
Reference in New Issue