示例#1
0
static void group_run(struct etpan_thread_op * op)
{
	struct group_param * param;
	struct group_result * result;
	int r;
	
	param = op->param;
	result = op->result;

	CHECK_NNTP();

	r = newsnntp_group(param->nntp, param->group, param->info);
	
	result->error = r;
	debug_print("nntp group run - end %i\n", r);
}
示例#2
0
int nntpdriver_select_folder(mailsession * session, const char * mb)
{
    int r;
    struct newsnntp_group_info * info;
    newsnntp * nntp_session;
    struct nntp_session_state_data * data;
    char * new_name;
    int done;

    data = session_get_data(session);

    if (!data->nntp_mode_reader) {
        r = nntpdriver_mode_reader(session);
        if (r != MAIL_NO_ERROR)
            return r;

        data->nntp_mode_reader = TRUE;
    }

    if (data->nntp_group_name != NULL)
        if (strcmp(data->nntp_group_name, mb) == 0)
            return MAIL_NO_ERROR;

    nntp_session = session_get_nntp_session(session);

    done = FALSE;
    do {
        r = newsnntp_group(nntp_session, mb, &info);

        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);

    new_name = strdup(mb);
    if (new_name == NULL)
        return MAIL_ERROR_MEMORY;

    if (data->nntp_group_name != NULL)
        free(data->nntp_group_name);
    data->nntp_group_name = new_name;
    if (data->nntp_group_info != NULL)
        newsnntp_group_free(data->nntp_group_info);
    data->nntp_group_info = info;

    return MAIL_NO_ERROR;
}