diff --git a/build/jam/packages/Haiku b/build/jam/packages/Haiku index 76eb1ca72d..8720f3573d 100644 --- a/build/jam/packages/Haiku +++ b/build/jam/packages/Haiku @@ -205,13 +205,12 @@ AddFilesToPackage add-ons accelerants : $(SYSTEM_ADD_ONS_ACCELERANTS) ; AddFilesToPackage add-ons Translators : $(SYSTEM_ADD_ONS_TRANSLATORS) ; AddFilesToPackage add-ons locale catalogs : $(SYSTEM_ADD_ONS_LOCALE_CATALOGS) ; -# TODO: fix these. -#AddFilesToPackage add-ons mail_daemon inbound_protocols : POP3 -# IMAP ; -#AddFilesToPackage add-ons mail_daemon outbound_protocols : SMTP ; -#AddFilesToPackage add-ons mail_daemon inbound_filters -# : MatchHeader SpamFilter NewMailNotification ; -#AddFilesToPackage add-ons mail_daemon outbound_filters : Fortune ; +AddFilesToPackage add-ons mail_daemon inbound_protocols : POP3 + IMAP ; +AddFilesToPackage add-ons mail_daemon outbound_protocols : SMTP ; +AddFilesToPackage add-ons mail_daemon inbound_filters + : MatchHeader SpamFilter NewMailNotification ; +AddFilesToPackage add-ons mail_daemon outbound_filters : Fortune ; AddFilesToPackage add-ons media : $(SYSTEM_ADD_ONS_MEDIA) ; AddFilesToPackage add-ons media plugins : $(SYSTEM_ADD_ONS_MEDIA_PLUGINS) ; diff --git a/src/add-ons/mail_daemon/inbound_filters/notifier/NotifierFilter.cpp b/src/add-ons/mail_daemon/inbound_filters/notifier/NotifierFilter.cpp index ce78592cb2..a302aae038 100644 --- a/src/add-ons/mail_daemon/inbound_filters/notifier/NotifierFilter.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/notifier/NotifierFilter.cpp @@ -33,8 +33,8 @@ public: NotifyFilter(BMailProtocol& protocol, const BMailAddOnSettings& settings); - void HeaderFetched(const entry_ref& ref, - BFile* file); + BMailFilterAction HeaderFetched(entry_ref& ref, + BFile& file, BMessage& attributes); void MailboxSynchronized(status_t status); private: @@ -53,15 +53,17 @@ NotifyFilter::NotifyFilter(BMailProtocol& protocol, } -void -NotifyFilter::HeaderFetched(const entry_ref& ref, BFile* file) +BMailFilterAction +NotifyFilter::HeaderFetched(entry_ref& ref, BFile& file, + BMessage& attributes) { // TODO: do not use MAIL:status here! char statusString[256]; - if (file->ReadAttr("MAIL:status", B_STRING_TYPE, 0, statusString, 256) < 0) - return; + if (file.ReadAttr("MAIL:status", B_STRING_TYPE, 0, statusString, 256) < 0) + return B_NO_MAIL_ACTION; if (BString(statusString).Compare("Read") != 0) fNNewMessages++; + return B_NO_MAIL_ACTION; } diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp index d4c5562c6f..7a758f8f25 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp @@ -163,7 +163,7 @@ public: if (status != B_OK) 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 // 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 @@ -337,7 +337,8 @@ public: uint32 from = fFirstIndex + kMaxFetchEntries < to ? 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::FetchMessageEntriesCommand fetch(entries, from, to, false); @@ -352,8 +353,9 @@ public: // size into account if it's below the limit -- that does not // seem to be possible, though for (size_t i = 0; i < entries.size(); i++) { - printf("%10lu %8lu bytes, flags: %#lx\n", entries[i].uid, - entries[i].size, entries[i].flags); + printf("%10" B_PRIu32 " %8" B_PRIu32 " bytes, flags: %#" + B_PRIx32 "\n", entries[i].uid, entries[i].size, + entries[i].flags); fMailbox->AddMessageEntry(from + i, entries[i].uid, entries[i].flags, entries[i].size); @@ -577,7 +579,7 @@ IMAPConnectionWorker::EnqueueRetrieveMail(entry_ref& ref) void IMAPConnectionWorker::MessageExistsReceived(uint32 count) { - printf("Message exists: %lu\n", count); + printf("Message exists: %" B_PRIu32 "\n", count); fMessagesExist = count; // TODO: We might want to trigger another check even during sync @@ -589,7 +591,7 @@ IMAPConnectionWorker::MessageExistsReceived(uint32 count) void IMAPConnectionWorker::MessageExpungeReceived(uint32 index) { - printf("Message expunge: %ld\n", index); + printf("Message expunge: %" B_PRIu32 "\n", index); if (fSelectedBox == NULL) return; diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp index cb58d82a5b..a7c4c92a65 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp @@ -106,7 +106,8 @@ IMAPFolder::IMAPFolder(IMAPProtocol& protocol, const BString& mailboxName, fUIDValidity = _ReadUInt32(node, kUIDValidityAttribute); 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; status_t status = node.GetAttrInfo(kStateAttribute, &info); diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPMailbox.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPMailbox.cpp index b32ea8cba9..deaf958c43 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPMailbox.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPMailbox.cpp @@ -84,7 +84,8 @@ IMAPMailbox::MessageSize(uint32 uid) const uint32 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; } @@ -92,7 +93,7 @@ IMAPMailbox::MessageAdded(const MessageToken& fromToken, const entry_ref& ref) void 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, const entry_ref& ref, uint32 oldFlags, uint32 newFlags) { - printf("IMAP: flags changed %s, uid %lu, from %lx to %lx\n", ref.name, - token.uid, oldFlags, newFlags); + printf("IMAP: flags changed %s, uid %" B_PRIu32 ", from %" B_PRIx32 " to %" + B_PRIx32 "\n", ref.name, token.uid, oldFlags, newFlags); } diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Protocol.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Protocol.cpp index 9a50cf176f..f26d7d8df5 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Protocol.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Protocol.cpp @@ -256,9 +256,10 @@ Protocol::SendCommand(int32 id, const char* command) { char buffer[2048]; int32 length; - if (id > 0) - length = snprintf(buffer, sizeof(buffer), "A%.7ld %s\r\n", id, command); - else + if (id > 0) { + length = snprintf(buffer, sizeof(buffer), "A%.7" B_PRId32 " %s\r\n", + id, command); + } else length = snprintf(buffer, sizeof(buffer), "%s\r\n", command); 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) { return fSocket->Write(buffer, length); diff --git a/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.cpp b/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.cpp index 954ef7a3c5..cbd266ba3c 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.cpp @@ -746,7 +746,7 @@ POP3Protocol::Delete(int32 index) size_t POP3Protocol::MessageSize(int32 index) { - return (size_t)fSizes.ItemAt(index); + return fSizes[index]; } @@ -863,7 +863,7 @@ status_t POP3Protocol::_RetrieveUniqueIDs() { fUniqueIDs.MakeEmpty(); - fSizes.MakeEmpty(); + fSizes.clear(); fTotalSize = 0; status_t status = SendCommand("UIDL" CRLF); @@ -896,7 +896,7 @@ POP3Protocol::_RetrieveUniqueIDs() size = 0; fTotalSize += size; - fSizes.AddItem((void*)size); + fSizes.push_back(size); } return B_OK; diff --git a/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.h b/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.h index b82c942d18..f83e9918e5 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.h +++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.h @@ -72,7 +72,7 @@ private: BString fLog; int32 fNumMessages; size_t fMailDropSize; - BList fSizes; + std::vector fSizes; off_t fTotalSize; BMessage fSettings;