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:24:26 +01:00
parent 1d766e9dd3
commit b9962ceac2
8 changed files with 38 additions and 32 deletions

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 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) ;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -72,7 +72,7 @@ private:
BString fLog;
int32 fNumMessages;
size_t fMailDropSize;
BList fSizes;
std::vector<size_t> fSizes;
off_t fTotalSize;
BMessage fSettings;