Send appropriate response email when reply from MessageView
* The code was hard-wired to accept (ancient placehold code) * Send code that depends on the user's actual response * Rename inappropriately named method in Controller Bug: 2515961 Change-Id: I8985a3206fc8c4498521b08806a1093abaf4a42c
This commit is contained in:
parent
fa997254d4
commit
ad809fd744
@ -703,7 +703,7 @@ public class MessageView extends Activity implements OnClickListener {
|
||||
/**
|
||||
* Send a service message indicating that a meeting invite button has been clicked.
|
||||
*/
|
||||
private void onAccept(int response, int toastResId) {
|
||||
private void onRespond(int response, int toastResId) {
|
||||
// do not send twice in a row the same response
|
||||
if (mPreviousMeetingResponse != response) {
|
||||
mController.sendMeetingResponse(mMessageId, response, mControllerCallback);
|
||||
@ -791,15 +791,15 @@ public class MessageView extends Activity implements OnClickListener {
|
||||
onShowPictures();
|
||||
break;
|
||||
case R.id.accept:
|
||||
onAccept(EmailServiceConstants.MEETING_REQUEST_ACCEPTED,
|
||||
onRespond(EmailServiceConstants.MEETING_REQUEST_ACCEPTED,
|
||||
R.string.message_view_invite_toast_yes);
|
||||
break;
|
||||
case R.id.maybe:
|
||||
onAccept(EmailServiceConstants.MEETING_REQUEST_TENTATIVE,
|
||||
onRespond(EmailServiceConstants.MEETING_REQUEST_TENTATIVE,
|
||||
R.string.message_view_invite_toast_maybe);
|
||||
break;
|
||||
case R.id.decline:
|
||||
onAccept(EmailServiceConstants.MEETING_REQUEST_DECLINED,
|
||||
onRespond(EmailServiceConstants.MEETING_REQUEST_DECLINED,
|
||||
R.string.message_view_invite_toast_no);
|
||||
break;
|
||||
case R.id.invite_link:
|
||||
|
@ -33,6 +33,7 @@ import com.android.email.provider.EmailContent.HostAuth;
|
||||
import com.android.email.provider.EmailContent.Mailbox;
|
||||
import com.android.email.provider.EmailContent.MailboxColumns;
|
||||
import com.android.email.provider.EmailContent.Message;
|
||||
import com.android.email.service.EmailServiceConstants;
|
||||
import com.android.email.service.EmailServiceProxy;
|
||||
import com.android.email.service.EmailServiceStatus;
|
||||
import com.android.exchange.adapter.AbstractSyncAdapter;
|
||||
@ -852,7 +853,7 @@ public class EasSyncService extends AbstractSyncService {
|
||||
* will consist a little bit of event information and an iCalendar attachment
|
||||
* @param msg the meeting request email
|
||||
*/
|
||||
private void sendMeetingResponseMail(Message msg) {
|
||||
private void sendMeetingResponseMail(Message msg, int response) {
|
||||
// Get the meeting information; we'd better have some...
|
||||
PackedString meetingInfo = new PackedString(msg.mMeetingInfo);
|
||||
if (meetingInfo == null) return;
|
||||
@ -899,9 +900,21 @@ public class EasSyncService extends AbstractSyncService {
|
||||
// Create a message from the Entity we've built. The message will have fields like
|
||||
// to, subject, date, and text filled in. There will also be an "inline" attachment
|
||||
// which is in iCalendar format
|
||||
int flag;
|
||||
switch(response) {
|
||||
case EmailServiceConstants.MEETING_REQUEST_ACCEPTED:
|
||||
flag = Message.FLAG_OUTGOING_MEETING_ACCEPT;
|
||||
break;
|
||||
case EmailServiceConstants.MEETING_REQUEST_DECLINED:
|
||||
flag = Message.FLAG_OUTGOING_MEETING_DECLINE;
|
||||
break;
|
||||
case EmailServiceConstants.MEETING_REQUEST_TENTATIVE:
|
||||
default:
|
||||
flag = Message.FLAG_OUTGOING_MEETING_TENTATIVE;
|
||||
break;
|
||||
}
|
||||
Message outgoingMsg =
|
||||
CalendarUtilities.createMessageForEntity(mContext, entity,
|
||||
Message.FLAG_OUTGOING_MEETING_ACCEPT,
|
||||
CalendarUtilities.createMessageForEntity(mContext, entity, flag,
|
||||
meetingInfo.get(MeetingInfo.MEETING_UID), mAccount);
|
||||
// Assuming we got a message back (we might not if the event has been deleted), send it
|
||||
if (outgoingMsg != null) {
|
||||
@ -935,7 +948,7 @@ public class EasSyncService extends AbstractSyncService {
|
||||
InputStream is = res.getEntity().getContent();
|
||||
if (len != 0) {
|
||||
new MeetingResponseParser(is, this).parse();
|
||||
sendMeetingResponseMail(msg);
|
||||
sendMeetingResponseMail(msg, req.mResponse);
|
||||
}
|
||||
} else if (isAuthError(status)) {
|
||||
throw new EasAuthenticationException();
|
||||
|
Loading…
Reference in New Issue
Block a user