Icon and label should now properly reflect new mail count from all mailboxes.
HandyAndE, let me know if your imap works with this or not. SVN revision: 23417
This commit is contained in:
parent
cdf33fb4be
commit
a1c10b64ef
|
@ -244,8 +244,8 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
cb->port = 110;
|
cb->port = 110;
|
||||||
cb->ssl = 0;
|
cb->ssl = 0;
|
||||||
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);
|
||||||
|
@ -291,14 +291,13 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
cb->cur_path = evas_stringshare_add(cfdata->cur_path);
|
cb->cur_path = evas_stringshare_add(cfdata->cur_path);
|
||||||
else
|
else
|
||||||
cb->cur_path = evas_stringshare_add("");
|
cb->cur_path = evas_stringshare_add("");
|
||||||
|
|
||||||
e_config_save_queue();
|
|
||||||
|
|
||||||
_mail_box_config_updated(prev_dlg);
|
if (!is_new)
|
||||||
|
e_config_save_queue();
|
||||||
|
|
||||||
if (is_new)
|
if (is_new)
|
||||||
{
|
{
|
||||||
cfd->data = cb;
|
// cfd->data = cb;
|
||||||
mail_ci->boxes = evas_list_append(mail_ci->boxes, cb);
|
mail_ci->boxes = evas_list_append(mail_ci->boxes, cb);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
_mail_box_added(mail_ci->id, cb->name);
|
_mail_box_added(mail_ci->id, cb->name);
|
||||||
|
|
25
e_mod_main.c
25
e_mod_main.c
|
@ -7,7 +7,7 @@
|
||||||
* it under the terms of version 2 of the GNU General Public License as
|
* it under the terms of version 2 of the GNU General Public License as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it cwill be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -487,7 +487,6 @@ _mail_cb_check(void *data)
|
||||||
int have_imap = 0, have_pop = 0;
|
int have_imap = 0, have_pop = 0;
|
||||||
|
|
||||||
if (!inst) return 1;
|
if (!inst) return 1;
|
||||||
inst->count = 0;
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -520,13 +519,29 @@ void
|
||||||
_mail_set_text(void *data)
|
_mail_set_text(void *data)
|
||||||
{
|
{
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
|
Config_Item *ci;
|
||||||
|
Evas_List *l;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
if (!inst) return;
|
if (!inst) return;
|
||||||
|
|
||||||
if (inst->count > 0)
|
ci = _mail_config_item_get(inst->gcc->id);
|
||||||
|
if (!ci) return;
|
||||||
|
for (l = ci->boxes; l; l = l->next)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%d", inst->count);
|
Config_Box *cb;
|
||||||
|
|
||||||
|
cb = l->data;
|
||||||
|
if (!cb) continue;
|
||||||
|
count += cb->num_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Count: %i\n", count);
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%d", count);
|
||||||
edje_object_part_text_set(inst->mail->mail_obj, "new_label", buf);
|
edje_object_part_text_set(inst->mail->mail_obj, "new_label", buf);
|
||||||
edje_object_signal_emit(inst->mail->mail_obj, "new_mail", "");
|
edje_object_signal_emit(inst->mail->mail_obj, "new_mail", "");
|
||||||
}
|
}
|
||||||
|
|
9
imap.c
9
imap.c
|
@ -182,7 +182,6 @@ _mail_imap_server_del(void *data, int type, void *event)
|
||||||
{
|
{
|
||||||
Ecore_Con_Event_Server_Del *ev = event;
|
Ecore_Con_Event_Server_Del *ev = event;
|
||||||
ImapServer *is;
|
ImapServer *is;
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
is = _mail_imap_server_get(ev->server);
|
is = _mail_imap_server_get(ev->server);
|
||||||
if (!is) return 1;
|
if (!is) return 1;
|
||||||
|
@ -194,10 +193,6 @@ _mail_imap_server_del(void *data, int type, void *event)
|
||||||
|
|
||||||
ecore_con_server_del(is->server);
|
ecore_con_server_del(is->server);
|
||||||
is->server = NULL;
|
is->server = NULL;
|
||||||
|
|
||||||
inst = is->data;
|
|
||||||
inst->count += is->count;
|
|
||||||
_mail_set_text(inst);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +203,6 @@ _mail_imap_server_data(void *data, int type, void *event)
|
||||||
Ecore_Con_Event_Server_Data *ev = event;
|
Ecore_Con_Event_Server_Data *ev = event;
|
||||||
ImapServer *is;
|
ImapServer *is;
|
||||||
ImapClient *ic;
|
ImapClient *ic;
|
||||||
Instance *inst;
|
|
||||||
int len, num = 0, total = 0;
|
int len, num = 0, total = 0;
|
||||||
char in[1024], out[1024], *spc;
|
char in[1024], out[1024], *spc;
|
||||||
size_t slen;
|
size_t slen;
|
||||||
|
@ -256,9 +250,10 @@ _mail_imap_server_data(void *data, int type, void *event)
|
||||||
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)
|
||||||
{
|
{
|
||||||
is->count += num;
|
|
||||||
ic->config->num_new = num;
|
ic->config->num_new = num;
|
||||||
ic->config->num_total = total;
|
ic->config->num_total = total;
|
||||||
|
_mail_set_text(is->data);
|
||||||
|
|
||||||
if ((num > 0) && (ic->config->use_exec) && (ic->config->exec))
|
if ((num > 0) && (ic->config->use_exec) && (ic->config->exec))
|
||||||
_mail_start_exe(ic->config);
|
_mail_start_exe(ic->config);
|
||||||
|
|
||||||
|
|
2
imap.h
2
imap.h
|
@ -21,7 +21,7 @@ struct _ImapServer
|
||||||
Ecore_Con_Server *server;
|
Ecore_Con_Server *server;
|
||||||
Evas_List *clients;
|
Evas_List *clients;
|
||||||
ImapClient *current;
|
ImapClient *current;
|
||||||
int cmd, count;
|
int cmd;
|
||||||
ImapState state;
|
ImapState state;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
|
5
mbox.c
5
mbox.c
|
@ -74,7 +74,6 @@ _mail_mbox_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int total = 0, unread = 0;
|
int total = 0, unread = 0;
|
||||||
int header;
|
int header;
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
mb = data;
|
mb = data;
|
||||||
if (!mb) return;
|
if (!mb) return;
|
||||||
|
@ -104,9 +103,7 @@ _mail_mbox_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
inst = mb->data;
|
_mail_set_text(mb->data);
|
||||||
inst->count += mb->config->num_new;
|
|
||||||
_mail_set_text(inst);
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
5
mdir.c
5
mdir.c
|
@ -68,7 +68,6 @@ 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;
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
mc = data;
|
mc = data;
|
||||||
if (!mc) return;
|
if (!mc) return;
|
||||||
|
@ -76,9 +75,7 @@ _mail_mdir_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event
|
||||||
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);
|
||||||
|
|
||||||
inst = mc->data;
|
_mail_set_text(mc->data);
|
||||||
inst->count += mc->config->num_new;
|
|
||||||
_mail_set_text(inst);
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
5
pop.c
5
pop.c
|
@ -123,7 +123,6 @@ _mail_pop_server_del(void *data, int type, void *event)
|
||||||
{
|
{
|
||||||
Ecore_Con_Event_Server_Del *ev = event;
|
Ecore_Con_Event_Server_Del *ev = event;
|
||||||
PopClient *pc;
|
PopClient *pc;
|
||||||
Instance *inst;
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -143,7 +142,6 @@ _mail_pop_server_data(void *data, int type, void *event)
|
||||||
{
|
{
|
||||||
Ecore_Con_Event_Server_Data *ev = event;
|
Ecore_Con_Event_Server_Data *ev = event;
|
||||||
PopClient *pc;
|
PopClient *pc;
|
||||||
Instance *inst;
|
|
||||||
char in[2048], out[2048];
|
char in[2048], out[2048];
|
||||||
int len, num = 0, total = 0;
|
int len, num = 0, total = 0;
|
||||||
|
|
||||||
|
@ -151,8 +149,6 @@ _mail_pop_server_data(void *data, int type, void *event)
|
||||||
if (!pc) return 1;
|
if (!pc) return 1;
|
||||||
if (pc->state == POP_STATE_DISCONNECTED) return 1;
|
if (pc->state == POP_STATE_DISCONNECTED) return 1;
|
||||||
|
|
||||||
inst = pc->data;
|
|
||||||
|
|
||||||
len = sizeof(in) -1;
|
len = sizeof(in) -1;
|
||||||
len = (((len) > (ev->size)) ? ev->size : len);
|
len = (((len) > (ev->size)) ? ev->size : len);
|
||||||
memcpy(in, ev->data, len);
|
memcpy(in, ev->data, len);
|
||||||
|
@ -192,7 +188,6 @@ _mail_pop_server_data(void *data, int type, void *event)
|
||||||
pc->config->num_new = num;
|
pc->config->num_new = num;
|
||||||
pc->config->num_total = num;
|
pc->config->num_total = num;
|
||||||
}
|
}
|
||||||
inst->count += num;
|
|
||||||
_mail_pop_client_quit(pc);
|
_mail_pop_client_quit(pc);
|
||||||
if ((num > 0) && (pc->config->use_exec) && (pc->config->exec))
|
if ((num > 0) && (pc->config->use_exec) && (pc->config->exec))
|
||||||
_mail_start_exe(pc->config);
|
_mail_start_exe(pc->config);
|
||||||
|
|
Loading…
Reference in New Issue