Пример #1
0
bool
MobileMessageCursorParent::RecvContinue()
{
  MOZ_ASSERT(mContinueCallback);

  if (NS_FAILED(mContinueCallback->HandleContinue())) {
    return NS_SUCCEEDED(NotifyCursorError(nsIMobileMessageCallback::INTERNAL_ERROR));
  }

  return true;
}
Пример #2
0
bool
MobileMessageCursorParent::DoRequest(const CreateThreadCursorRequest& aRequest)
{
  nsresult rv = NS_ERROR_FAILURE;

  nsCOMPtr<nsIMobileMessageDatabaseService> dbService =
    do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
  if (dbService) {
    rv = dbService->CreateThreadCursor(this,
                                       getter_AddRefs(mContinueCallback));
  }

  if (NS_FAILED(rv)) {
    return NS_SUCCEEDED(NotifyCursorError(nsIMobileMessageCallback::INTERNAL_ERROR));
  }

  return true;
}
Пример #3
0
bool
MobileMessageCursorParent::DoRequest(const CreateMessageCursorRequest& aRequest)
{
    nsresult rv = NS_ERROR_FAILURE;

    nsCOMPtr<nsIMobileMessageDatabaseService> dbService =
        do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
    if (dbService) {
        const SmsFilterData& filter = aRequest.filter();

        const nsTArray<nsString>& numbers = filter.numbers();
        UniquePtr<const char16_t*[]> ptrNumbers;
        uint32_t numbersCount = numbers.Length();
        if (numbersCount) {
            uint32_t index;

            ptrNumbers = MakeUnique<const char16_t*[]>(numbersCount);
            for (index = 0; index < numbersCount; index++) {
                ptrNumbers[index] = numbers[index].get();
            }
        }

        rv = dbService->CreateMessageCursor(filter.hasStartDate(),
                                            filter.startDate(),
                                            filter.hasEndDate(),
                                            filter.endDate(),
                                            ptrNumbers.get(), numbersCount,
                                            filter.delivery(),
                                            filter.hasRead(),
                                            filter.read(),
                                            filter.hasThreadId(),
                                            filter.threadId(),
                                            aRequest.reverse(),
                                            this,
                                            getter_AddRefs(mContinueCallback));
    }

    if (NS_FAILED(rv)) {
        return NS_SUCCEEDED(NotifyCursorError(nsIMobileMessageCallback::INTERNAL_ERROR));
    }

    return true;
}
Пример #4
0
NS_IMETHODIMP
MobileMessageCursorParent::NotifyCursorDone()
{
  return NotifyCursorError(nsIMobileMessageCallback::SUCCESS_NO_ERROR);
}