IMAP,POP3,NewMailNotification: fixed x86_64 build.

* Notifier::HeaderFetched(): fixed the method signature (go figure how it could
build on x86).
* POP3: fSizes type is now std::vector<size_t> instead of BList. Please review.
off_t might be a better choice.
* added the mail_daemon add-ons to the Haiku package again.
This commit is contained in:
Jérôme Duval
2015-01-08 22:31:43 +01:00
parent 1d766e9dd3
commit b9962ceac2
8 changed files with 38 additions and 32 deletions
+6 -7
View File
@@ -205,13 +205,12 @@ AddFilesToPackage add-ons accelerants : $(SYSTEM_ADD_ONS_ACCELERANTS) ;
AddFilesToPackage add-ons Translators : $(SYSTEM_ADD_ONS_TRANSLATORS) ; AddFilesToPackage add-ons Translators : $(SYSTEM_ADD_ONS_TRANSLATORS) ;
AddFilesToPackage add-ons locale catalogs : $(SYSTEM_ADD_ONS_LOCALE_CATALOGS) ; AddFilesToPackage add-ons locale catalogs : $(SYSTEM_ADD_ONS_LOCALE_CATALOGS) ;
# TODO: fix these. AddFilesToPackage add-ons mail_daemon inbound_protocols : POP3
#AddFilesToPackage add-ons mail_daemon inbound_protocols : POP3 IMAP ;
# IMAP ; AddFilesToPackage add-ons mail_daemon outbound_protocols : SMTP ;
#AddFilesToPackage add-ons mail_daemon outbound_protocols : SMTP ; AddFilesToPackage add-ons mail_daemon inbound_filters
#AddFilesToPackage add-ons mail_daemon inbound_filters : MatchHeader SpamFilter NewMailNotification ;
# : MatchHeader SpamFilter NewMailNotification ; AddFilesToPackage add-ons mail_daemon outbound_filters : Fortune ;
#AddFilesToPackage add-ons mail_daemon outbound_filters : Fortune ;
AddFilesToPackage add-ons media : $(SYSTEM_ADD_ONS_MEDIA) ; AddFilesToPackage add-ons media : $(SYSTEM_ADD_ONS_MEDIA) ;
AddFilesToPackage add-ons media plugins : $(SYSTEM_ADD_ONS_MEDIA_PLUGINS) ; AddFilesToPackage add-ons media plugins : $(SYSTEM_ADD_ONS_MEDIA_PLUGINS) ;
@@ -33,8 +33,8 @@ public:
NotifyFilter(BMailProtocol& protocol, NotifyFilter(BMailProtocol& protocol,
const BMailAddOnSettings& settings); const BMailAddOnSettings& settings);
void HeaderFetched(const entry_ref& ref, BMailFilterAction HeaderFetched(entry_ref& ref,
BFile* file); BFile& file, BMessage& attributes);
void MailboxSynchronized(status_t status); void MailboxSynchronized(status_t status);
private: private:
@@ -53,15 +53,17 @@ NotifyFilter::NotifyFilter(BMailProtocol& protocol,
} }
void BMailFilterAction
NotifyFilter::HeaderFetched(const entry_ref& ref, BFile* file) NotifyFilter::HeaderFetched(entry_ref& ref, BFile& file,
BMessage& attributes)
{ {
// TODO: do not use MAIL:status here! // TODO: do not use MAIL:status here!
char statusString[256]; char statusString[256];
if (file->ReadAttr("MAIL:status", B_STRING_TYPE, 0, statusString, 256) < 0) if (file.ReadAttr("MAIL:status", B_STRING_TYPE, 0, statusString, 256) < 0)
return; return B_NO_MAIL_ACTION;
if (BString(statusString).Compare("Read") != 0) if (BString(statusString).Compare("Read") != 0)
fNNewMessages++; fNNewMessages++;
return B_NO_MAIL_ACTION;
} }
@@ -163,7 +163,7 @@ public:
if (status != B_OK) if (status != B_OK)
return status; return status;
printf("IMAP: fetch body for %lu\n", fUID); printf("IMAP: fetch body for %" B_PRIu32 "\n", fUID);
// Since RFC3501 does not specify whether the FETCH response may // Since RFC3501 does not specify whether the FETCH response may
// alter the order of the message data items we request, we cannot // alter the order of the message data items we request, we cannot
// request more than a single UID at a time, or else we may not be // request more than a single UID at a time, or else we may not be
@@ -337,7 +337,8 @@ public:
uint32 from = fFirstIndex + kMaxFetchEntries < to uint32 from = fFirstIndex + kMaxFetchEntries < to
? fLastIndex - kMaxFetchEntries : fFirstIndex; ? fLastIndex - kMaxFetchEntries : fFirstIndex;
printf("IMAP: get entries from %lu to %lu\n", from, to); printf("IMAP: get entries from %" B_PRIu32 " to %" B_PRIu32 "\n",
from, to);
IMAP::MessageEntryList entries; IMAP::MessageEntryList entries;
IMAP::FetchMessageEntriesCommand fetch(entries, from, to, false); IMAP::FetchMessageEntriesCommand fetch(entries, from, to, false);
@@ -352,8 +353,9 @@ public:
// size into account if it's below the limit -- that does not // size into account if it's below the limit -- that does not
// seem to be possible, though // seem to be possible, though
for (size_t i = 0; i < entries.size(); i++) { for (size_t i = 0; i < entries.size(); i++) {
printf("%10lu %8lu bytes, flags: %#lx\n", entries[i].uid, printf("%10" B_PRIu32 " %8" B_PRIu32 " bytes, flags: %#"
entries[i].size, entries[i].flags); B_PRIx32 "\n", entries[i].uid, entries[i].size,
entries[i].flags);
fMailbox->AddMessageEntry(from + i, entries[i].uid, fMailbox->AddMessageEntry(from + i, entries[i].uid,
entries[i].flags, entries[i].size); entries[i].flags, entries[i].size);
@@ -577,7 +579,7 @@ IMAPConnectionWorker::EnqueueRetrieveMail(entry_ref& ref)
void void
IMAPConnectionWorker::MessageExistsReceived(uint32 count) IMAPConnectionWorker::MessageExistsReceived(uint32 count)
{ {
printf("Message exists: %lu\n", count); printf("Message exists: %" B_PRIu32 "\n", count);
fMessagesExist = count; fMessagesExist = count;
// TODO: We might want to trigger another check even during sync // TODO: We might want to trigger another check even during sync
@@ -589,7 +591,7 @@ IMAPConnectionWorker::MessageExistsReceived(uint32 count)
void void
IMAPConnectionWorker::MessageExpungeReceived(uint32 index) IMAPConnectionWorker::MessageExpungeReceived(uint32 index)
{ {
printf("Message expunge: %ld\n", index); printf("Message expunge: %" B_PRIu32 "\n", index);
if (fSelectedBox == NULL) if (fSelectedBox == NULL)
return; return;
@@ -106,7 +106,8 @@ IMAPFolder::IMAPFolder(IMAPProtocol& protocol, const BString& mailboxName,
fUIDValidity = _ReadUInt32(node, kUIDValidityAttribute); fUIDValidity = _ReadUInt32(node, kUIDValidityAttribute);
fLastUID = _ReadUInt32(node, kLastUIDAttribute); fLastUID = _ReadUInt32(node, kLastUIDAttribute);
printf("IMAP: %s, last UID %lu\n", fMailboxName.String(), fLastUID); printf("IMAP: %s, last UID %" B_PRIu32 "\n", fMailboxName.String(),
fLastUID);
attr_info info; attr_info info;
status_t status = node.GetAttrInfo(kStateAttribute, &info); status_t status = node.GetAttrInfo(kStateAttribute, &info);
@@ -84,7 +84,8 @@ IMAPMailbox::MessageSize(uint32 uid) const
uint32 uint32
IMAPMailbox::MessageAdded(const MessageToken& fromToken, const entry_ref& ref) IMAPMailbox::MessageAdded(const MessageToken& fromToken, const entry_ref& ref)
{ {
printf("IMAP: message added %s, uid %lu\n", ref.name, fromToken.uid); printf("IMAP: message added %s, uid %" B_PRIu32 "\n", ref.name,
fromToken.uid);
return 0; return 0;
} }
@@ -92,7 +93,7 @@ IMAPMailbox::MessageAdded(const MessageToken& fromToken, const entry_ref& ref)
void void
IMAPMailbox::MessageDeleted(const MessageToken& token) IMAPMailbox::MessageDeleted(const MessageToken& token)
{ {
printf("IMAP: message deleted, uid %lu\n", token.uid); printf("IMAP: message deleted, uid %" B_PRIu32 "\n", token.uid);
} }
@@ -100,6 +101,6 @@ void
IMAPMailbox::MessageFlagsChanged(const MessageToken& token, IMAPMailbox::MessageFlagsChanged(const MessageToken& token,
const entry_ref& ref, uint32 oldFlags, uint32 newFlags) const entry_ref& ref, uint32 oldFlags, uint32 newFlags)
{ {
printf("IMAP: flags changed %s, uid %lu, from %lx to %lx\n", ref.name, printf("IMAP: flags changed %s, uid %" B_PRIu32 ", from %" B_PRIx32 " to %"
token.uid, oldFlags, newFlags); B_PRIx32 "\n", ref.name, token.uid, oldFlags, newFlags);
} }
@@ -256,9 +256,10 @@ Protocol::SendCommand(int32 id, const char* command)
{ {
char buffer[2048]; char buffer[2048];
int32 length; int32 length;
if (id > 0) if (id > 0) {
length = snprintf(buffer, sizeof(buffer), "A%.7ld %s\r\n", id, command); length = snprintf(buffer, sizeof(buffer), "A%.7" B_PRId32 " %s\r\n",
else id, command);
} else
length = snprintf(buffer, sizeof(buffer), "%s\r\n", command); length = snprintf(buffer, sizeof(buffer), "%s\r\n", command);
TRACE("C: %s", buffer); TRACE("C: %s", buffer);
@@ -271,7 +272,7 @@ Protocol::SendCommand(int32 id, const char* command)
} }
int32 ssize_t
Protocol::SendData(const char* buffer, uint32 length) Protocol::SendData(const char* buffer, uint32 length)
{ {
return fSocket->Write(buffer, length); return fSocket->Write(buffer, length);
@@ -746,7 +746,7 @@ POP3Protocol::Delete(int32 index)
size_t size_t
POP3Protocol::MessageSize(int32 index) POP3Protocol::MessageSize(int32 index)
{ {
return (size_t)fSizes.ItemAt(index); return fSizes[index];
} }
@@ -863,7 +863,7 @@ status_t
POP3Protocol::_RetrieveUniqueIDs() POP3Protocol::_RetrieveUniqueIDs()
{ {
fUniqueIDs.MakeEmpty(); fUniqueIDs.MakeEmpty();
fSizes.MakeEmpty(); fSizes.clear();
fTotalSize = 0; fTotalSize = 0;
status_t status = SendCommand("UIDL" CRLF); status_t status = SendCommand("UIDL" CRLF);
@@ -896,7 +896,7 @@ POP3Protocol::_RetrieveUniqueIDs()
size = 0; size = 0;
fTotalSize += size; fTotalSize += size;
fSizes.AddItem((void*)size); fSizes.push_back(size);
} }
return B_OK; return B_OK;
@@ -72,7 +72,7 @@ private:
BString fLog; BString fLog;
int32 fNumMessages; int32 fNumMessages;
size_t fMailDropSize; size_t fMailDropSize;
BList fSizes; std::vector<size_t> fSizes;
off_t fTotalSize; off_t fTotalSize;
BMessage fSettings; BMessage fSettings;