void inc_pop_before_smtp(PrefsAccount *acc) { IncProgressDialog *inc_dialog; IncSession *session; MainWindow *mainwin; mainwin = mainwindow_get_mainwindow(); session = inc_session_new(acc); if (!session) return; POP3_SESSION(session->session)->pop_before_smtp = TRUE; inc_dialog = inc_progress_dialog_create(FALSE); inc_dialog->queue_list = g_list_append(inc_dialog->queue_list, session); /* FIXME: assumes to attach to first main window */ inc_dialog->mainwin = mainwin; inc_progress_dialog_set_list(inc_dialog); if (mainwin) { toolbar_main_set_sensitive(mainwin); main_window_set_menu_sensitive(mainwin); } inc_start(inc_dialog); }
static gint inc_account_mail_real(MainWindow *mainwin, PrefsAccount *account) { IncProgressDialog *inc_dialog; IncSession *session; switch (account->protocol) { case A_IMAP4: case A_NNTP: /* Melvin: bug [14] * FIXME: it should return foldeview_check_new() value. * TODO: do it when bug [19] is fixed (IMAP folder sets * an incorrect new message count) */ folderview_check_new(FOLDER(account->folder)); return 0; case A_POP3: case A_APOP: session = inc_session_new(account); if (!session) return 0; inc_dialog = inc_progress_dialog_create(FALSE); inc_dialog->queue_list = g_list_append(inc_dialog->queue_list, session); inc_dialog->mainwin = mainwin; inc_progress_dialog_set_list(inc_dialog); if (mainwin) { toolbar_main_set_sensitive(mainwin); main_window_set_menu_sensitive(mainwin); } return inc_start(inc_dialog); case A_LOCAL: return inc_spool_account(account); default: break; } return 0; }
void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck, gboolean notify) { GList *list, *queue_list = NULL; IncProgressDialog *inc_dialog; gint new_msgs = 0; gint account_new_msgs = 0; if (prefs_common.work_offline && !inc_offline_should_override( (autocheck == FALSE), _("Claws Mail needs network access in order " "to get mails."))) return; if (inc_lock_count) return; inc_autocheck_timer_remove(); main_window_lock(mainwin); list = account_get_list(); if (!list) { inc_update_stats(new_msgs); inc_finished(mainwin, new_msgs > 0, autocheck); main_window_unlock(mainwin); inc_notify_cmd(new_msgs, notify); inc_autocheck_timer_set(); return; } if (prefs_common.use_extinc && prefs_common.extinc_cmd) { /* external incorporating program */ if (execute_command_line(prefs_common.extinc_cmd, FALSE) < 0) { log_error(LOG_PROTOCOL, _("%s failed\n"), prefs_common.extinc_cmd); main_window_unlock(mainwin); inc_autocheck_timer_set(); return; } } /* check local folders */ account_new_msgs = inc_all_spool(); if (account_new_msgs > 0) new_msgs += account_new_msgs; /* check IMAP4 / News folders */ for (list = account_get_list(); list != NULL; list = list->next) { PrefsAccount *account = list->data; if ((account->protocol == A_IMAP4 || account->protocol == A_NNTP) && account->recv_at_getall) { new_msgs += folderview_check_new(FOLDER(account->folder)); } } /* check POP3 accounts */ for (list = account_get_list(); list != NULL; list = list->next) { IncSession *session; PrefsAccount *account = list->data; if (account->recv_at_getall) { session = inc_session_new(account); if (session) queue_list = g_list_append(queue_list, session); } } if (queue_list) { inc_dialog = inc_progress_dialog_create(autocheck); inc_dialog->queue_list = queue_list; inc_dialog->mainwin = mainwin; inc_progress_dialog_set_list(inc_dialog); toolbar_main_set_sensitive(mainwin); main_window_set_menu_sensitive(mainwin); new_msgs += inc_start(inc_dialog); } inc_update_stats(new_msgs); inc_finished(mainwin, new_msgs > 0, autocheck); main_window_unlock(mainwin); inc_notify_cmd(new_msgs, notify); inc_autocheck_timer_set(); }
/* * accepts #include; * cannot use snbuf() because of a call to inc_start() */ static lex_t *dinclude(const lmap_t *pos) { static char buf[64+1]; /* size must be (power of 2) + 1 */ lex_t *t; const lmap_t *hpos; const char *inc = NULL; char *pbuf = buf, *p; lst_assert(); lex_inc = 1; NEXTSP(t); /* consumes include */ hpos = t->pos; if (t->id == LEX_HEADER) { inc = LEX_SPELL(t); while (1) { NEXTSP(t); /* consumes header or current token */ if (t->id == LEX_NEWLINE) break; assert(t->id != LEX_EOI); if (t->id == LEX_ID && !t->f.blue && mcr_expand(t)) continue; t = xtratok(t); break; } } else { int st = 0; /* initial */ size_t blen, slen; const lmap_t *epos = NULL; while (t->id != LEX_NEWLINE) { assert(t->id != LEX_EOI); epos = t->pos; if (t->id == LEX_ID && !t->f.blue && mcr_expand(t)) { NEXTSP(t); /* consumes expanded id */ continue; } assert(t->id != LEX_NEWLINE); switch(st) { case 0: /* initial */ hpos = t->pos; switch(t->id) { case LEX_SCON: if (t->spell[0] == 'L') { default: SKIPNL(t); continue; } /* no break */ case LEX_HEADER: st = 1; inc = LEX_SPELL(t); break; case '<': assert(pbuf == buf); st = 2; p = pbuf; blen = sizeof(buf) - 1; *p++ = '<'; break; } break; case 1: /* extra tokens */ t = xtratok(t); continue; case 2: /* < seen */ slen = strlen(t->spell); if (slen > blen - (p-pbuf)) { const char *oldp = pbuf; blen += ((slen + NELEM(buf)-2) & ~(size_t)(NELEM(buf)-2)); if (pbuf == buf) { pbuf = MEM_ALLOC(blen + 1); strcpy(pbuf, oldp); } else MEM_RESIZE(pbuf, blen + 1); p = pbuf + (p - oldp); } strcpy(p, t->spell); p += slen; if (t->id == '>') { st = 1; inc = pbuf; err_dpos(lmap_range(hpos, t->pos), ERR_PP_COMBINEHDR); } break; default: assert(!"invalid state -- should never reach here"); break; } NEXTSP(t); /* consumes handled token */ } if (inc) hpos = lmap_range(hpos, epos); else err_dpos(lmap_after(pos), ERR_PP_NOHEADER); } if (!inc || !inc_start(inc, hpos)) in_nextline(); /* because lex_inc set */ else if (main_opt()->pponly) { t->f.sync = 1; lst_output(lst_copy(t, 0, strg_line)); } if (pbuf != buf) MEM_FREE(pbuf); lex_inc = 0; return t; }