if (prefs_common.open_inbox_on_inc) {
item = cur_account && cur_account->inbox
- ? folder_find_item_from_path(cur_account->inbox)
+ ? folder_find_item_from_identifier(cur_account->inbox)
: folder_get_default_inbox();
if (FOLDER_SUMMARY_MISMATCH(item, mainwin->summaryview)) {
folderview_unselect(mainwin->folderview);
if (inc_lock_count) return;
+ if (prefs_common.work_offline)
+ if (alertpanel(_("Offline warning"),
+ _("You're working offline. Override?"),
+ _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
+ return;
+
inc_autocheck_timer_remove();
summary_write_cache(mainwin->summaryview);
main_window_lock(mainwin);
GList *list, *queue_list = NULL;
IncProgressDialog *inc_dialog;
gint new_msgs = 0;
+
+ if (prefs_common.work_offline)
+ if (alertpanel(_("Offline warning"),
+ _("You're working offline. Override?"),
+ _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
+ return;
if (inc_lock_count) return;
state->ac_prefs = account;
state->folder_table = g_hash_table_new(NULL, NULL);
+ state->uidl_todelete_list = NULL;
state->uidl_table = inc_get_uidl_table(account);
state->inc_state = INC_SUCCESS;
hash_free_strings(state->uidl_table);
g_hash_table_destroy(state->uidl_table);
}
-
+ g_slist_free(state->uidl_todelete_list);
g_free(state->greeting);
g_free(state->user);
g_free(state->pass);
gchar *path;
FILE *fp;
gchar buf[IDLEN + 3];
+ GDate curdate;
+ gchar **data;
path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
"uidl-", ac_prefs->recv_server,
"-", ac_prefs->userid, NULL);
+
if ((fp = fopen(path, "rb")) == NULL) {
if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
g_free(path);
table = g_hash_table_new(g_str_hash, g_str_equal);
+ g_date_clear(&curdate, 1);
+
+ /*
+ * NOTE: g_date_set_time() has to be called inside this
+ * loop, because a day change may happen??? That right?
+ */
+
while (fgets(buf, sizeof(buf), fp) != NULL) {
strretchomp(buf);
- g_hash_table_insert(table, g_strdup(buf), GINT_TO_POINTER(1));
+
+ /* data[0] will contain uidl
+ * data[1] will contain day of retrieval */
+
+ /*
+ * FIXME: convoluted implementation. need to find
+ * a better way to split the string.
+ */
+ if (strchr(buf, '\t')) {
+ data = g_strsplit(buf, "\t", 2);
+ if (data) {
+ g_hash_table_insert(table, g_strdup(data[0]), g_strdup(data[1]));
+ g_strfreev(data);
+ }
+ } else {
+ g_date_set_time(&curdate, time(NULL));
+ g_hash_table_insert(table, g_strdup(buf),
+ g_strdup_printf("%d", g_date_day_of_year(&curdate)));
+ }
}
fclose(fp);
-
return table;
}
gchar *path;
FILE *fp;
gint n;
+ GDate curdate;
+ const char *sdate;
+ int tdate;
- if (!state->uidl_is_valid) return;
-
+ if (!state->uidl_is_valid)
+ return;
+
path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
"uidl-", state->ac_prefs->recv_server,
"-", state->user, NULL);
return;
}
+ g_date_clear(&curdate, 1);
+
for (n = 1; n <= state->count; n++) {
if (state->msg[n].uidl && state->msg[n].received &&
!state->msg[n].deleted) {
FILE_OP_ERROR(path, "fputs");
break;
}
- if (fputc('\n', fp) == EOF) {
+ if (fputc('\t', fp) == EOF) {
FILE_OP_ERROR(path, "fputc");
break;
}
+
+ /*
+ * NOTE: need to set time to watch for day changes??
+ */
+ g_date_set_time(&curdate, time(NULL));
+
+ if (NULL != (sdate = g_hash_table_lookup(state->uidl_table, state->msg[n].uidl))) {
+ tdate = sdate != NULL ? atoi(sdate) : g_date_day_of_year(&curdate);
+ if (fprintf(fp, "%3d", tdate) == EOF) {
+ FILE_OP_ERROR(path, "fprintf");
+ break;
+ }
+ } else {
+ if (fprintf(fp, "%d", g_date_day_of_year(&curdate)) == EOF) {
+ FILE_OP_ERROR(path, "fputs");
+ break;
+ }
+ }
+
+ if (fputc('\n', fp) == EOF) {
+ FILE_OP_ERROR(path, "fputc");
+ break;
+ }
}
}
- if (fclose(fp) == EOF) FILE_OP_ERROR(path, "fclose");
+ if (fclose(fp) == EOF)
+ FILE_OP_ERROR(path, "fclose");
g_free(path);
}
/* CLAWS: get default inbox (perhaps per account) */
if (state->ac_prefs->inbox) {
/* CLAWS: get destination folder / mailbox */
- inbox = folder_find_item_from_identifier(state->ac_prefs->inbox);
+ inbox = folder_find_item_from_identifier
+ (state->ac_prefs->inbox);
if (!inbox)
inbox = folder_get_default_inbox();
} else
else
buf = g_strdup(prefs_common.newmail_notify_cmd);
- system(buf);
+ execute_command_line(buf, TRUE);
g_free(buf);
}
static void inc_autocheck_timer_set_interval(guint interval)
{
inc_autocheck_timer_remove();
-
- if (prefs_common.autochk_newmail && autocheck_data) {
+ /* last test is to avoid re-enabling auto_check after modifying
+ the common preferences */
+ if (prefs_common.autochk_newmail && autocheck_data
+ && prefs_common.work_offline == FALSE) {
autocheck_timer = gtk_timeout_add
(interval, inc_autocheck_func, autocheck_data);
debug_print("added timer = %d\n", autocheck_timer);