pop3: minor cleanup.
This commit is contained in:
@@ -671,11 +671,13 @@ POP3Protocol::RetrieveInternal(const char* command, int32 message,
|
||||
testStr = buf + testIndex;
|
||||
if (testStr[0] == '\r' && testStr[1] == '\n' && testStr[2] == '.') {
|
||||
if (testStr[3] == '\r' && testStr[4] == '\n') {
|
||||
// Found the end of the message marker. Ignore remaining data.
|
||||
if (amountInBuffer > testIndex + 5)
|
||||
printf ("POP3Protocol::RetrieveInternal Ignoring %d bytes "
|
||||
"of extra data past message end.\n",
|
||||
// Found the end of the message marker.
|
||||
// Ignore remaining data.
|
||||
if (amountInBuffer > testIndex + 5) {
|
||||
printf("POP3Protocol::RetrieveInternal Ignoring %d "
|
||||
"bytes of extra data past message end.\n",
|
||||
amountInBuffer - (testIndex + 5));
|
||||
}
|
||||
amountInBuffer = testIndex + 2; // Don't include ".\r\n".
|
||||
buf[amountInBuffer] = 0;
|
||||
cont = false;
|
||||
@@ -685,8 +687,8 @@ POP3Protocol::RetrieveInternal(const char* command, int32 message,
|
||||
// dot starting a line of text. Of course, a file with a
|
||||
// lot of double period lines will get processed very
|
||||
// slowly.
|
||||
memmove (buf + testIndex + 2, buf + testIndex + 3,
|
||||
amountInBuffer - (testIndex + 3) + 1 /* for NUL at end */);
|
||||
memmove(buf + testIndex + 2, buf + testIndex + 3,
|
||||
amountInBuffer - (testIndex + 3) + 1);
|
||||
amountInBuffer--;
|
||||
// Watch out for the end of buffer case, when the POP text
|
||||
// is "\r\n..X". Don't want to leave the resulting
|
||||
@@ -694,7 +696,7 @@ POP3Protocol::RetrieveInternal(const char* command, int32 message,
|
||||
// since that will get mistakenly evaluated again in the
|
||||
// next loop and delete a character by mistake.
|
||||
if (testIndex >= amountInBuffer - 4 && testStr[2] == '.') {
|
||||
printf ("POP3Protocol::RetrieveInternal: Jackpot! "
|
||||
printf("POP3Protocol::RetrieveInternal: Jackpot! "
|
||||
"You have hit the rare situation with an escaped "
|
||||
"period at the end of the buffer. Aren't you happy"
|
||||
"it decodes it correctly?\n");
|
||||
@@ -712,7 +714,7 @@ POP3Protocol::RetrieveInternal(const char* command, int32 message,
|
||||
to->Write(buf, amountInBuffer - 4);
|
||||
if (postProgress)
|
||||
ReportProgress(0, amountInBuffer - 4);
|
||||
memmove (buf, buf + amountInBuffer - 4, 4);
|
||||
memmove(buf, buf + amountInBuffer - 4, 4);
|
||||
amountInBuffer = 4;
|
||||
}
|
||||
} else {
|
||||
@@ -728,10 +730,10 @@ POP3Protocol::RetrieveInternal(const char* command, int32 message,
|
||||
|
||||
|
||||
void
|
||||
POP3Protocol::Delete(int32 num)
|
||||
POP3Protocol::Delete(int32 index)
|
||||
{
|
||||
BString cmd = "DELE ";
|
||||
cmd << (num+1) << CRLF;
|
||||
cmd << (index + 1) << CRLF;
|
||||
if (SendCommand(cmd.String()) != B_OK) {
|
||||
// Error
|
||||
}
|
||||
@@ -838,7 +840,7 @@ POP3Protocol::SendCommand(const char* cmd)
|
||||
|
||||
|
||||
void
|
||||
POP3Protocol::MD5Digest(unsigned char *in, char *asciiDigest)
|
||||
POP3Protocol::MD5Digest(unsigned char* in, char* asciiDigest)
|
||||
{
|
||||
unsigned char digest[16];
|
||||
|
||||
|
||||
@@ -38,15 +38,15 @@ public:
|
||||
status_t FetchBody(const entry_ref& ref);
|
||||
status_t DeleteMessage(const entry_ref& ref);
|
||||
|
||||
status_t Retrieve(int32 message, BPositionIO *write_to);
|
||||
status_t GetHeader(int32 message, BPositionIO *write_to);
|
||||
void Delete(int32 num);
|
||||
status_t Retrieve(int32 message, BPositionIO* to);
|
||||
status_t GetHeader(int32 message, BPositionIO* to);
|
||||
void Delete(int32 index);
|
||||
|
||||
protected:
|
||||
// pop3 methods
|
||||
status_t Open(const char *server, int port,
|
||||
status_t Open(const char* server, int port,
|
||||
int protocol);
|
||||
status_t Login(const char *uid, const char *password,
|
||||
status_t Login(const char* uid, const char* password,
|
||||
int method);
|
||||
|
||||
size_t MessageSize(int32 index);
|
||||
@@ -55,13 +55,13 @@ protected:
|
||||
size_t MailDropSize(void);
|
||||
void CheckForDeletedMessages();
|
||||
|
||||
status_t RetrieveInternal(const char *command,
|
||||
int32 message, BPositionIO *writeTo,
|
||||
status_t RetrieveInternal(const char* command,
|
||||
int32 message, BPositionIO* to,
|
||||
bool showProgress);
|
||||
|
||||
ssize_t ReceiveLine(BString& line);
|
||||
status_t SendCommand(const char* cmd);
|
||||
void MD5Digest(unsigned char *in, char *out);
|
||||
void MD5Digest(unsigned char* in, char* out);
|
||||
|
||||
private:
|
||||
status_t _RetrieveUniqueIDs();
|
||||
|
||||
Reference in New Issue
Block a user