Nikolas Arend wrote: > Hm, doesn't this list accept plain text attachments? I send them again, > this time included in the message text. Let's see... > > > Hi all, > > attached please find two patches for the mail module against current cvs. > The patches are mutually exclusive. One (mail_small.patch) just fixes an > issue in mbox.c and adds support for parsing Thunderbird/Mozilla style > mbox files. Besides that it only replaces one c++ style comment by its c > counterpart in e_mod_config_box.c (some c compilers don't like that). > > > The other (mail.patch) is a bit more extensive. Besides the things just > mentioned, it also adds a checkbox to the config dialog (maybe not > ideally placed atm) by which one can choose whether the mbox file should > be monitored permanently (via an ecore_file_monitor), or just checked > manually or at every check interval (like pop3 accounts). > > Please let me know what you think, it works fine here. One issue I have, > though: everything is ok for the first mbox account I add. I can enable > and disable the permanent/non-permanent checking feature, all fine. But > thinks don't work as expected for the next mbox account. The settings > don't seem to get applied properly, although they are obviously stored. > I don't see why. I'm non sure it's an issue with my patch, maybe someone > can look into it. > > Please let me know when there are any problems with applying the patches. > > > Cheers, Nick. > > > > ### mail_small.patch > > diff -ur mail/e_mod_config_box.c mail-merged_files/e_mod_config_box.c > --- mail/e_mod_config_box.c 2006-09-16 17:14:45.000000000 +0200 > +++ mail-merged_files/e_mod_config_box.c 2006-09-16 > 17:16:01.000000000 +0200 > @@ -322,7 +322,7 @@ > > if (is_new) > { > -// cfd->data = cb; > +/* cfd->data = cb; */ > mail_ci->boxes = evas_list_append (mail_ci->boxes, cb); > e_config_save_queue (); > _mail_box_added (mail_ci->id, cb->name); > > diff -ur mail/mbox.c mail-merged_files/mbox.c > --- mail/mbox.c 2006-09-16 17:14:45.000000000 +0200 > +++ mail-merged_files/mbox.c 2006-09-16 17:16:01.000000000 +0200 > @@ -23,7 +23,7 @@ > mb->config->num_new = 0; > mb->config->num_total = 0; > mb->monitor = > - ecore_file_monitor_add (cb->new_path, _mail_mbox_check_mail, mb); > + ecore_file_monitor_add (mb->config->new_path, > _mail_mbox_check_mail, mb); > > mboxes = evas_list_append (mboxes, mb); > } > @@ -110,9 +110,15 @@ > mb->config->num_total++; > mb->config->num_new++; > } > - else if ((header) && (!strncmp (buf, "Status: ", 7)) > - && (strchr (buf, 'R'))) > - mb->config->num_new--; > + else if (header) > + { > + if ((!strncmp (buf, "Status: ", 8)) && (strchr (buf, 'R'))) > + mb->config->num_new--; > + > + /* Support for Mozilla/Thunderbird mbox format */ > + else if ((!strncmp (buf, "X-Mozilla-Status: ", 18)) && > (!strstr (buf, "0000"))) > + mb->config->num_new--; > + } > } > fclose (f); > > > > > ### mail.patch: > > diff -ur mail/e_mod_config_box.c mail-merged_files/e_mod_config_box.c > --- mail/e_mod_config_box.c 2006-09-16 18:44:54.000000000 +0200 > +++ mail-merged_files/e_mod_config_box.c 2006-09-16 > 18:44:11.000000000 +0200 > @@ -7,6 +7,7 @@ > int type; > int use_exec; > char *port; > + int monitor; > int ssl; > int local; > char *host; > @@ -24,6 +25,7 @@ > Evas_Object *new_path_entry; > Evas_Object *cur_path_label; > Evas_Object *cur_path_entry; > + Evas_Object *monitor_check; > }; > > static void *_create_data (E_Config_Dialog * cfd); > @@ -34,6 +36,7 @@ > E_Config_Dialog_Data * cfdata); > static void _type_cb_change (void *data, Evas_Object * obj); > static void _use_exec_cb_change (void *data, Evas_Object * obj); > +static void _monitor_cb_change (void *data, Evas_Object * obj); > > static E_Config_Dialog *prev_dlg; > static Config_Item *mail_ci; > @@ -69,6 +72,7 @@ > if (!cb) > { > cfdata->type = 0; > + cfdata->monitor = 1; > cfdata->ssl = 0; > cfdata->use_exec = 0; > cfdata->local = 0; > @@ -81,6 +85,7 @@ > cfdata->name = strdup (cb->name); > > cfdata->type = cb->type; > + cfdata->monitor = cb->monitor; > cfdata->ssl = cb->ssl; > cfdata->use_exec = cb->use_exec; > cfdata->local = cb->local; > @@ -170,8 +175,23 @@ > e_widget_framelist_object_append (of, ob); > ob = e_widget_radio_add (evas, D_("Mbox"), 3, rg); > e_widget_on_change_hook_set (ob, _type_cb_change, cfdata); > - e_widget_framelist_object_append (of, ob); > - e_widget_list_object_append (o, of, 1, 1, 0.5); > + e_widget_framelist_object_append (of, ob); > + cfdata->monitor_check = e_widget_check_add (evas, D_("Monitor Mbox > file permanently"), > + &(cfdata->monitor)); > + e_widget_on_change_hook_set (cfdata->monitor_check, > _monitor_cb_change, cfdata); > + if (cfdata->type == 3) > + { > + e_widget_check_checked_set (cfdata->monitor_check, cfdata->monitor); > + e_widget_disabled_set (cfdata->monitor_check, 0); > + } > + else > + { > + e_widget_check_checked_set (cfdata->monitor_check, 0); > + e_widget_disabled_set (cfdata->monitor_check, 1); > + } > + e_widget_framelist_object_append (of, cfdata->monitor_check); > + > + e_widget_list_object_append (o, of, 1, 1, 0.5); > > of = e_widget_frametable_add (evas, D_("Port Settings"), 1); > > @@ -257,6 +277,7 @@ > cb = E_NEW (Config_Box, 1); > cb->type = 0; > cb->port = 110; > + cb->monitor = 1; > cb->ssl = 0; > cb->local = 0; > is_new = 1; > @@ -271,10 +292,12 @@ > > cb->type = cfdata->type; > cb->port = atoi (cfdata->port); > + cb->monitor = cfdata->monitor; > cb->ssl = cfdata->ssl; > cb->local = cfdata->local; > > cb->use_exec = cfdata->use_exec; > + > if (cb->exec) > evas_stringshare_del (cb->exec); > if (cfdata->exec != NULL) > @@ -318,11 +341,14 @@ > cb->cur_path = evas_stringshare_add (""); > > if (!is_new) > - e_config_save_queue (); > + { > + e_config_save_queue (); > + _mail_mbox_check_monitors (); > + } > > if (is_new) > { > -// cfd->data = cb; > +/* cfd->data = cb; */ > mail_ci->boxes = evas_list_append (mail_ci->boxes, cb); > e_config_save_queue (); > _mail_box_added (mail_ci->id, cb->name); > @@ -333,6 +359,17 @@ > } > > static void > +_monitor_cb_change (void *data, Evas_Object * obj) > +{ > + E_Config_Dialog_Data *cfdata; > + > + cfdata = data; > + if (cfdata->type == MAIL_TYPE_MBOX) > + { > + } > +} > + > +static void > _type_cb_change (void *data, Evas_Object * obj) > { > E_Config_Dialog_Data *cfdata; > @@ -384,6 +421,17 @@ > e_widget_disabled_set (cfdata->cur_path_entry, 0); > e_widget_entry_text_set (cfdata->port_entry, ""); > } > + > + if (cfdata->type == 3) > + { > + e_widget_check_checked_set (cfdata->monitor_check, 1); > + e_widget_disabled_set (cfdata->monitor_check, 0); > + } > + else > + { > + e_widget_check_checked_set (cfdata->monitor_check, 0); > + e_widget_disabled_set (cfdata->monitor_check, 1); > + } > } > > static void > diff -ur mail/e_mod_main.c mail-merged_files/e_mod_main.c > --- mail/e_mod_main.c 2006-09-16 18:44:54.000000000 +0200 > +++ mail-merged_files/e_mod_main.c 2006-09-16 17:45:22.000000000 +0200 > @@ -71,7 +71,7 @@ > Mail *mail; > Config_Item *ci; > Evas_List *l, *j; > - int have_pop = 0, have_imap = 0; > + int have_pop = 0, have_imap = 0, have_mbox = 0; > > inst = E_NEW (Instance, 1); > ci = _mail_config_item_get (id); > @@ -132,7 +132,12 @@ > _mail_mdir_add_mailbox (inst, cb); > break; > case MAIL_TYPE_MBOX: > + have_mbox = 1; > _mail_mbox_add_mailbox (inst, cb); > + if (!inst->check_timer) > + inst->check_timer = > + ecore_timer_add ((ci->check_time * 60.0), _mail_cb_check, > + inst); > break; > } > } > @@ -140,6 +145,8 @@ > _mail_pop_check_mail (inst); > if (have_imap) > _mail_imap_check_mail (inst); > + if (have_mbox) > + _mail_mbox_check_mail (inst); > } > return gcc; > } > @@ -356,6 +363,7 @@ > E_CONFIG_VAL (D, T, name, STR); > E_CONFIG_VAL (D, T, type, INT); > E_CONFIG_VAL (D, T, port, INT); > + E_CONFIG_VAL (D, T, monitor, UCHAR); > E_CONFIG_VAL (D, T, ssl, UCHAR); > E_CONFIG_VAL (D, T, local, UCHAR); > E_CONFIG_VAL (D, T, host, STR); > @@ -543,7 +551,7 @@ > Instance *inst = data; > Config_Item *ci; > Evas_List *l; > - int have_imap = 0, have_pop = 0; > + int have_imap = 0, have_pop = 0, have_mbox = 0; > > if (!inst) > return 1; > @@ -564,6 +572,7 @@ > case MAIL_TYPE_MDIR: > break; > case MAIL_TYPE_MBOX: > + have_mbox = 1; > break; > case MAIL_TYPE_POP: > have_pop = 1; > @@ -574,13 +583,15 @@ > } > } > > - if ((have_imap) || (have_pop)) > + if ((have_imap) || (have_pop) || (have_mbox)) > edje_object_signal_emit (inst->mail->mail_obj, "check_mail", ""); > > if (have_imap) > _mail_imap_check_mail (inst); > if (have_pop) > - _mail_pop_check_mail (inst); > + _mail_pop_check_mail (inst); > + if (have_mbox) > + _mail_mbox_check_mail (inst); > return 1; > } > > diff -ur mail/e_mod_main.h mail-merged_files/e_mod_main.h > --- mail/e_mod_main.h 2006-09-16 18:44:54.000000000 +0200 > +++ mail-merged_files/e_mod_main.h 2006-09-16 17:45:22.000000000 +0200 > @@ -60,6 +60,7 @@ > int port; > unsigned char local; > unsigned char ssl; > + unsigned char monitor; > const char *host; > const char *user; > const char *pass; > diff -ur mail/mbox.c mail-merged_files/mbox.c > --- mail/mbox.c 2006-09-16 18:44:54.000000000 +0200 > +++ mail-merged_files/mbox.c 2006-09-16 17:45:21.000000000 +0200 > @@ -4,8 +4,9 @@ > > 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_parser (Config_Box *cb); > +static void _mail_mbox_check_mail_monitor (void *data, > Ecore_File_Monitor * monitor, > + Ecore_File_Event event, const > char *path); > > void > _mail_mbox_add_mailbox (void *data, void *data2) > @@ -22,13 +23,46 @@ > mb->data = data; > mb->config->num_new = 0; > mb->config->num_total = 0; > - mb->monitor = > - ecore_file_monitor_add (cb->new_path, _mail_mbox_check_mail, mb); > + > + if (mb->config->monitor) > + mb->monitor = > + ecore_file_monitor_add (mb->config->new_path, > _mail_mbox_check_mail_monitor, mb); > > mboxes = evas_list_append (mboxes, mb); > } > > void > +_mail_mbox_check_monitors () > +{ > + Evas_List *l; > + > + for (l = mboxes; l; l = l->next) > + { > + MboxClient *mb; > + > + mb = l->data; > + if (!mb) > + continue; > + > + if (mb->config->monitor) > + { > + if (!mb->monitor) > + mb->monitor = > + ecore_file_monitor_add (mb->config->new_path, > _mail_mbox_check_mail_monitor, mb); > + } > + else > + { > + if (mb->monitor) > + { > + ecore_file_monitor_del (mb->monitor); > + } > + mb->monitor = NULL; > + } > + break; > + } > +} > + > +void > _mail_mbox_del_mailbox (void *data) > { > Config_Box *cb; > @@ -73,16 +107,51 @@ > } > } > > +void _mail_mbox_check_mail (void *data) > +{ > + Evas_List *l; > + Instance *inst; > + int num_new_prev; > + > + inst = data; > + if (!inst) > + return; > + > + for (l = mboxes; l; l = l->next) > + { > + MboxClient *mb; > + Config_Box *cb; > + > + mb = l->data; > + if (!mb) > + continue; > + mb->data = inst; > + > + cb = mb->config; > + if (!cb) > + continue; > + > + num_new_prev = cb->num_new; > + _mail_mbox_check_mail_parser(cb); > + > + /* Only launch the program if the number of new mails increased. > + This is hacky but better than launching it every time there's > + unread/new mail imho */ > + > + _mail_set_text (mb->data); > + if ((mb->config->num_new > 0) && (mb->config->num_new > num_new_prev) > + && (mb->config->use_exec) && (mb->config->exec)) > + _mail_start_exe (mb->config); > + } > +} > + > /* PRIVATES */ > static void > -_mail_mbox_check_mail (void *data, Ecore_File_Monitor * monitor, > - Ecore_File_Event event, const char *path) > +_mail_mbox_check_mail_monitor (void *data, Ecore_File_Monitor * monitor, > + Ecore_File_Event event, const char *path) > { > MboxClient *mb; > Config_Box *cb; > - FILE *f; > - char buf[1024]; > - int header; > > mb = data; > if (!mb) > @@ -91,33 +160,49 @@ > cb = mb->config; > if (!cb) > return; > + > + _mail_mbox_check_mail_parser(cb); > + > + _mail_set_text (mb->data); > + if ((mb->config->num_new > 0) && (mb->config->use_exec) > + && (mb->config->exec)) > + _mail_start_exe (mb->config); > +} > + > +static void > +_mail_mbox_check_mail_parser (Config_Box *cb) > +{ > + FILE *f; > + int header; > + char buf[1024]; > + > if (!cb->new_path) > return; > > if (!(f = fopen (cb->new_path, "r"))) > - return; > + return; > > - mb->config->num_new = 0; > - mb->config->num_total = 0; > + cb->num_new = 0; > + cb->num_total = 0; > > while (fgets (buf, sizeof (buf), f)) > { > if (buf[0] == '\n') > - header = 0; > + header = 0; > else if (!strncmp (buf, "From ", 5)) > { > header = 1; > - mb->config->num_total++; > - mb->config->num_new++; > + cb->num_total++; > + cb->num_new++; > + } > + else if (header) > + { > + if ((!strncmp (buf, "Status: ", 8)) && (strchr (buf, 'R'))) > + cb->num_new--; > + /* Support for Mozilla/Thunderbird mbox format */ > + else if ((!strncmp (buf, "X-Mozilla-Status: ", 18)) && > (!strstr (buf, "0000"))) > + cb->num_new--; > } > - else if ((header) && (!strncmp (buf, "Status: ", 7)) > - && (strchr (buf, 'R'))) > - mb->config->num_new--; > } > fclose (f); > - > - _mail_set_text (mb->data); > - if ((mb->config->num_new > 0) && (mb->config->use_exec) > - && (mb->config->exec)) > - _mail_start_exe (mb->config); > } > diff -ur mail/mbox.h mail-merged_files/mbox.h > --- mail/mbox.h 2006-09-16 18:44:54.000000000 +0200 > +++ mail-merged_files/mbox.h 2006-09-16 17:45:21.000000000 +0200 > @@ -16,5 +16,6 @@ > void _mail_mbox_add_mailbox(void *data, void *data2); > void _mail_mbox_del_mailbox(void *data); > void _mail_mbox_shutdown(); > - > +void _mail_mbox_check_mail(void *data); > +void _mail_mbox_check_monitors (); > #endif > > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel >
Sounds great :) Can you actually attach the patches tho? :) When I save attachments, all I get is the tomcat message :) Cheers, devilhorns ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel