Use the user settings to control the imap internal timer.
SVN revision: 30433
This commit is contained in:
parent
abdc73b82e
commit
c1cd2c995d
|
@ -277,11 +277,12 @@ _basic_apply_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
|
|||
if (!cb)
|
||||
{
|
||||
cb = E_NEW (Config_Box, 1);
|
||||
cb->item = mail_ci;
|
||||
cb->type = 0;
|
||||
cb->port = 110;
|
||||
cb->monitor = 1;
|
||||
cb->ssl = 0;
|
||||
cb->local = 0;
|
||||
cb->local = 0;
|
||||
is_new = 1;
|
||||
}
|
||||
|
||||
|
@ -296,7 +297,7 @@ _basic_apply_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
|
|||
cb->port = atoi (cfdata->port);
|
||||
cb->monitor = cfdata->monitor;
|
||||
cb->ssl = cfdata->ssl;
|
||||
cb->local = cfdata->local;
|
||||
cb->local = cfdata->local;
|
||||
|
||||
cb->use_exec = cfdata->use_exec;
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ _gc_init (E_Gadcon * gc, const char *name, const char *id, const char *style)
|
|||
Config_Box *cb;
|
||||
|
||||
cb = l->data;
|
||||
cb->item = ci;
|
||||
switch (cb->type)
|
||||
{
|
||||
case MAIL_TYPE_IMAP:
|
||||
|
|
|
@ -58,6 +58,7 @@ struct _Config_Item
|
|||
struct _Config_Box
|
||||
{
|
||||
const char *name;
|
||||
Config_Item *item;
|
||||
|
||||
int type;
|
||||
int port;
|
||||
|
|
33
imap2.c
33
imap2.c
|
@ -52,13 +52,17 @@ _mail_imap_check_mail (void *data)
|
|||
if (ecore_con_ssl_available_get () && (ic->config->ssl))
|
||||
type |= ECORE_CON_USE_SSL;
|
||||
ic->state = IMAP_STATE_DISCONNECTED;
|
||||
printf ("Connect: %s %d %d\n", ic->config->host, ic->config->port, ic->config->ssl);
|
||||
ic->server =
|
||||
ecore_con_server_connect (type, ic->config->host,
|
||||
ic->config->port, NULL);
|
||||
ic->cmd = 1;
|
||||
ic->idle = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Need to set this to revert the state of the icon */
|
||||
_mail_set_text (ic->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,13 +192,16 @@ _mail_imap_server_del (void *data, int type, void *event)
|
|||
if (!ic)
|
||||
return 1;
|
||||
|
||||
if (ic->state == IMAP_STATE_DISCONNECTED)
|
||||
printf ("Imap Server Disconnected\n");
|
||||
else
|
||||
ic->state = IMAP_STATE_DISCONNECTED;
|
||||
if (ic->state != IMAP_STATE_DISCONNECTED)
|
||||
{
|
||||
printf ("The Imap Server disconnected us, consider reducing the check time.\n");
|
||||
ic->state = IMAP_STATE_DISCONNECTED;
|
||||
}
|
||||
|
||||
ecore_con_server_del (ic->server);
|
||||
ic->server = NULL;
|
||||
if (ic->timer) ecore_timer_del (ic->timer);
|
||||
ic->timer = NULL;
|
||||
|
||||
_mail_set_text (ic->data);
|
||||
return 0;
|
||||
|
@ -234,16 +241,16 @@ _mail_imap_server_data (void *data, int type, void *event)
|
|||
else
|
||||
{
|
||||
printf ("Imap Failure: Couldn't find eol\n");
|
||||
_mail_imap_client_logout (ic);
|
||||
return 0;
|
||||
}
|
||||
printf ("Server data |%s|\n", p);
|
||||
/* parse data */
|
||||
if (!_mail_imap_server_data_parse (ic, p, pp - p))
|
||||
{
|
||||
_mail_imap_client_logout (ic);
|
||||
return 0;
|
||||
}
|
||||
/* cleanup */
|
||||
/* next */
|
||||
p = pp + 2;
|
||||
}
|
||||
|
||||
|
@ -281,12 +288,14 @@ _mail_imap_server_data (void *data, int type, void *event)
|
|||
{
|
||||
len = snprintf (out, sizeof (out), "A%04i IDLE\r\n", ic->cmd++);
|
||||
ecore_con_server_send (ic->server, out, len);
|
||||
ic->timer = ecore_timer_add (29 * 60.0, _mail_imap_server_idle, ic);
|
||||
ic->timer = ecore_timer_add (ic->config->item->check_time * 60.0,
|
||||
_mail_imap_server_idle, ic);
|
||||
}
|
||||
}
|
||||
else if (ic->idle == 0)
|
||||
{
|
||||
if (!ic->timer) ic->timer = ecore_timer_add (5 * 60.0, _mail_imap_server_noop, ic);
|
||||
if (!ic->timer) ic->timer = ecore_timer_add (ic->config->item->check_time * 60.0,
|
||||
_mail_imap_server_noop, ic);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -385,6 +394,10 @@ _mail_imap_server_data_parse (ImapClient *ic, char *line, int length)
|
|||
{
|
||||
printf ("Result OK: %s\n", value);
|
||||
}
|
||||
else if (!strcmp (result, "FLAGS"))
|
||||
{
|
||||
printf ("Flags: %s\n", value);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *p;
|
||||
|
@ -486,7 +499,7 @@ _mail_imap_client_logout (ImapClient *ic)
|
|||
ecore_con_server_del (ic->server);
|
||||
}
|
||||
ic->server = NULL;
|
||||
if (ic->timer) ecore_timer_del(ic->timer);
|
||||
if (ic->timer) ecore_timer_del (ic->timer);
|
||||
ic->timer = NULL;
|
||||
ic->state = IMAP_STATE_DISCONNECTED;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue