if (imapx_in_idle (is) && !camel_dlist_empty (&is->queue)) {
imapx_stop_idle (is, ex);
- printf ("waiting for idle to stop \n");
+ c(printf ("waiting for idle to stop \n"));
return;
} else if (empty && !imapx_in_idle (is)) {
imapx_start_idle (is);
- printf ("starting idle \n");
+ c(printf ("starting idle \n"));
return;
}
}
if (is->select) {
c(printf("- we're selected on '%s', current jobs?\n", is->select));
for (ic = (CamelIMAPXCommand *)is->active.head;ic->next;ic=ic->next) {
- printf("- %3d '%s'\n", (gint)ic->pri, ic->name);
+ c(printf("- %3d '%s'\n", (gint)ic->pri, ic->name));
if (ic->pri > pri)
pri = ic->pri;
count++;
if (count > MAX_COMMANDS) {
- printf("** too many jobs busy, waiting for results for now\n");
+ c(printf("** too many jobs busy, waiting for results for now\n"));
return;
}
}
ic = (CamelIMAPXCommand *)is->queue.head;
nc = ic->next;
while (nc && is->literal == NULL && count < MAX_COMMANDS && ic->pri >= pri) {
- printf("-- %3d '%s'?\n", (gint)ic->pri, ic->name);
+ c(printf("-- %3d '%s'?\n", (gint)ic->pri, ic->name));
if (ic->select == NULL || strcmp(ic->select, is->select) == 0) {
c(printf("--> starting '%s'\n", ic->name));
pri = ic->pri;
if (imap->cinfo)
imapx_free_capability(imap->cinfo);
imap->cinfo = imapx_parse_capability(imap->stream, ex);
- printf("got capability flags %08x\n", imap->cinfo->capa);
+ c(printf("got capability flags %08x\n", imap->cinfo->capa));
return 0;
case IMAPX_EXPUNGE: {
guint32 expunge = id;
if (job)
break;
- printf("expunged: %d\n", id);
+ c(printf("expunged: %d\n", id));
if (imap->select_folder) {
gchar *uid = NULL;
CamelMessageInfo *mi;
camel_object_ref(imap->select_folder);
folder = imap->select_folder;
- printf("flag changed: %d\n", id);
+ c(printf("flag changed: %d\n", id));
if ( (uid = camel_folder_summary_uid_from_index (folder->summary, id - 1)))
{
// TODO: we want to make sure the names match?
- if (job->u.list.flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED)
- printf("lsub: '%s' (%c)\n", linfo->name, linfo->separator);
- else
- printf("list: '%s' (%c)\n", linfo->name, linfo->separator);
+ if (job->u.list.flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED) {
+ c(printf("lsub: '%s' (%c)\n", linfo->name, linfo->separator));
+
+ } else {
+ c(printf("list: '%s' (%c)\n", linfo->name, linfo->separator));
+ }
if (job && g_hash_table_lookup(job->u.list.folders, linfo->name) == NULL) {
if (lsub)
break;
}
case IMAPX_RECENT:
- printf("recent: %d\n", id);
+ c(printf("recent: %d\n", id));
imap->recent = id;
break;
case IMAPX_STATUS: {
switch (sinfo->condition) {
case IMAPX_READ_WRITE:
imap->mode = IMAPX_MODE_READ|IMAPX_MODE_WRITE;
- printf("folder is read-write\n");
+ c(printf("folder is read-write\n"));
break;
case IMAPX_READ_ONLY:
imap->mode = IMAPX_MODE_READ;
- printf("folder is read-only\n");
+ c(printf("folder is read-only\n"));
break;
case IMAPX_UIDVALIDITY:
imap->uidvalidity = sinfo->u.uidvalidity;
imap->permanentflags = sinfo->u.permanentflags;
break;
case IMAPX_ALERT:
- printf("ALERT!: %s\n", sinfo->text);
+ c(printf("ALERT!: %s\n", sinfo->text));
break;
case IMAPX_PARSE:
- printf("PARSE: %s\n", sinfo->text);
+ c(printf("PARSE: %s\n", sinfo->text));
break;
default:
break;
return 0;
default:
/* unknown response, just ignore it */
- printf("unknown token: %s\n", token);
+ c(printf("unknown token: %s\n", token));
}
return camel_imapx_stream_skip(imap->stream, ex);
CamelIMAPXCommand *ic, *newliteral = NULL;
CamelIMAPXCommandPart *cp;
- printf("got continuation response\n");
+ c(printf("got continuation response\n"));
CAMEL_SERVICE_REC_LOCK (imap->store, connect_lock);
/* The 'literal' pointer is like a write-lock, nothing else
CAMEL_SERVICE_REC_UNLOCK (imap->store, connect_lock);
- printf("Got continuation response for IDLE \n");
+ c(printf("Got continuation response for IDLE \n"));
imap->idle->started = TRUE;
QUEUE_LOCK(imap);
if (ic == NULL) {
camel_imapx_stream_skip(imap->stream, ex);
CAMEL_SERVICE_REC_UNLOCK (imap->store, connect_lock);
- printf("got continuation response with no outstanding continuation requests?\n");
+ c(printf("got continuation response with no outstanding continuation requests?\n"));
return 1;
}
- printf("got continuation response for data\n");
+ c(printf("got continuation response for data\n"));
cp = ic->current;
switch (cp->type & CAMEL_IMAPX_COMMAND_MASK) {
case CAMEL_IMAPX_COMMAND_DATAWRAPPER:
- printf("writing data wrapper to literal\n");
+ c(printf("writing data wrapper to literal\n"));
camel_data_wrapper_write_to_stream((CamelDataWrapper *)cp->ob, (CamelStream *)imap->stream);
break;
case CAMEL_IMAPX_COMMAND_STREAM:
- printf("writing stream to literal\n");
+ c(printf("writing stream to literal\n"));
camel_stream_write_to_stream((CamelStream *)cp->ob, (CamelStream *)imap->stream);
break;
case CAMEL_IMAPX_COMMAND_AUTH: {
if (camel_exception_is_set(ex))
return -1;
- printf("got auth continuation, feeding token '%s' back to auth mech\n", resp);
+ c(printf("got auth continuation, feeding token '%s' back to auth mech\n", resp));
camel_stream_write((CamelStream *)imap->stream, resp, strlen(resp));
case CAMEL_IMAPX_COMMAND_FILE: {
CamelStream *file;
- printf("writing file '%s' to literal\n", (gchar *)cp->ob);
+ c(printf("writing file '%s' to literal\n", (gchar *)cp->ob));
// FIXME: errors
if (cp->ob && (file = camel_stream_fs_new_with_name(cp->ob, O_RDONLY, 0))) {
cp = cp->next;
if (cp->next) {
ic->current = cp;
- printf("next part of command \"A%05u: %s\"\n", ic->tag, cp->data);
+ c(printf("next part of command \"A%05u: %s\"\n", ic->tag, cp->data));
camel_stream_printf((CamelStream *)imap->stream, "%s\r\n", cp->data);
if (cp->type & CAMEL_IMAPX_COMMAND_CONTINUATION) {
newliteral = ic;
g_assert(cp->next->next == NULL);
}
} else {
- printf("%p: queueing continuation\n", ic);
+ c(printf("%p: queueing continuation\n", ic));
camel_stream_printf((CamelStream *)imap->stream, "\r\n");
}
imapx_server_fetch_new_messages (is, is->select_folder, TRUE, ex);
if (camel_exception_is_set (ex)) {
- printf ("Caught exception in idle thread: %s \n", ex->desc);
+ e(printf ("Caught exception in idle thread: %s \n", ex->desc));
/* No way to asyncronously notify UI ? */
camel_exception_clear (ex);
}
CamelDList failed;
CamelIMAPXCommand *cw, *cn;
- printf("Select failed\n");
+ c(printf("Select failed\n"));
camel_dlist_init (&failed);
QUEUE_LOCK(is);
camel_object_unref(is->select_pending);
} else {
CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) is->select_pending;
- printf("Select ok!\n");
+ c(printf("Select ok!\n"));
is->select_folder = is->select_pending;
is->select = g_strdup(is->select_folder->full_name);
exception:
if (ex->id != CAMEL_EXCEPTION_USER_CANCEL) {
- printf("Re Connection failed: %s\n", ex->desc);
+ c(printf("Re Connection failed: %s\n", ex->desc));
imapx_disconnect (is);
sleep(1);
// camelexception_done?
if (!camel_exception_is_set (ic->ex) && ic->status->result == IMAPX_OK) {
if (ic->status->condition == IMAPX_APPENDUID) {
- printf("Got appenduid %d %d\n", (gint)ic->status->u.appenduid.uidvalidity, (gint)ic->status->u.appenduid.uid);
+ c(printf("Got appenduid %d %d\n", (gint)ic->status->u.appenduid.uidvalidity, (gint)ic->status->u.appenduid.uid));
if (ic->status->u.appenduid.uidvalidity == is->uidvalidity) {
CamelFolderChangeInfo *changes;
char *uid;
mi->uid = camel_pstring_add (uid, TRUE);
cur = camel_data_cache_get_filename (ifolder->cache, "cur", mi->uid, NULL);
- printf("Moving cache item %s to %s\n", job->u.append_message.path, cur);
link (job->u.append_message.path, cur);
/* should we update the message count ? */
g_free(cur);
} else {
- printf("but uidvalidity changed, uh ...\n");
+ g_message ("but uidvalidity changed \n");
}
}
} else {
if (info && (strchr(camel_message_info_uid(info), '-') != NULL)) {
camel_message_info_free (info);
- printf("Ignoring offline uid '%s'\n", camel_message_info_uid(info));
+ e(printf("Ignoring offline uid '%s'\n", camel_message_info_uid(info)));
} else {
camel_message_info_free (info);
break;
continue;
}
- printf("Message %s vanished\n", s_minfo->uid);
+ e(printf("Message %s vanished\n", s_minfo->uid));
removed = g_slist_prepend (removed, (gpointer) g_strdup (s_minfo->uid));
camel_message_info_free (s_minfo);
j++;
}
/* Fetch the new messages */
- if (ifolder->exists_on_server > total || total == 0)
+ if (ifolder->exists_on_server > total)
{
imapx_server_fetch_new_messages (is, folder, FALSE, job->ex);
if (camel_exception_is_set (job->ex))
camel_exception_xfer (ic->job->ex, ic->ex);
}
- printf ("==== list or lsub completed ==== \n");
+ e(printf ("==== list or lsub completed ==== \n"));
imapx_job_done (is, ic->job);
camel_imapx_command_free (ic);
}
if ((orset & flag) == 0)
continue;
- printf("checking/storing %s flags '%s'\n", on?"on":"off", flags_table[j].name);
+ c(printf("checking/storing %s flags '%s'\n", on?"on":"off", flags_table[j].name));
imapx_uidset_init(&ss, 0, 100);
for (i = 0; i < uids->len; i++) {
CamelIMAPXMessageInfo *info = (CamelIMAPXMessageInfo *)camel_folder_summary_uid
lock the commands count, ho hum */
if (job->commands == 0) {
- printf("Hmm, we didn't have any work to do afterall? hmm, this isn't right\n");
imapx_job_done (is, job);
}
}
job->start (is, job);
} else {
- printf ("NO connection yet, maybe user cancellled jobs earlier ?");
+ e(printf ("NO connection yet, maybe user cancelled jobs earlier ?"));
camel_exception_set (job->ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED, "Not authenticated");
return;
}
if (g_ascii_strcasecmp(folder->full_name, "INBOX") == 0)
job->pri += 10;
-
imapx_run_job (is, job);
if (camel_folder_change_info_changed(job->u.refresh_info.changes))
}
}
- printf("camel_imapx_read: -1\n");
+ io(printf("camel_imapx_read: -1\n"));
return -1;
}
return IMAPX_TOK_ERROR;
default:
camel_exception_set (ex, 1, "expecting atom");
- printf("expecting atom!\n");
+ io(printf("expecting atom!\n"));
return IMAPX_TOK_PROTOCOL;
}
}
/* FIXME: just grow buffer */
if (len >= CAMEL_IMAPX_STREAM_TOKEN) {
camel_exception_set (ex, 1, "astring: literal too long");
- printf("astring too long\n");
+ io(printf("astring too long\n"));
return IMAPX_TOK_PROTOCOL;
}
p = is->tokenptr;
return IMAPX_TOK_ERROR;
default:
camel_exception_set (ex, 1, "expecting astring");
- printf("expecting astring!\n");
+ io(printf("expecting astring!\n"));
return IMAPX_TOK_PROTOCOL;
}
}
e = is->end;
}
} else {
- if (isdigit(c))
- printf("Protocol error: literal too big\n");
- else
- printf("Protocol error: literal contains invalid gchar %02x '%c'\n", c, isprint(c)?c:c);
+ if (isdigit(c)) {
+ io(printf("Protocol error: literal too big\n"));
+ } else {
+ io(printf("Protocol error: literal contains invalid gchar %02x '%c'\n", c, isprint(c)?c:c));
+ }
goto protocol_error;
}
}
}
if (c == '\n' || c == '\r' || o>=oe) {
- if (o >= oe)
- printf("Protocol error: string too long\n");
- else
- printf("Protocol error: truncated string\n");
+ if (o >= oe) {
+ io(printf("Protocol error: string too long\n"));
+
+ } else {
+ io(printf("Protocol error: truncated string\n"));
+ }
+
goto protocol_error;
} else {
*o++ = c;
digits &= isdigit(c);
*o++ = c;
} else {
- printf("Protocol error: token too long\n");
+ io(printf("Protocol error: token too long\n"));
goto protocol_error;
}
}
/* Protocol error, skip until next lf? */
protocol_error:
- printf("Got protocol error\n");
+ io(printf("Got protocol error\n"));
if (c == '\n')
is->ptr = p-1;
if (tok == IMAPX_TOK_LITERAL) {
camel_imapx_stream_set_literal(is, len);
while ((tok = camel_imapx_stream_getl(is, &token, &len)) > 0) {
- printf("Skip literal data '%.*s'\n", (gint)len, token);
+ io(printf("Skip literal data '%.*s'\n", (gint)len, token));
}
}
} while (tok != '\n' && tok >= 0);