[haiku-commits] haiku: hrev49867 - src/kits/mail src/servers/mail headers/os/add-ons/mail_daemon src/add-ons/mail_daemon/outbound_protocols/smtp src/kits/interface

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 22 Nov 2015 11:36:57 +0100 (CET)

hrev49867 adds 4 changesets to branch 'master'
old head: 5dc0eff0b0a48c8bdf13d3d8370c253f2c69056f
new head: 62eec60079b426ad711f265cd823c8f77a1cfa2c
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=62eec60079b4+%5E5dc0eff0b0a4

----------------------------------------------------------------------------

04f969a59678: BWindow::MoveOnScreen(): Need to use inner frame for resize.

* This caused the window to grow each time.
* This was especially noticeable at applications that store their
size on quit, and restore it on start.
* This fixes bug #12456.

0295da889350: Mail: Set min size in prefs instead of some random number.

* Since min/max size of the menu had contradicting values at larger font
sizes, the layout was confused.

44d78872dff4: user launch: Fixed mail_daemon signature.

* This allows the launch_daemon to properly quit the mail_daemon.

62eec60079b4: SMTP works again.

* The message to send the mails never made it to the add-on looper.
* Mail protocol threads now have names.
* Added a "public" BOutboundMailProtocol::SendMessages() call that sends
itself a message (even the correct one this time).

[ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

10 files changed, 65 insertions(+), 49 deletions(-)
data/launch/user | 2 +-
headers/os/add-ons/mail_daemon/MailProtocol.h | 16 ++++---
.../inbound_protocols/imap/IMAPProtocol.cpp | 2 +-
.../mail_daemon/inbound_protocols/pop3/POP3.cpp | 4 +-
.../mail_daemon/outbound_protocols/smtp/SMTP.cpp | 7 ++-
.../mail_daemon/outbound_protocols/smtp/SMTP.h | 3 +-
src/apps/mail/Prefs.cpp | 2 +-
src/kits/interface/Window.cpp | 5 ++-
src/kits/mail/MailProtocol.cpp | 46 +++++++++++++++-----
src/servers/mail/MailDaemonApplication.cpp | 27 +-----------

############################################################################

Commit: 04f969a596788eaa02892040f68e6d29729db614
URL: http://cgit.haiku-os.org/haiku/commit/?id=04f969a59678
Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date: Sat Nov 21 15:08:19 2015 UTC

Ticket: https://dev.haiku-os.org/ticket/12456

BWindow::MoveOnScreen(): Need to use inner frame for resize.

* This caused the window to grow each time.
* This was especially noticeable at applications that store their
size on quit, and restore it on start.
* This fixes bug #12456.

----------------------------------------------------------------------------

diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp
index b9e19b8..694be5f 100644
--- a/src/kits/interface/Window.cpp
+++ b/src/kits/interface/Window.cpp
@@ -2596,7 +2596,10 @@ BWindow::MoveOnScreen(uint32 flags)
if (frame.Height() > screenFrame.Height())
frame.bottom -= frame.Height() - screenFrame.Height();

- ResizeTo(frame.Width(), frame.Height());
+ BRect innerFrame = frame;
+ innerFrame.top += tabHeight;
+ innerFrame.InsetBy(borderWidth, borderWidth);
+ ResizeTo(innerFrame.Width(), innerFrame.Height());
}

