bool SmsRequestChild::Recv__delete__(const MessageReply& aReply) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mReplyRequest); nsCOMPtr<SmsMessage> message; switch(aReply.type()) { case MessageReply::TReplyMessageSend: { const MobileMessageData& data = aReply.get_ReplyMessageSend().messageData(); nsCOMPtr<nsISupports> msg = CreateMessageFromMessageData(data); mReplyRequest->NotifyMessageSent(msg); } break; case MessageReply::TReplyMessageSendFail: mReplyRequest->NotifySendMessageFailed(aReply.get_ReplyMessageSendFail().error()); break; case MessageReply::TReplyGetMessage: { const MobileMessageData& data = aReply.get_ReplyGetMessage().messageData(); nsCOMPtr<nsISupports> msg = CreateMessageFromMessageData(data); mReplyRequest->NotifyMessageGot(msg); } break; case MessageReply::TReplyGetMessageFail: mReplyRequest->NotifyGetMessageFailed(aReply.get_ReplyGetMessageFail().error()); break; case MessageReply::TReplyMessageDelete: { const InfallibleTArray<bool>& deletedResult = aReply.get_ReplyMessageDelete().deleted(); mReplyRequest->NotifyMessageDeleted(const_cast<bool *>(deletedResult.Elements()), deletedResult.Length()); } break; case MessageReply::TReplyMessageDeleteFail: mReplyRequest->NotifyDeleteMessageFailed(aReply.get_ReplyMessageDeleteFail().error()); break; case MessageReply::TReplyMarkeMessageRead: mReplyRequest->NotifyMessageMarkedRead(aReply.get_ReplyMarkeMessageRead().read()); break; case MessageReply::TReplyMarkeMessageReadFail: mReplyRequest->NotifyMarkMessageReadFailed(aReply.get_ReplyMarkeMessageReadFail().error()); break; default: MOZ_NOT_REACHED("Received invalid response parameters!"); return false; } return true; }
bool SmsRequestChild::Recv__delete__(const MessageReply& aReply) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mReplyRequest); nsCOMPtr<SmsMessage> message; switch(aReply.type()) { case MessageReply::TReplyMessageSend: message = new SmsMessage(aReply.get_ReplyMessageSend().messageData()); mReplyRequest->NotifyMessageSent(message); break; case MessageReply::TReplyMessageSendFail: mReplyRequest->NotifySendMessageFailed(aReply.get_ReplyMessageSendFail().error()); break; case MessageReply::TReplyGetMessage: message = new SmsMessage(aReply.get_ReplyGetMessage().messageData()); mReplyRequest->NotifyMessageGot(message); break; case MessageReply::TReplyGetMessageFail: mReplyRequest->NotifyGetMessageFailed(aReply.get_ReplyGetMessageFail().error()); break; case MessageReply::TReplyMessageDelete: mReplyRequest->NotifyMessageDeleted(aReply.get_ReplyMessageDelete().deleted()); break; case MessageReply::TReplyMessageDeleteFail: mReplyRequest->NotifyMessageDeleted(aReply.get_ReplyMessageDeleteFail().error()); break; case MessageReply::TReplyNoMessageInList: mReplyRequest->NotifyNoMessageInList(); break; case MessageReply::TReplyCreateMessageList: message = new SmsMessage(aReply.get_ReplyCreateMessageList().messageData()); mReplyRequest->NotifyMessageListCreated(aReply.get_ReplyCreateMessageList().listId(), message); break; case MessageReply::TReplyCreateMessageListFail: mReplyRequest->NotifyReadMessageListFailed(aReply.get_ReplyCreateMessageListFail().error()); break; case MessageReply::TReplyGetNextMessage: message = new SmsMessage(aReply.get_ReplyGetNextMessage().messageData()); mReplyRequest->NotifyNextMessageInListGot(message); break; case MessageReply::TReplyMarkeMessageRead: mReplyRequest->NotifyMessageMarkedRead(aReply.get_ReplyMarkeMessageRead().read()); break; case MessageReply::TReplyMarkeMessageReadFail: mReplyRequest->NotifyMarkMessageReadFailed(aReply.get_ReplyMarkeMessageReadFail().error()); break; case MessageReply::TReplyThreadList: { SmsRequestForwarder* forwarder = static_cast<SmsRequestForwarder*>(mReplyRequest.get()); SmsRequest* request = static_cast<SmsRequest*>(forwarder->GetRealRequest()); request->NotifyThreadList(aReply.get_ReplyThreadList().items()); } break; case MessageReply::TReplyThreadListFail: mReplyRequest->NotifyThreadListFailed(aReply.get_ReplyThreadListFail().error()); break; default: MOZ_NOT_REACHED("Received invalid response parameters!"); return false; } return true; }
bool SmsRequestChild::Recv__delete__(const MessageReply& aReply) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mReplyRequest); nsCOMPtr<SmsMessage> message; switch(aReply.type()) { case MessageReply::TReplyMessageSend: { const MobileMessageData& data = aReply.get_ReplyMessageSend().messageData(); nsCOMPtr<nsISupports> msg = CreateMessageFromMessageData(data); mReplyRequest->NotifyMessageSent(msg); } break; case MessageReply::TReplyMessageSendFail: { const ReplyMessageSendFail &replyFail = aReply.get_ReplyMessageSendFail(); nsCOMPtr<nsISupports> msg; if (replyFail.messageData().type() == OptionalMobileMessageData::TMobileMessageData) { msg = CreateMessageFromMessageData( replyFail.messageData().get_MobileMessageData()); } mReplyRequest->NotifySendMessageFailed(replyFail.error(), msg); } break; case MessageReply::TReplyGetMessage: { const MobileMessageData& data = aReply.get_ReplyGetMessage().messageData(); nsCOMPtr<nsISupports> msg = CreateMessageFromMessageData(data); mReplyRequest->NotifyMessageGot(msg); } break; case MessageReply::TReplyGetMessageFail: mReplyRequest->NotifyGetMessageFailed(aReply.get_ReplyGetMessageFail().error()); break; case MessageReply::TReplyMessageDelete: { const InfallibleTArray<bool>& deletedResult = aReply.get_ReplyMessageDelete().deleted(); mReplyRequest->NotifyMessageDeleted(const_cast<bool *>(deletedResult.Elements()), deletedResult.Length()); } break; case MessageReply::TReplyMessageDeleteFail: mReplyRequest->NotifyDeleteMessageFailed(aReply.get_ReplyMessageDeleteFail().error()); break; case MessageReply::TReplyMarkeMessageRead: mReplyRequest->NotifyMessageMarkedRead(aReply.get_ReplyMarkeMessageRead().read()); break; case MessageReply::TReplyMarkeMessageReadFail: mReplyRequest->NotifyMarkMessageReadFailed(aReply.get_ReplyMarkeMessageReadFail().error()); break; case MessageReply::TReplyGetSegmentInfoForText: { const ReplyGetSegmentInfoForText& reply = aReply.get_ReplyGetSegmentInfoForText(); mReplyRequest->NotifySegmentInfoForTextGot(reply.segments(), reply.charsPerSegment(), reply.charsAvailableInLastSegment()); } break; case MessageReply::TReplyGetSegmentInfoForTextFail: mReplyRequest->NotifyGetSegmentInfoForTextFailed( aReply.get_ReplyGetSegmentInfoForTextFail().error()); break; case MessageReply::TReplyGetSmscAddress: mReplyRequest->NotifyGetSmscAddress(aReply.get_ReplyGetSmscAddress().smscAddress()); break; case MessageReply::TReplyGetSmscAddressFail: mReplyRequest->NotifyGetSmscAddressFailed(aReply.get_ReplyGetSmscAddressFail().error()); break; default: MOZ_CRASH("Received invalid response parameters!"); } return true; }