Exemplo n.º 1
0
bool
TelephonyCallGroup::CanConference(const TelephonyCall& aCall,
                                  TelephonyCall* aSecondCall)
{
  if (!aCall.Mergeable()) {
    return false;
  }

  if (!aSecondCall) {
    MOZ_ASSERT(!mCalls.IsEmpty());

    return (mCallState == nsITelephonyProvider::CALL_STATE_CONNECTED &&
            aCall.CallState() == nsITelephonyProvider::CALL_STATE_HELD) ||
           (mCallState == nsITelephonyProvider::CALL_STATE_HELD &&
            aCall.CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED);
  }

  MOZ_ASSERT(mCallState == nsITelephonyProvider::CALL_STATE_UNKNOWN);

  if (aCall.ServiceId() != aSecondCall->ServiceId()) {
    return false;
  }

  if (!aSecondCall->Mergeable()) {
    return false;
  }

  return (aCall.CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED &&
          aSecondCall->CallState() == nsITelephonyProvider::CALL_STATE_HELD) ||
         (aCall.CallState() == nsITelephonyProvider::CALL_STATE_HELD &&
          aSecondCall->CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED);
}
bool
TelephonyCallGroup::CanConference(const TelephonyCall& aCall,
                                  const TelephonyCall* aSecondCall)
{
  if (!aCall.Mergeable()) {
    return false;
  }

  if (!aSecondCall) {
    MOZ_ASSERT(!mCalls.IsEmpty());
    return (mState == TelephonyCallGroupState::Connected &&
            aCall.State() == TelephonyCallState::Held) ||
           (mState == TelephonyCallGroupState::Held &&
            aCall.State() == TelephonyCallState::Connected);
  }

  MOZ_ASSERT(mState != TelephonyCallGroupState::_empty);

  if (aCall.ServiceId() != aSecondCall->ServiceId()) {
    return false;
  }

  if (!aSecondCall->Mergeable()) {
    return false;
  }

  return (aCall.State() == TelephonyCallState::Connected &&
          aSecondCall->State() == TelephonyCallState::Held) ||
         (aCall.State() == TelephonyCallState::Held &&
          aSecondCall->State() == TelephonyCallState::Connected);
}