| 488 | } |
| 489 | |
| 490 | Data * NNTPSession::fetchArticleByMessageID(String * messageID, ErrorCode * pError) |
| 491 | { |
| 492 | int r; |
| 493 | char * msgID; |
| 494 | char * content; |
| 495 | size_t content_len; |
| 496 | |
| 497 | MCLog("fetch article at message-id %s", messageID->UTF8Characters()); |
| 498 | |
| 499 | msgID = strdup(messageID->UTF8Characters()); |
| 500 | |
| 501 | r = newsnntp_article_by_message_id(mNNTP, msgID, &content, &content_len); |
| 502 | free(msgID); |
| 503 | if (r == NEWSNNTP_ERROR_STREAM) { |
| 504 | * pError = ErrorConnection; |
| 505 | return NULL; |
| 506 | } |
| 507 | else if (r != NEWSNNTP_NO_ERROR) { |
| 508 | * pError = ErrorFetchMessageList; |
| 509 | return NULL; |
| 510 | } |
| 511 | |
| 512 | Data * result; |
| 513 | result = Data::dataWithBytes(content, (unsigned int) content_len); |
| 514 | newsnntp_article_free(content); |
| 515 | * pError = ErrorNone; |
| 516 | |
| 517 | return result; |
| 518 | } |
| 519 | |
| 520 | time_t NNTPSession::fetchServerDate(ErrorCode * pError) { |
| 521 | int r; |