MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / fetchMessage

Method fetchMessage

src/core/pop/MCPOPSession.cpp:512–542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510}
511
512Data * POPSession::fetchMessage(unsigned int index, POPProgressCallback * callback, ErrorCode * pError)
513{
514 int r;
515 char * content;
516 size_t content_len;
517
518 listIfNeeded(pError);
519 if (* pError != ErrorNone) {
520 return NULL;
521 }
522
523 mProgressCallback = callback;
524
525 r = mailpop3_retr(mPop, index, &content, &content_len);
526 mProgressCallback = NULL;
527 if (r == MAILPOP3_ERROR_STREAM) {
528 * pError = ErrorConnection;
529 return NULL;
530 }
531 else if (r != MAILPOP3_NO_ERROR) {
532 * pError = ErrorFetch;
533 return NULL;
534 }
535
536 Data * result;
537 result = Data::dataWithBytes(content, (unsigned int) content_len);
538 mailpop3_retr_free(content);
539 * pError = ErrorNone;
540
541 return result;
542}
543
544Data * POPSession::fetchMessage(POPMessageInfo * msg, POPProgressCallback * callback, ErrorCode * pError)
545{

Callers 1

mainMethod · 0.45

Calls 1

indexMethod · 0.45

Tested by

no test coverage detected