コード例 #1
0
ファイル: MCNNTPSession.cpp プロジェクト: AabanTariq/UCLA
IndexSet * NNTPSession::fetchAllArticles(String * groupName, ErrorCode * pError) 
{
    int r;
    clist * msg_list;
    
    selectGroup(groupName, pError);
    if (* pError != ErrorNone) {
        return NULL;
    }
    
    r = newsnntp_listgroup(mNNTP, groupName->UTF8Characters(), &msg_list);
    if (r == NEWSNNTP_ERROR_STREAM) {
        * pError = ErrorConnection;
        return NULL;
    }
    else if (r != NEWSNNTP_NO_ERROR) {
        * pError = ErrorFetchMessageList;
        return NULL;
    }
    
    IndexSet * result = new IndexSet();
    clistiter * iter;
    for(iter = clist_begin(msg_list) ;iter != NULL ; iter = clist_next(iter)) {
        uint32_t *msg_info;
        
        msg_info = (uint32_t *) clist_content(iter);
        if (!msg_info) {
            continue;
        }
        
        result->addIndex(*msg_info);
    }
    
    newsnntp_listgroup_free(msg_list);
    * pError = ErrorNone;
    mState = STATE_LISTED;
    
    return result;
}