On Thu, 2013-04-11 at 18:30 +0400, Golikov Pavel wrote:
> This patch fixes USSD respose handling.
>     
> Some operators sends answer to USSD message with connection termination code.
> When the connection termination state recieved, we should check if we can 
> decode
> the answer string. If we can, we should return this string as answer instead 
> of error.

Looks good to me.  I'll wait for Aleksander's +1 too before we push.

Thanks!
Dan

> diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
> index abc5a5c..2036490 100644
> --- a/src/mm-broadband-modem.c
> +++ b/src/mm-broadband-modem.c
> @@ -4486,13 +4486,37 @@ cusd_process_string (MMBroadbandModem *self,
>              break;
>          }
>  
> -        case 2:
> -            if (self->priv->pending_ussd_action)
> -                g_simple_async_result_set_error 
> (self->priv->pending_ussd_action,
> -                                                 MM_CORE_ERROR,
> -                                                 MM_CORE_ERROR_CANCELLED,
> -                                                 "USSD terminated by 
> network.");
> +        case 2: /* Some operators can send response with connection 
> termination*/ {
> +            gchar *converted;
> +            GError *error = NULL;
> +
> +            converted = decode_ussd_response (self, str, &error);
> +            if (self->priv->pending_ussd_action) {
> +                /* Response to the user's request */
> +                if (error)
> +                    g_simple_async_result_set_error 
> (self->priv->pending_ussd_action,
> +                                                     MM_CORE_ERROR,
> +                                                     MM_CORE_ERROR_CANCELLED,
> +                                                     "USSD terminated by 
> network.");
> +                else
> +                    g_simple_async_result_set_op_res_gpointer 
> (self->priv->pending_ussd_action,
> +                                                               converted,
> +                                                               g_free);
> +            } else {
> +                if (error) {
> +                    mm_warn ("Invalid network initiated USSD notification: 
> %s",
> +                             error->message);
> +                    g_error_free (error);
> +                } else {
> +                    /* Network-initiated USSD-Notify */
> +                    mm_iface_modem_3gpp_ussd_update_network_notification (
> +                        MM_IFACE_MODEM_3GPP_USSD (self),
> +                        converted);
> +                    g_free (converted);
> +                }
> +            }
>              break;
> +        }
>  
>          case 4:
>              if (self->priv->pending_ussd_action)
> _______________________________________________
> networkmanager-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/networkmanager-list


_______________________________________________
networkmanager-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to