--- src/pop3/commands.c.orig 2005-05-11 14:51:24.000000000 +0200 +++ src/pop3/commands.c 2005-05-13 13:40:18.921320144 +0200 @@ -47,6 +47,7 @@ if (client->deleted) { if (client->deleted_bitmask[num / CHAR_BIT] & (1 << (num % CHAR_BIT))) { + i_info("get_msgnum: msg %u is deleted", num+1); client_send_line(client, "-ERR Message is deleted."); return NULL; } @@ -98,16 +99,24 @@ unsigned int msgnum; if (get_msgnum(client, args, &msgnum) == NULL) - return FALSE; + { + i_info("DELE msg does not exits or is deleted %s", args); + return FALSE; + } if (!client->deleted) { + i_info("DELE creating bitmap of size %u with room for %u msgs", + MSGS_BITMASK_SIZE(client), + MSGS_BITMASK_SIZE(client)*CHAR_BIT); client->deleted_bitmask = i_malloc(MSGS_BITMASK_SIZE(client)); client->deleted = TRUE; } - client->deleted_bitmask[msgnum / CHAR_BIT] |= 1 << (msgnum % CHAR_BIT); + client->deleted_bitmask[msgnum / CHAR_BIT] |= (1 << (msgnum % CHAR_BIT)); client->deleted_count++; client->deleted_size += client->message_sizes[msgnum]; + i_info("DELE msg %u deleted (%u/%u deleted)", + msgnum, client->deleted_count, client->messages_count); client_send_line(client, "+OK Marked to be deleted."); return TRUE; } @@ -153,13 +162,17 @@ client->cmd = cmd_list_callback; client->cmd_context = ctx; + i_info("LIST *"); cmd_list_callback(client); } else { unsigned int msgnum; if (get_msgnum(client, args, &msgnum) == NULL) - return FALSE; - + { + i_info("LIST no such msg %u", msgnum); + return FALSE; + } + i_info("LIST %u", msgnum); client_send_line(client, "+OK %u %"PRIuUOFF_T, msgnum+1, client->message_sizes[msgnum]); } @@ -175,6 +188,7 @@ static int cmd_noop(struct client *client, const char *args __attr_unused__) { + i_info("NOOP"); client_send_line(client, "+OK"); return TRUE; } @@ -188,7 +202,10 @@ int ret = TRUE; if (client->deleted_bitmask == NULL) + { + i_info("expunge: no deleted messages"); return TRUE; + } memset(&search_arg, 0, sizeof(search_arg)); search_arg.type = SEARCH_ALL; @@ -201,6 +218,8 @@ 1 << (idx % CHAR_BIT)) != 0) { if (mail_expunge(mail) < 0) { ret = FALSE; + i_info("expunge: failed to expunge %u", + idx/CHAR_BIT); break; } } @@ -209,11 +228,13 @@ if (mailbox_search_deinit(ctx) < 0) ret = FALSE; + i_info("expunge: done"); return ret; } static int cmd_quit(struct client *client, const char *args __attr_unused__) { + i_info("QUIT"); if (client->deleted) { if (!expunge_mails(client)) { client_send_storage_error(client); @@ -221,15 +242,16 @@ return TRUE; } } - mailbox_transaction_commit(client->trans, MAILBOX_SYNC_FLAG_FULL_WRITE); client->trans = NULL; + i_info("QUIT: transaction commit done"); if (!client->deleted) client_send_line(client, "+OK Logging out."); else client_send_line(client, "+OK Logging out, messages deleted."); + i_info("QUIT: disconnecting"); client_disconnect(client, "Logout."); return TRUE; } @@ -405,14 +427,19 @@ unsigned int msgnum; if (get_msgnum(client, args, &msgnum) == NULL) + { + i_info("RETR: no such msg %s", args); return FALSE; + } if (client->last_seen <= msgnum) client->last_seen = msgnum+1; client->byte_counter = &client->retr_bytes; + i_info("RETR: fetch %u begin", msgnum); fetch(client, msgnum, (uoff_t)-1); + //i_info("RETR: fetch %u done", msgnum); return TRUE; } @@ -422,6 +449,7 @@ struct mail *mail; struct mail_search_arg search_arg; + i_info("RSET"); client->last_seen = 0; if (client->deleted) { @@ -458,6 +486,7 @@ static int cmd_stat(struct client *client, const char *args __attr_unused__) { + i_info("STAT"); client_send_line(client, "+OK %u %"PRIuUOFF_T, client-> messages_count - client->deleted_count, client->total_size - client->deleted_size); @@ -469,6 +498,7 @@ unsigned int msgnum; uoff_t max_lines; + i_info("TOP"); args = get_msgnum(client, args, &msgnum); if (args == NULL) return FALSE; @@ -614,6 +644,7 @@ struct cmd_uidl_context *ctx; if (*args == '\0') { + i_info("UIDL *"); client_send_line(client, "+OK"); ctx = cmd_uidl_init(client, 0); list_uids_iter(client, ctx); @@ -621,8 +652,12 @@ unsigned int msgnum; if (get_msgnum(client, args, &msgnum) == NULL) + { + i_info("UIDL no such msg %u", msgnum); return FALSE; + } + i_info("UIDL msg %u", msgnum); ctx = cmd_uidl_init(client, msgnum+1); if (!list_uids_iter(client, ctx)) client_send_line(client, "-ERR Message not found.");