Probably fixed the authentication process
This commit is contained in:
parent
0848f9bec2
commit
c831cbc9b2
@ -33,7 +33,8 @@ typedef enum _ModemAuthenticationMethod
|
|||||||
|
|
||||||
typedef enum _ModemAuthenticationStatus
|
typedef enum _ModemAuthenticationStatus
|
||||||
{
|
{
|
||||||
MODEM_AUTHENTICATION_STATUS_OK = 0,
|
MODEM_AUTHENTICATION_STATUS_UNKNOWN = 0,
|
||||||
|
MODEM_AUTHENTICATION_STATUS_OK,
|
||||||
MODEM_AUTHENTICATION_STATUS_REQUIRED,
|
MODEM_AUTHENTICATION_STATUS_REQUIRED,
|
||||||
MODEM_AUTHENTICATION_STATUS_ERROR
|
MODEM_AUTHENTICATION_STATUS_ERROR
|
||||||
} ModemAuthenticationStatus;
|
} ModemAuthenticationStatus;
|
||||||
|
10
po/fr.po
10
po/fr.po
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Phone 0.0.0\n"
|
"Project-Id-Version: Phone 0.0.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2011-08-21 15:59+0200\n"
|
"POT-Creation-Date: 2011-08-22 03:22+0200\n"
|
||||||
"PO-Revision-Date: 2010-04-24 02:07+0200\n"
|
"PO-Revision-Date: 2010-04-24 02:07+0200\n"
|
||||||
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
|
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
|
||||||
"Language-Team: DeforaOS development (French) <devel-fr@lists.defora.org>\n"
|
"Language-Team: DeforaOS development (French) <devel-fr@lists.defora.org>\n"
|
||||||
@ -311,21 +311,21 @@ msgstr "Le numéro ne peut être vide"
|
|||||||
msgid "Message sent"
|
msgid "Message sent"
|
||||||
msgstr "Message envoyé"
|
msgstr "Message envoyé"
|
||||||
|
|
||||||
#: ../src/phone.c:3736
|
#: ../src/phone.c:3728
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Wrong %s"
|
msgid "Wrong %s"
|
||||||
msgstr "Mauvais %s"
|
msgstr "Mauvais %s"
|
||||||
|
|
||||||
#: ../src/phone.c:3743
|
#: ../src/phone.c:3735
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%s is valid"
|
msgid "%s is valid"
|
||||||
msgstr "%s valide"
|
msgstr "%s valide"
|
||||||
|
|
||||||
#: ../src/phone.c:3806
|
#: ../src/phone.c:3800
|
||||||
msgid "Raw data (not shown)"
|
msgid "Raw data (not shown)"
|
||||||
msgstr "Données brutes (non affichées)"
|
msgstr "Données brutes (non affichées)"
|
||||||
|
|
||||||
#: ../src/phone.c:3839
|
#: ../src/phone.c:3833
|
||||||
msgid "Message deleted"
|
msgid "Message deleted"
|
||||||
msgstr "Message effacé"
|
msgstr "Message effacé"
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ static gboolean _on_watch_can_write(GIOChannel * source, GIOCondition condition,
|
|||||||
static gboolean _on_watch_can_write_ppp(GIOChannel * source,
|
static gboolean _on_watch_can_write_ppp(GIOChannel * source,
|
||||||
GIOCondition condition, gpointer data);
|
GIOCondition condition, gpointer data);
|
||||||
|
|
||||||
static HayesCommandStatus _on_request_authentication(HayesCommand * command,
|
static HayesCommandStatus _on_request_authenticate(HayesCommand * command,
|
||||||
HayesCommandStatus status, void * priv);
|
HayesCommandStatus status, void * priv);
|
||||||
static HayesCommandStatus _on_request_battery_level(HayesCommand * command,
|
static HayesCommandStatus _on_request_battery_level(HayesCommand * command,
|
||||||
HayesCommandStatus status, void * priv);
|
HayesCommandStatus status, void * priv);
|
||||||
@ -294,6 +294,8 @@ static HayesCommandStatus _on_request_message_send(HayesCommand * command,
|
|||||||
HayesCommandStatus status, void * priv);
|
HayesCommandStatus status, void * priv);
|
||||||
static HayesCommandStatus _on_request_model(HayesCommand * command,
|
static HayesCommandStatus _on_request_model(HayesCommand * command,
|
||||||
HayesCommandStatus status, void * priv);
|
HayesCommandStatus status, void * priv);
|
||||||
|
static HayesCommandStatus _on_request_sim_pin_valid(HayesCommand * command,
|
||||||
|
HayesCommandStatus status, void * priv);
|
||||||
static HayesCommandStatus _on_request_unsupported(HayesCommand * command,
|
static HayesCommandStatus _on_request_unsupported(HayesCommand * command,
|
||||||
HayesCommandStatus status, void * priv);
|
HayesCommandStatus status, void * priv);
|
||||||
|
|
||||||
@ -475,7 +477,7 @@ static HayesRequestHandler _hayes_request_handlers[] =
|
|||||||
{ HAYES_REQUEST_SIGNAL_LEVEL, "AT+CSQ",
|
{ HAYES_REQUEST_SIGNAL_LEVEL, "AT+CSQ",
|
||||||
_on_request_generic },
|
_on_request_generic },
|
||||||
{ HAYES_REQUEST_SIM_PIN_VALID, "AT+CPIN?",
|
{ HAYES_REQUEST_SIM_PIN_VALID, "AT+CPIN?",
|
||||||
_on_request_authentication },
|
_on_request_sim_pin_valid },
|
||||||
{ HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_CANCEL,"AT+CUSD=2",
|
{ HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_CANCEL,"AT+CUSD=2",
|
||||||
_on_request_generic },
|
_on_request_generic },
|
||||||
{ HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_DISABLE,"AT+CUSD=0",
|
{ HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_DISABLE,"AT+CUSD=0",
|
||||||
@ -491,7 +493,7 @@ static HayesRequestHandler _hayes_request_handlers[] =
|
|||||||
{ HAYES_REQUEST_VERSION, "AT+CGMR",
|
{ HAYES_REQUEST_VERSION, "AT+CGMR",
|
||||||
_on_request_model },
|
_on_request_model },
|
||||||
{ MODEM_REQUEST_AUTHENTICATE, NULL,
|
{ MODEM_REQUEST_AUTHENTICATE, NULL,
|
||||||
_on_request_authentication },
|
_on_request_authenticate },
|
||||||
{ MODEM_REQUEST_CALL, NULL,
|
{ MODEM_REQUEST_CALL, NULL,
|
||||||
_on_request_call_outgoing },
|
_on_request_call_outgoing },
|
||||||
{ MODEM_REQUEST_CALL_ANSWER, "ATA",
|
{ MODEM_REQUEST_CALL_ANSWER, "ATA",
|
||||||
@ -801,12 +803,11 @@ static char * _request_attention_call_hangup(ModemPlugin * modem)
|
|||||||
event->connection.in = 0;
|
event->connection.in = 0;
|
||||||
event->connection.out = 0;
|
event->connection.out = 0;
|
||||||
modem->helper->event(modem->helper->modem, event);
|
modem->helper->event(modem->helper->modem, event);
|
||||||
}
|
|
||||||
else
|
|
||||||
return strdup("ATH");
|
|
||||||
_hayes_set_mode(modem, HAYES_MODE_INIT);
|
_hayes_set_mode(modem, HAYES_MODE_INIT);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
return strdup("ATH");
|
||||||
|
}
|
||||||
|
|
||||||
static char * _request_attention_contact_delete(ModemPlugin * modem,
|
static char * _request_attention_contact_delete(ModemPlugin * modem,
|
||||||
unsigned int id)
|
unsigned int id)
|
||||||
@ -2186,8 +2187,8 @@ static gboolean _on_watch_can_write_ppp(GIOChannel * source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* on_request_authentication */
|
/* on_request_authenticate */
|
||||||
static HayesCommandStatus _on_request_authentication(HayesCommand * command,
|
static HayesCommandStatus _on_request_authenticate(HayesCommand * command,
|
||||||
HayesCommandStatus status, void * priv)
|
HayesCommandStatus status, void * priv)
|
||||||
{
|
{
|
||||||
ModemPlugin * modem = priv;
|
ModemPlugin * modem = priv;
|
||||||
@ -2209,31 +2210,9 @@ static HayesCommandStatus _on_request_authentication(HayesCommand * command,
|
|||||||
}
|
}
|
||||||
if(event->authentication.name != NULL)
|
if(event->authentication.name != NULL)
|
||||||
modem->helper->event(modem->helper->modem, event);
|
modem->helper->event(modem->helper->modem, event);
|
||||||
if(event->authentication.status == MODEM_AUTHENTICATION_STATUS_OK)
|
if(status == HCS_SUCCESS)
|
||||||
{
|
{
|
||||||
request.type = HAYES_REQUEST_OPERATOR_FORMAT_LONG;
|
request.type = HAYES_REQUEST_SIM_PIN_VALID;
|
||||||
_hayes_request(modem, &request);
|
|
||||||
request.type = HAYES_REQUEST_REGISTRATION_UNSOLLICITED_ENABLE;
|
|
||||||
_hayes_request(modem, &request);
|
|
||||||
request.type = MODEM_REQUEST_REGISTRATION;
|
|
||||||
request.registration.mode = MODEM_REGISTRATION_MODE_AUTOMATIC;
|
|
||||||
_hayes_request(modem, &request);
|
|
||||||
/* force a registration report */
|
|
||||||
request.type = HAYES_REQUEST_REGISTRATION;
|
|
||||||
_hayes_request(modem, &request);
|
|
||||||
/* report new messages */
|
|
||||||
request.type = HAYES_REQUEST_MESSAGE_UNSOLLICITED_ENABLE;
|
|
||||||
_hayes_request(modem, &request);
|
|
||||||
/* report new notifications */
|
|
||||||
request.type = HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_ENABLE;
|
|
||||||
_hayes_request(modem, &request);
|
|
||||||
/* refresh the current call status */
|
|
||||||
_hayes_trigger(modem, MODEM_EVENT_TYPE_CALL);
|
|
||||||
/* refresh the contact list */
|
|
||||||
request.type = MODEM_REQUEST_CONTACT_LIST;
|
|
||||||
_hayes_request(modem, &request);
|
|
||||||
/* refresh the message list */
|
|
||||||
request.type = MODEM_REQUEST_MESSAGE_LIST;
|
|
||||||
_hayes_request(modem, &request);
|
_hayes_request(modem, &request);
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
@ -2472,6 +2451,52 @@ static HayesCommandStatus _on_request_model(HayesCommand * command,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* on_request_sim_pin_valid */
|
||||||
|
static HayesCommandStatus _on_request_sim_pin_valid(HayesCommand * command,
|
||||||
|
HayesCommandStatus status, void * priv)
|
||||||
|
{
|
||||||
|
ModemPlugin * modem = priv;
|
||||||
|
Hayes * hayes = modem->priv;
|
||||||
|
ModemEvent * event = &hayes->events[MODEM_EVENT_TYPE_AUTHENTICATION];
|
||||||
|
ModemRequest request;
|
||||||
|
|
||||||
|
if((status = _on_request_generic(command, status, priv)) != HCS_SUCCESS)
|
||||||
|
return status;
|
||||||
|
modem->helper->event(modem->helper->modem, event);
|
||||||
|
/* return if not successful */
|
||||||
|
if(event->authentication.status != MODEM_AUTHENTICATION_STATUS_OK)
|
||||||
|
return status;
|
||||||
|
/* automatically register */
|
||||||
|
/* XXX should really wait for the telephony application for this */
|
||||||
|
memset(&request, 0, sizeof(&request));
|
||||||
|
request.type = HAYES_REQUEST_OPERATOR_FORMAT_LONG;
|
||||||
|
_hayes_request(modem, &request);
|
||||||
|
request.type = HAYES_REQUEST_REGISTRATION_UNSOLLICITED_ENABLE;
|
||||||
|
_hayes_request(modem, &request);
|
||||||
|
request.type = MODEM_REQUEST_REGISTRATION;
|
||||||
|
request.registration.mode = MODEM_REGISTRATION_MODE_AUTOMATIC;
|
||||||
|
_hayes_request(modem, &request);
|
||||||
|
/* force a registration report */
|
||||||
|
request.type = HAYES_REQUEST_REGISTRATION;
|
||||||
|
_hayes_request(modem, &request);
|
||||||
|
/* report new messages */
|
||||||
|
request.type = HAYES_REQUEST_MESSAGE_UNSOLLICITED_ENABLE;
|
||||||
|
_hayes_request(modem, &request);
|
||||||
|
/* report new notifications */
|
||||||
|
request.type = HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_ENABLE;
|
||||||
|
_hayes_request(modem, &request);
|
||||||
|
/* refresh the current call status */
|
||||||
|
_hayes_trigger(modem, MODEM_EVENT_TYPE_CALL);
|
||||||
|
/* refresh the contact list */
|
||||||
|
request.type = MODEM_REQUEST_CONTACT_LIST;
|
||||||
|
_hayes_request(modem, &request);
|
||||||
|
/* refresh the message list */
|
||||||
|
request.type = MODEM_REQUEST_MESSAGE_LIST;
|
||||||
|
_hayes_request(modem, &request);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* on_request_unsupported */
|
/* on_request_unsupported */
|
||||||
static HayesCommandStatus _on_request_unsupported(HayesCommand * command,
|
static HayesCommandStatus _on_request_unsupported(HayesCommand * command,
|
||||||
HayesCommandStatus status, void * priv)
|
HayesCommandStatus status, void * priv)
|
||||||
@ -3177,6 +3202,12 @@ static void _on_trigger_cpas(ModemPlugin * modem, char const * answer)
|
|||||||
case 0:
|
case 0:
|
||||||
event->call.status = MODEM_CALL_STATUS_NONE;
|
event->call.status = MODEM_CALL_STATUS_NONE;
|
||||||
event->call.direction = MODEM_CALL_DIRECTION_NONE;
|
event->call.direction = MODEM_CALL_DIRECTION_NONE;
|
||||||
|
/* report connection status */
|
||||||
|
event = &hayes->events[MODEM_EVENT_TYPE_CONNECTION];
|
||||||
|
event->connection.connected = 0;
|
||||||
|
event->connection.in = 0;
|
||||||
|
event->connection.out = 0;
|
||||||
|
modem->helper->event(modem->helper->modem, event);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
event->call.status = MODEM_CALL_STATUS_RINGING;
|
event->call.status = MODEM_CALL_STATUS_RINGING;
|
||||||
|
10
src/phone.c
10
src/phone.c
@ -3700,14 +3700,6 @@ static void _phone_modem_event(void * priv, ModemEvent * event)
|
|||||||
_phone_info(phone, phone->wr_window, _("Message sent"),
|
_phone_info(phone, phone->wr_window, _("Message sent"),
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
case MODEM_EVENT_TYPE_MODEL:
|
|
||||||
modem_request_type(phone->modem,
|
|
||||||
MODEM_REQUEST_CONTACT_LIST);
|
|
||||||
#ifndef DEBUG
|
|
||||||
/* FIXME this is clearly out of place */
|
|
||||||
_phone_track(phone, PHONE_TRACK_MESSAGE_LIST, TRUE);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
case MODEM_EVENT_TYPE_STATUS:
|
case MODEM_EVENT_TYPE_STATUS:
|
||||||
pevent.type = (event->status.online != 0)
|
pevent.type = (event->status.online != 0)
|
||||||
? PHONE_EVENT_TYPE_ONLINE
|
? PHONE_EVENT_TYPE_ONLINE
|
||||||
@ -3748,6 +3740,8 @@ static void _modem_event_authentication(Phone * phone, ModemEvent * event)
|
|||||||
== MODEM_AUTHENTICATION_METHOD_PIN)
|
== MODEM_AUTHENTICATION_METHOD_PIN)
|
||||||
phone_show_code(phone, TRUE, method, name);
|
phone_show_code(phone, TRUE, method, name);
|
||||||
break;
|
break;
|
||||||
|
case MODEM_AUTHENTICATION_STATUS_UNKNOWN:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user