/* This file is part of anastasis-gtk. Copyright (C) 2020 Anastasis SARL Anastasis is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Anastasis; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @file src/anastasis/anastasis-gtk_handle-method-sms.c * @brief Handle dialogs for security sms * @author Christian Grothoff */ #include #include #include "anastasis-gtk_action.h" #include "anastasis-gtk_helper.h" #include "anastasis-gtk_handle-identity-changed.h" #include /** * Return obfuscated variant of a phone number. * * @param number input address * @return obfuscated version, NULL on errors */ static char * mask_number (const char *number) { char *at; size_t nlen; char *result; result = GNUNET_strdup (number); at = strchr (result, '+'); if ( (NULL != at) && (result != at) ) { GNUNET_break (0); GNUNET_free (result); return NULL; } nlen = strlen (number); if (NULL != at) { if (strlen (at) < 3) { GNUNET_break (0); GNUNET_free (result); return NULL; } at += 3; nlen -= 3; } else { at = result; } switch (nlen) { case 0: GNUNET_break (0); GNUNET_free (result); return NULL; case 1: at[0] = '?'; break; case 2: case 3: case 4: at[0] = '?'; at[1] = '?'; break; default: for (unsigned int i = 1; i