summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libetpan/generic/pop3driver.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kmicromail/libetpan/generic/pop3driver.c b/kmicromail/libetpan/generic/pop3driver.c
index 475dfcc..a4a4893 100644
--- a/kmicromail/libetpan/generic/pop3driver.c
+++ b/kmicromail/libetpan/generic/pop3driver.c
@@ -155,216 +155,216 @@ static int pop3driver_initialize(mailsession * session)
session->sess_data = data;
return MAIL_NO_ERROR;
free:
mailpop3_free(pop3);
err:
return MAIL_ERROR_MEMORY;
}
static void pop3driver_uninitialize(mailsession * session)
{
struct pop3_session_state_data * data;
data = get_data(session);
mailpop3_free(data->pop3_session);
free(data);
session->sess_data = data;
}
static int pop3driver_connect_stream(mailsession * session, mailstream * s)
{
int r;
r = mailpop3_connect(get_pop3_session(session), s);
switch (r) {
case MAILPOP3_NO_ERROR:
return MAIL_NO_ERROR_NON_AUTHENTICATED;
default:
return pop3driver_pop3_error_to_mail_error(r);
}
}
static int pop3driver_starttls(mailsession * session)
{
int r;
int fd;
mailstream_low * low;
mailstream_low * new_low;
mailpop3 * pop3;
pop3 = get_pop3_session(session);
r = mailpop3_stls(pop3);
switch (r) {
case MAILPOP3_NO_ERROR:
break;
default:
return pop3driver_pop3_error_to_mail_error(r);
}
low = mailstream_get_low(pop3->pop3_stream);
fd = mailstream_low_get_fd(low);
if (fd == -1)
return MAIL_ERROR_STREAM;
new_low = mailstream_low_ssl_open(fd);
if (new_low == NULL)
return MAIL_ERROR_STREAM;
mailstream_low_free(low);
mailstream_set_low(pop3->pop3_stream, new_low);
return MAIL_NO_ERROR;
}
static int pop3driver_parameters(mailsession * session,
int id, void * value)
{
struct pop3_session_state_data * data;
data = get_data(session);
switch (id) {
case POP3DRIVER_SET_AUTH_TYPE:
{
int * param;
param = value;
data->pop3_auth_type = * param;
return MAIL_NO_ERROR;
}
}
return MAIL_ERROR_INVAL;
}
static int pop3driver_login(mailsession * session,
char * userid, char * password)
{
- int r;
+ int r;int ret ;
carray * msg_tab;
struct pop3_session_state_data * data;
data = get_data(session);
switch (data->pop3_auth_type) {
case POP3DRIVER_AUTH_TYPE_TRY_APOP:
r = mailpop3_login_apop(get_pop3_session(session), userid, password);
if (r != MAILPOP3_NO_ERROR)
r = mailpop3_login(get_pop3_session(session), userid, password);
break;
case POP3DRIVER_AUTH_TYPE_APOP:
r = mailpop3_login_apop(get_pop3_session(session), userid, password);
break;
default:
case POP3DRIVER_AUTH_TYPE_PLAIN:
r = mailpop3_login(get_pop3_session(session), userid, password);
break;
}
// LR 2 lines
- int ret = pop3driver_pop3_error_to_mail_error(r);
+ ret = pop3driver_pop3_error_to_mail_error(r);
if ( ret == MAIL_NO_ERROR )
mailpop3_list(get_pop3_session(session), &msg_tab);
// LR
return ret;
}
static int pop3driver_logout(mailsession * session)
{
int r;
r = mailpop3_quit(get_pop3_session(session));
return pop3driver_pop3_error_to_mail_error(r);
}
static int pop3driver_noop(mailsession * session)
{
int r;
r = mailpop3_noop(get_pop3_session(session));
return pop3driver_pop3_error_to_mail_error(r);
}
static int pop3driver_status_folder(mailsession * session, char * mb,
uint32_t * result_messages,
uint32_t * result_recent,
uint32_t * result_unseen)
{
uint32_t count;
int r;
r = pop3driver_messages_number(session, mb, &count);
if (r != MAIL_NO_ERROR)
return r;
* result_messages = count;
* result_recent = count;
* result_unseen = count;
return MAIL_NO_ERROR;
}
static int pop3driver_messages_number(mailsession * session, char * mb,
uint32_t * result)
{
carray * msg_tab;
mailpop3_list(get_pop3_session(session), &msg_tab);
* result = carray_count(msg_tab) -
get_pop3_session(session)->pop3_deleted_count;
return MAIL_NO_ERROR;
}
/* messages operations */
static int pop3driver_remove_message(mailsession * session, uint32_t num)
{
mailpop3 * pop3;
int r;
pop3 = get_pop3_session(session);
r = mailpop3_dele(pop3, num);
switch (r) {
case MAILPOP3_ERROR_BAD_STATE:
return MAIL_ERROR_BAD_STATE;
case MAILPOP3_ERROR_NO_SUCH_MESSAGE:
return MAIL_ERROR_MSG_NOT_FOUND;
case MAILPOP3_ERROR_STREAM:
return MAIL_ERROR_STREAM;
case MAILPOP3_NO_ERROR:
return MAIL_NO_ERROR;
default:
return MAIL_ERROR_REMOVE;
}
}
static int pop3driver_get_messages_list(mailsession * session,
struct mailmessage_list ** result)
{
mailpop3 * pop3;
pop3 = get_pop3_session(session);
return pop3_get_messages_list(pop3, session,
pop3_message_driver, result);
}