示例#1
0
static void article_run(struct etpan_thread_op * op)
{
	struct article_param * param;
	struct article_result * result;
	int r;
	
	param = op->param;
	result = op->result;

	CHECK_NNTP();

	r = newsnntp_article(param->nntp, param->num, param->contents, param->len);
	
	result->error = r;
	debug_print("nntp article run - end %i\n", r);
}
示例#2
0
int nntpdriver_article(mailsession * session, uint32_t indx,
                       char ** result,
                       size_t * result_len)
{
    char * msg_content;
    size_t msg_length;
    int r;
    int done;

    done = FALSE;
    do {
        r = newsnntp_article(session_get_nntp_session(session),
                             indx, &msg_content, &msg_length);

        switch (r) {
        case NEWSNNTP_WARNING_REQUEST_AUTHORIZATION_USERNAME:
            r = nntpdriver_authenticate_user(session);
            if (r != MAIL_NO_ERROR)
                return r;
            break;

        case NEWSNNTP_WARNING_REQUEST_AUTHORIZATION_PASSWORD:
            r = nntpdriver_authenticate_password(session);
            if (r != MAIL_NO_ERROR)
                return r;
            break;

        case NEWSNNTP_NO_ERROR:
            done = TRUE;
            break;

        default:
            return nntpdriver_nntp_error_to_mail_error(r);
        }
    }
    while (!done);

    * result = msg_content;
    * result_len = msg_length;

    return MAIL_NO_ERROR;
}