+gint pop3_getsize_list_send(SockInfo *sock, gpointer data)
+{
+ pop3_gen_send(sock, "LIST");
+
+ return POP3_GETSIZE_LIST_RECV;
+}
+
+gint pop3_getsize_list_recv(SockInfo *sock, gpointer data)
+{
+ Pop3State *state = (Pop3State *)data;
+ gboolean nb;
+ gchar buf[POPBUFSIZE];
+
+ if (pop3_ok(sock, NULL) != PS_SUCCESS) return POP3_LOGOUT_SEND;
+
+ state->sizes = g_new0(gint, state->count + 1);
+ state->cur_total_bytes = 0;
+
+ nb = sock_is_nonblocking_mode(sock);
+ if (nb && (sock_set_nonblocking_mode(sock, FALSE) < 0)) return -1;
+
+ while (sock_read(sock, buf, sizeof(buf)) >= 0) {
+ gint num, size;
+
+ if (buf[0] == '.') break;
+ if (sscanf(buf, "%d %d", &num, &size) != 2)
+ continue;
+
+ if (num <= state->count)
+ state->sizes[num] = size;
+ if (num < state->cur_msg)
+ state->cur_total_bytes += size;
+ }
+
+ if (nb && (sock_set_nonblocking_mode(sock, TRUE) < 0)) return -1;
+
+ return POP3_RETR_SEND;
+}
+