OCA\OcSms\Controller\SmsController::deleteConversation PHP Method

deleteConversation() public method

public deleteConversation ( $contact ) : OCP\AppFramework\Http\JSONResponse
$contact
return OCP\AppFramework\Http\JSONResponse
    public function deleteConversation($contact)
    {
        $contacts = $this->contactCache->getContacts();
        $iContacts = $this->contactCache->getInvertedContacts();
        $contactName = "";
        // Cache country because of loops
        $configuredCountry = $this->configMapper->getCountry();
        $fmtPN = PhoneNumberFormatter::format($configuredCountry, $contact);
        if (isset($contacts[$fmtPN])) {
            $contactName = $contacts[$fmtPN];
        }
        // Contact resolved
        if ($contactName != "" && isset($iContacts[$contactName])) {
            // forall numbers in iContacts
            foreach ($iContacts[$contactName] as $cnumber) {
                $this->smsMapper->removeMessagesForPhoneNumber($this->userId, $cnumber);
            }
        } else {
            $this->smsMapper->removeMessagesForPhoneNumber($this->userId, $contact);
        }
        return new JSONResponse(array());
    }