📄 pop3__client_8c-source.html
字号:
00316 <span class="keywordflow">case</span> <a class="code" href="pop3__client_8h.html#a9">POP3C_USERNAME_SENT</a>:00317 00318 <span class="keywordflow">if</span>(cmd == POP3C_OK) { 00319 DEBUGOUT(<span class="stringliteral">"USER +OK by POP3 server\r\n"</span>);00320 pop3c_changestate(<a class="code" href="pop3__client_8h.html#a10">POP3C_USERNAME_ACKED</a>);00321 <span class="keywordflow">return</span>(1);00322 }00323 00324 <span class="keywordflow">break</span>; 00325 00326 <span class="keywordflow">case</span> <a class="code" href="pop3__client_8h.html#a11">POP3C_PASSWORD_SENT</a>:00327 00328 <span class="keywordflow">if</span>(cmd == POP3C_OK) {00329 DEBUGOUT(<span class="stringliteral">"PASS +OK by POP3 server\r\n"</span>);00330 pop3c_changestate(<a class="code" href="pop3__client_8h.html#a12">POP3C_PASSWORD_ACKED</a>);00331 <span class="keywordflow">return</span>(1);00332 }00333 00334 <span class="keywordflow">break</span>; 00335 00336 <span class="keywordflow">case</span> <a class="code" href="pop3__client_8h.html#a13">POP3C_STAT_SENT</a>: 00337 00338 <span class="keywordflow">if</span>(cmd == POP3C_OK) {00339 DEBUGOUT(<span class="stringliteral">"STAT get from POP3 server\r\n"</span>);00340 00341 <span class="comment">/* Parse number of messages */</span>00342 00343 <a class="code" href="system_8h.html#a14">NETWORK_RECEIVE_INITIALIZE</a>(received_tcp_packet.buf_index);00344 00345 pop3_client.<a class="code" href="structpop3c__struct.html#m6">msgtotal</a> = 0;00346 pop3_client.<a class="code" href="structpop3c__struct.html#m7">curmsgindex</a> = 0;00347 pop3_client.<a class="code" href="structpop3c__struct.html#m8">curmsgtotlen</a> = 0;00348 pop3_client.<a class="code" href="structpop3c__struct.html#m9">curmsghlen</a> = 0;00349 <span class="keywordflow">if</span>( pop3c_parsestat() < 0 ) {00350 <span class="comment">/* Error parsing STAT reply */</span>00351 <span class="comment">/* Inform application */</span> 00352 <a class="code" href="pop3c__callbacks_8c.html#a47">pop3c_error</a>(); 00353 <a class="code" href="tcp_8c.html#a11">tcp_abort</a>(pop3_client.<a class="code" href="structpop3c__struct.html#m3">sochandle</a>);00354 pop3c_changestate(<a class="code" href="pop3__client_8h.html#a4">POP3C_CLOSED</a>);00355 pop3_client.<a class="code" href="structpop3c__struct.html#m5">unacked</a> = 0; 00356 <span class="keywordflow">return</span>(1);00357 }00358 00359 <span class="comment">/* Inform application about the nmbr of messages */</span>00360 <a class="code" href="pop3c__callbacks_8c.html#a1">pop3c_messages</a>(pop3_client.<a class="code" href="structpop3c__struct.html#m6">msgtotal</a>);00361 00362 pop3c_changestate(<a class="code" href="pop3__client_8h.html#a14">POP3C_STAT_GET</a>);00363 <span class="keywordflow">return</span>(1);00364 }00365 00366 <span class="keywordflow">break</span>; 00367 00368 <span class="keywordflow">case</span> <a class="code" href="pop3__client_8h.html#a15">POP3C_LIST_SENT</a>:00369 00370 <span class="keywordflow">if</span>(cmd == POP3C_OK) {00371 DEBUGOUT(<span class="stringliteral">"LIST get from POP3 server\r\n"</span>);00372 00373 <span class="comment">/* Parse message total len */</span>00374 00375 <a class="code" href="system_8h.html#a14">NETWORK_RECEIVE_INITIALIZE</a>(received_tcp_packet.buf_index); 00376 00377 pop3_client.<a class="code" href="structpop3c__struct.html#m8">curmsgtotlen</a> = 0;00378 00379 <span class="keywordflow">if</span>(pop3c_parselist() < 0) {00380 <span class="comment">/* Error parsing LIST reply */</span>00381 <span class="comment">/* Inform application */</span> 00382 <a class="code" href="pop3c__callbacks_8c.html#a47">pop3c_error</a>(); 00383 <a class="code" href="tcp_8c.html#a11">tcp_abort</a>(pop3_client.<a class="code" href="structpop3c__struct.html#m3">sochandle</a>);00384 pop3c_changestate(<a class="code" href="pop3__client_8h.html#a4">POP3C_CLOSED</a>);00385 pop3_client.<a class="code" href="structpop3c__struct.html#m5">unacked</a> = 0; 00386 <span class="keywordflow">return</span>(1); 00387 00388 }00389 00390 00391 pop3c_changestate(<a class="code" href="pop3__client_8h.html#a16">POP3C_LIST_GET</a>);00392 <span class="keywordflow">return</span>(1);00393 }00394 00395 <span class="keywordflow">break</span>; 00396 00397 <span class="keywordflow">case</span> <a class="code" href="pop3__client_8h.html#a17">POP3C_TOP0_SENT</a>:00398 00399 <span class="keywordflow">if</span>(cmd == POP3C_OK) {00400 DEBUGOUT(<span class="stringliteral">"TOP x 0 get from POP3 server\r\n"</span>);00401 00402 <span class="comment">/* Continue imediately to receive header */</span>00403 pop3_client.<a class="code" href="structpop3c__struct.html#m9">curmsghlen</a> = 0;00404 pop3_client.<a class="code" href="structpop3c__struct.html#m12">from</a>[0] = <span class="charliteral">'\0'</span>;00405 pop3_client.<a class="code" href="structpop3c__struct.html#m13">subject</a>[0] = <span class="charliteral">'\0'</span>;00406 match = 0;00407 00408 <span class="comment">/* Receive untill LF found */</span>00409 00410 <span class="keywordflow">for</span>(i=0; i<(UINT16)par1; i++)00411 {00412 ch = <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00413 00414 <span class="keywordflow">if</span>(ch == <span class="charliteral">'\n'</span>)00415 { i++;00416 <span class="keywordflow">break</span>;00417 }00418 }00419 00420 par1 = i; 00421 00422 00423 pop3c_changestate(<a class="code" href="pop3__client_8h.html#a18">POP3C_RECEIVING_HEADER</a>); 00424 }<span class="keywordflow">else</span>00425 <span class="keywordflow">break</span>;00426 00427 <span class="keywordflow">case</span> <a class="code" href="pop3__client_8h.html#a18">POP3C_RECEIVING_HEADER</a>:00428 <span class="keywordflow">case</span> <a class="code" href="pop3__client_8h.html#a19">POP3C_RECEIVING_HDR_FROM</a>:00429 <span class="keywordflow">case</span> <a class="code" href="pop3__client_8h.html#a20">POP3C_RECEIVING_HDR_SUBJ</a>:00430 00431 pop3_client.<a class="code" href="structpop3c__struct.html#m9">curmsghlen</a> += (UINT16)par1;00432 00433 <span class="keywordflow">if</span>( pop3_client.<a class="code" href="structpop3c__struct.html#m9">curmsghlen</a> > (pop3_client.<a class="code" href="structpop3c__struct.html#m8">curmsgtotlen</a> + 100) ) {00434 <span class="comment">/* Somebody tries to fool us */</span>00435 <span class="comment">/* Move to next msg */</span>00436 00437 pop3c_changestate(<a class="code" href="pop3__client_8h.html#a25">POP3C_MESSAGE_RECEIVED</a>);00438 <span class="keywordflow">break</span>; 00439 00440 }00441 00442 <span class="comment">/* We try to find 'from:', or 'subject:' */</span>00443 00444 <a class="code" href="system_8h.html#a14">NETWORK_RECEIVE_INITIALIZE</a>(received_tcp_packet.buf_index);00445 00446 <span class="keywordflow">for</span>( i=0; i<(UINT16)par1; i++) {00447 00448 ch = <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00449
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -