0
진행률 표시 줄은 배달 된 이메일의 비율을 표시하는 데 사용됩니다. 전자 libetpan.xcodeproj
을 사용하여 전자 메일을 보내고 백분율은 다음 코드로 계산할 수 있습니다. 그것은 c로 기록되어있다. 문제는 c.file에 알림을 게시하여 비율이 증가했다는 관찰자 (objective-c 클래스)에게 어떻게 알릴 수 있습니까? 어떤 도움에 감사드립니다 :).c 파일에 알림 게시
mailstream_helper.c
static inline int send_data_crlf_progress(mailstream * s,
const char *message, size_t size,
int quoted, size_t progr_rate,
progress_function * progr_fun,
mailprogress_function *
progr_context_fun, void *context)
{
const char *current;
size_t count;
size_t last;
size_t remaining;
count = 0;
last = 0;
current = message;
remaining = size;
int i = 0;
while (remaining > 0) {
ssize_t length;
if (quoted) {
if (current[0] == '.')
if (mailstream_write(s, ".", 1) == -1)
goto err;
}
length = send_data_line(s, current, remaining);
if (length < 0)
goto err;
current += length;
count += length;
if (progr_rate != 0) {
if (count - last >= progr_rate) {
if (progr_fun != NULL) {
(*progr_fun) (count, size);
}
if (progr_context_fun != NULL) {
(*progr_context_fun) (count, size, context);
}
last = count;
}
}
remaining -= length;
//I need to post a notification here to let my
//progress bar know how much data has been sent.
printf("No.%d rateOfSentData:%d end\r\n", ++i,
1.0 - (float) remaining/(float) size);
}
return 0;
err:
return -1;
}
우리는 파일 이름을 .m 접미어로 바꾸어 문제를 해결합니다. 그것은 지금 잘 작동 :) 많은 감사합니다 :) –