BRoster::Private::SendTo(): Actually support NULL reply

Unlike documented passing a NULL reply would just fail instead of
sending the message without waiting for a reply.
This commit is contained in:
Ingo Weinhold
2014-06-17 20:32:25 +02:00
parent 820dbc01ce
commit b44215c079
+6 -4
View File
@@ -48,7 +48,7 @@ BRoster::Private::SetTo(BMessenger mainMessenger, BMessenger mimeMessenger)
\param message The message to be sent. \param message The message to be sent.
\param reply A pointer to a pre-allocated BMessage into which the reply \param reply A pointer to a pre-allocated BMessage into which the reply
message will be copied. message will be copied. May be \c NULL.
\param mime \c true, if the message should be sent to the MIME data base \param mime \c true, if the message should be sent to the MIME data base
service, \c false for the roster. service, \c false for the roster.
\return \return
@@ -65,10 +65,12 @@ BRoster::Private::SendTo(BMessage *message, BMessage *reply, bool mime)
if (fRoster == NULL) if (fRoster == NULL)
return B_NO_INIT; return B_NO_INIT;
if (mime) const BMessenger& messenger = mime
return fRoster->_MimeMessenger().SendMessage(message, reply); ? fRoster->_MimeMessenger() : fRoster->fMessenger;
return fRoster->fMessenger.SendMessage(message, reply); return reply != NULL
? messenger.SendMessage(message, reply)
: messenger.SendMessage(message);
} }