if (((flags & B_MOVE_IF_PARTIALLY_OFFSCREEN) == 0

############################################################################

Commit: 0295da889350211738d17ee400248591dfa17594
URL: http://cgit.haiku-os.org/haiku/commit/?id=0295da889350
Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date: Sat Nov 21 15:12:21 2015 UTC

Mail: Set min size in prefs instead of some random number.

* Since min/max size of the menu had contradicting values at larger font
sizes, the layout was confused.

----------------------------------------------------------------------------

diff --git a/src/apps/mail/Prefs.cpp b/src/apps/mail/Prefs.cpp
index bab8df2..0996e1a 100644
--- a/src/apps/mail/Prefs.cpp
+++ b/src/apps/mail/Prefs.cpp
@@ -223,7 +223,7 @@ TPrefsWindow::TPrefsWindow(BPoint leftTop, BFont* font,
int32* level,

fReplyPreambleMenu = _BuildReplyPreambleMenu();
menu = new BMenuField("replyPreamble", NULL, fReplyPreambleMenu);
- menu->SetExplicitMaxSize(BSize(27, B_SIZE_UNSET));
+ menu->SetExplicitMaxSize(BSize(menu->MinSize().width, B_SIZE_UNSET));

mailLayout->AddItem(fReplyPreamble->CreateLabelLayoutItem(), 0,
layoutRow);
mailLayout->AddItem(fReplyPreamble->CreateTextViewLayoutItem(), 1,

############################################################################

Commit: 44d78872dff4eeab42314062af38ed1508c056fa
URL: http://cgit.haiku-os.org/haiku/commit/?id=44d78872dff4
Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date: Sat Nov 21 16:33:02 2015 UTC

user launch: Fixed mail_daemon signature.

* This allows the launch_daemon to properly quit the mail_daemon.

----------------------------------------------------------------------------

diff --git a/data/launch/user b/data/launch/user
index f400dd3..902c460 100644
--- a/data/launch/user
+++ b/data/launch/user
@@ -16,7 +16,7 @@ target desktop {
}
}

- service x-vnd.Haiku-mail_daemon {
+ service x-vnd.Be-POST {
launch /system/servers/mail_daemon -E
if setting ~/config/settings/Mail/new_mail_daemon
DaemonAutoStarts
no_safemode

############################################################################

Revision: hrev49867
Commit: 62eec60079b426ad711f265cd823c8f77a1cfa2c
URL: http://cgit.haiku-os.org/haiku/commit/?id=62eec60079b4
Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date: Sat Nov 21 16:57:50 2015 UTC

SMTP works again.

* The message to send the mails never made it to the add-on looper.
* Mail protocol threads now have names.
* Added a "public" BOutboundMailProtocol::SendMessages() call that sends
itself a message (even the correct one this time).

----------------------------------------------------------------------------

diff --git a/headers/os/add-ons/mail_daemon/MailProtocol.h
b/headers/os/add-ons/mail_daemon/MailProtocol.h
index d4c3b2c..19f2250 100644
--- a/headers/os/add-ons/mail_daemon/MailProtocol.h
+++ b/headers/os/add-ons/mail_daemon/MailProtocol.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2013, Haiku, Inc. All Rights Reserved.
+ * Copyright 2004-2015, Haiku, Inc. All Rights Reserved.
* Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
* Copyright 2011 Clemens Zeidler. All rights reserved.
*
@@ -52,7 +52,7 @@ typedef status_t BMailFilterAction;

class BMailProtocol : public BLooper {
public:
- BMailProtocol(
+
BMailProtocol(const char* name,
const
BMailAccountSettings& settings);
virtual ~BMailProtocol();

@@ -109,6 +109,8 @@ protected:
const
BMailProtocolSettings& settings);

private:
+ static BString _LooperName(const char* name,
+ const
BMailAccountSettings& settings);
BMailFilter* _LoadFilter(const
BMailAddOnSettings& settings);
BMailFilterAction
_ProcessHeaderFetched(entry_ref& ref,
BFile&
mail, BMessage& attributes);
@@ -127,7 +129,7 @@ private:

class BInboundMailProtocol : public BMailProtocol {
public:
-
BInboundMailProtocol(
+
BInboundMailProtocol(const char* name,
const
BMailAccountSettings& settings);
virtual ~BInboundMailProtocol();

@@ -147,13 +149,17 @@ protected:

class BOutboundMailProtocol : public BMailProtocol {
public:
-
BOutboundMailProtocol(
+
BOutboundMailProtocol(const char* name,
const
BMailAccountSettings& settings);
virtual
~BOutboundMailProtocol();

+ virtual status_t SendMessages(const BMessage&
message,
+ off_t
totalBytes);
+
virtual void MessageReceived(BMessage*
message);

- virtual status_t SendMessages(const BMessage&
message,
+protected:
+ virtual status_t HandleSendMessages(const
BMessage& message,
off_t
totalBytes) = 0;
};

diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.cpp
b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.cpp
index a93cbdf..ad29830 100644
--- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.cpp
+++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.cpp
@@ -15,7 +15,7 @@

IMAPProtocol::IMAPProtocol(const BMailAccountSettings& settings)
:
- BInboundMailProtocol(settings),
+ BInboundMailProtocol("IMAP", settings),
fSettings(settings.Name(), settings.InboundSettings()),
fWorkers(5, false)
{
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 51a3d28..f06dd9f 100644
--- a/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.cpp
+++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2013, Haiku, Inc. All rights reserved.
+ * Copyright 2007-2015, Haiku, Inc. All rights reserved.
* Copyright 2001-2002 Dr. Zoidberg Enterprises. All rights reserved.
* Copyright 2011, Clemens Zeidler <haiku@xxxxxxxxxxxxxxxxxx>
*
@@ -69,7 +69,7 @@ NotHere(BStringList& that, BStringList& otherList,
BStringList* results)

POP3Protocol::POP3Protocol(const BMailAccountSettings& settings)
:
- BInboundMailProtocol(settings),
+ BInboundMailProtocol("POP3", settings),
fNumMessages(-1),
fMailDropSize(0),
fServerConnection(NULL)
diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.cpp
b/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.cpp
index b0cb38c..59e2c5a 100644
--- a/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.cpp
+++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.cpp
@@ -248,7 +248,7 @@ SplitChallengeIntoMap(BString str, map<BString,BString>& m)

SMTPProtocol::SMTPProtocol(const BMailAccountSettings& settings)
:
- BOutboundMailProtocol(settings),
+ BOutboundMailProtocol("SMTP", settings),
fAuthType(0)
{
fSettingsMessage = settings.OutboundSettings();
@@ -329,7 +329,7 @@ SMTPProtocol::Disconnect()

//! Process EMail to be sent
status_t
-SMTPProtocol::SendMessages(const BMessage& message, off_t totalBytes)
+SMTPProtocol::HandleSendMessages(const BMessage& message, off_t totalBytes)
{
type_code type;
int32 count;
@@ -337,6 +337,9 @@ SMTPProtocol::SendMessages(const BMessage& message, off_t
totalBytes)
if (status != B_OK)
return status;

+ // TODO: sort out already sent messages -- the request could
+ // be issued while we're busy sending them already
+
SetTotalItems(count);
SetTotalItemsSize(totalBytes);

diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.h
b/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.h
index 1bf47ba..331043e 100644
--- a/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.h
+++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.h
@@ -27,10 +27,11 @@ public:
const
BMailAccountSettings& settings);
virtual ~SMTPProtocol();

+protected:
status_t Connect();
void Disconnect();

- virtual status_t SendMessages(const BMessage&
message,
+ virtual status_t HandleSendMessages(const
BMessage& message,
off_t
totalBytes);

status_t Open(const char
*server, int port, bool esmtp);
diff --git a/src/kits/mail/MailProtocol.cpp b/src/kits/mail/MailProtocol.cpp
index 446e142..f73d959 100644
--- a/src/kits/mail/MailProtocol.cpp
+++ b/src/kits/mail/MailProtocol.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2013, Haiku, Inc. All rights reserved.
+ * Copyright 2011-2015, Haiku, Inc. All rights reserved.
* Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved.
*/

@@ -43,11 +43,11 @@ using namespace BPrivate;
const uint32 kMsgDeleteMessage = '&DeM';
const uint32 kMsgAppendMessage = '&ApM';

-const uint32 kMsgSendMessage = '&SeM';

-
-BMailProtocol::BMailProtocol(const BMailAccountSettings& settings)
+BMailProtocol::BMailProtocol(const char* name,
+ const BMailAccountSettings& settings)
:
+ BLooper(_LooperName(name, settings)),
fAccountSettings(settings),
fMailNotifier(NULL)
{
@@ -273,6 +273,20 @@ BMailProtocol::LoadFilters(const BMailProtocolSettings&
settings)
}


+/*static*/ BString
+BMailProtocol::_LooperName(const char* addOnName,
+ const BMailAccountSettings& settings)
+{
+ BString name = addOnName;
+
+ const char* accountName = settings.Name();
+ if (accountName != NULL && accountName[0] != '\0')
+ name << " " << accountName;
+
+ return name;
+}
+
+
BMailFilter*
BMailProtocol::_LoadFilter(const BMailAddOnSettings& settings)
{
@@ -374,9 +388,10 @@ BMailProtocol::_NotifyBodyFetched(const entry_ref& ref,
BFile& file,
// #pragma mark -


-BInboundMailProtocol::BInboundMailProtocol(const BMailAccountSettings&
settings)
+BInboundMailProtocol::BInboundMailProtocol(const char* name,
+ const BMailAccountSettings& settings)
:
- BMailProtocol(settings)
+ BMailProtocol(name, settings)
{
LoadFilters(fAccountSettings.InboundSettings());
}
@@ -472,10 +487,10 @@ BInboundMailProtocol::NotiyMailboxSynchronized(status_t
status)
// #pragma mark -


-BOutboundMailProtocol::BOutboundMailProtocol(
+BOutboundMailProtocol::BOutboundMailProtocol(const char* name,
const BMailAccountSettings& settings)
:
- BMailProtocol(settings)
+ BMailProtocol(name, settings)
{
LoadFilters(fAccountSettings.OutboundSettings());
}
@@ -486,12 +501,23 @@ BOutboundMailProtocol::~BOutboundMailProtocol()
}


+status_t
+BOutboundMailProtocol::SendMessages(const BMessage& files, off_t totalBytes)
+{
+ BMessage message(kMsgSendMessages);
+ message.Append(files);
+ message.AddInt64("bytes", totalBytes);
+
+ return BMessenger(this).SendMessage(&message);
+}
+
+
void
BOutboundMailProtocol::MessageReceived(BMessage* message)
{
switch (message->what) {
- case kMsgSendMessage:
- SendMessages(*message, message->FindInt64("bytes"));
+ case kMsgSendMessages:
+ HandleSendMessages(*message,
message->FindInt64("bytes"));
break;

default:
diff --git a/src/servers/mail/MailDaemonApplication.cpp
b/src/servers/mail/MailDaemonApplication.cpp
index 8a15376..df50b10 100644
--- a/src/servers/mail/MailDaemonApplication.cpp
+++ b/src/servers/mail/MailDaemonApplication.cpp
@@ -94,25 +94,6 @@ public:
};


-class OutboundMessenger : public BMessenger {
-public:
- OutboundMessenger(BOutboundMailProtocol* protocol)
- :
- BMessenger(protocol)
- {
- }
-
- status_t SendMessages(const BMessage& files, off_t totalBytes)
- {
- BMessage message(kMsgSendMessages);
- message.Append(files);
- message.AddInt64("bytes", totalBytes);
-
- return SendMessage(&message);
- }
-};
-
-
// #pragma mark -


@@ -498,12 +479,8 @@ MailDaemonApplication::SendPendingMessages(BMessage* msg)
{
BVolumeRoster roster;
BVolume volume;
-
std::map<int32, send_mails_info> messages;
-
- int32 account = -1;
- if (msg->FindInt32("account", &account) != B_OK)
- account = -1;
+ int32 account = msg->GetInt32("account", -1);

if (!msg->HasString("message_path")) {
while (roster.GetNextVolume(&volume) == B_OK) {
@@ -564,7 +541,7 @@ MailDaemonApplication::SendPendingMessages(BMessage* msg)
if (info.bytes == 0)
continue;

- OutboundMessenger(protocol).SendMessages(info.files,
info.bytes);
+ protocol->SendMessages(info.files, info.bytes);
}
}



Other related posts:

  • » [haiku-commits] haiku: hrev49867 - src/kits/mail src/servers/mail headers/os/add-ons/mail_daemon src/add-ons/mail_daemon/outbound_protocols/smtp src/kits/interface - axeld