librelist archives

« back to archive

size returns 0 always for MCOPopMessageInfo

size returns 0 always for MCOPopMessageInfo

From:
David Hearst
Date:
2014-01-16 @ 17:23
could not decode message

Re: [mailcore] size returns 0 always for MCOPopMessageInfo

From:
Hoa V. Dinh
Date:
2014-01-16 @ 17:27
It should be good. Do you know how to submit a pull request?  

--  
Hoa V. Dinh


On Thursday, January 16, 2014 at 9:23 AM, David Hearst wrote:

> While bringing up a simple POP client wrapped around MailCore2, I kept 
getting 0 for the value of MCOPopMessageInfo’s size. I traced that down to
what I think is a reasonable fix but was hoping to get feedback from more 
experienced MailCore2 users.
>  
> The change I made is in MCPopSession.cc (http://MCPopSession.cc) (tagged
with a comment including “dhearst”):
>  
> Array * POPSession::fetchMessages(ErrorCode * pError)
> {
>     int r;
>     carray * msg_list;
>      
>     loginIfNeeded(pError);
>     if (* pError != ErrorNone) {
>         return NULL;
>     }
>      
>     r = mailpop3_list( mPop, &msg_list);
>     if (r == MAILPOP3_ERROR_STREAM) {
>         * pError = ErrorConnection;
>         return NULL;
>     }
>     else if (r != MAILPOP3_NO_ERROR) {
>         * pError = ErrorFetchMessageList;
>         return NULL;
>     }
>      
>     Array * result = Array::array();
>     for(unsigned int i = 0 ; i < carr ay_count(msg_list) ; i ++) {
>         struct mailpop3_msg_info * msg_info;
>         String * uid;
>          
>         msg_info = (struct mailpop3_msg_info *) carray_get(msg_list, i);
>         if (msg_info->msg_uidl == NULL)
>             continue;
>          
>         uid = String::stringWithUTF8Characters(msg_info->msg_uidl);
>          
>         POPMessageInfo * info = new POPMessageInfo();
>         info->setUid(uid);
>         info->setIndex(msg_info->msg_index);
>         info->setSize(msg_info->msg_size);  // dhearst 1/16/14
>         result->addObject(info);
>         info->release();
>     }
> &nb sp;    
>     * pError = ErrorNone;
>     mState = STATE_LISTED;
>      
>     return result;
> }
>  
>  
> Is this a reasonable way to fix the problem or is something else going on?
>  
> Thanks, David  
>  
>  
> Attachments:  
> - smime.p7s
>