sms: SMS objects need to be create by `create_modem()' in the Messaging iface
So that plugins can subclass the generic SMS object.
This commit is contained in:
@@ -4858,6 +4858,15 @@ modem_messaging_load_initial_sms_parts (MMIfaceModemMessaging *self,
|
||||
ctx);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Create SMS (Messaging interface) */
|
||||
|
||||
static MMSms *
|
||||
modem_messaging_create_sms (MMIfaceModemMessaging *self)
|
||||
{
|
||||
return mm_sms_new (MM_BASE_MODEM (self));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ESN loading (CDMA interface) */
|
||||
|
||||
@@ -8046,7 +8055,7 @@ iface_modem_messaging_init (MMIfaceModemMessaging *iface)
|
||||
iface->enable_unsolicited_events_finish = modem_messaging_enable_unsolicited_events_finish;
|
||||
iface->cleanup_unsolicited_events = modem_messaging_cleanup_unsolicited_events;
|
||||
iface->cleanup_unsolicited_events_finish = modem_messaging_setup_cleanup_unsolicited_events_finish;
|
||||
iface->create_sms = mm_sms_new;
|
||||
iface->create_sms = modem_messaging_create_sms;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -39,6 +39,16 @@ mm_iface_modem_messaging_bind_simple_status (MMIfaceModemMessaging *self,
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMSms *
|
||||
mm_iface_modem_messaging_create_sms (MMIfaceModemMessaging *self)
|
||||
{
|
||||
g_assert (MM_IFACE_MODEM_MESSAGING (self)->create_sms != NULL);
|
||||
|
||||
return MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (self)->create_sms (self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
GArray *supported_mem1;
|
||||
GArray *supported_mem2;
|
||||
|
@@ -125,7 +125,7 @@ struct _MMIfaceModemMessaging {
|
||||
GError **error);
|
||||
|
||||
/* Create SMS objects */
|
||||
MMSms * (* create_sms) (MMBaseModem *self);
|
||||
MMSms * (* create_sms) (MMIfaceModemMessaging *self);
|
||||
};
|
||||
|
||||
GType mm_iface_modem_messaging_get_type (void);
|
||||
@@ -180,4 +180,7 @@ gboolean mm_iface_modem_messaging_set_preferred_storages_finish (MMIfaceModemMes
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* SMS creation */
|
||||
MMSms *mm_iface_modem_messaging_create_sms (MMIfaceModemMessaging *self);
|
||||
|
||||
#endif /* MM_IFACE_MODEM_MESSAGING_H */
|
||||
|
10
src/mm-sms.c
10
src/mm-sms.c
@@ -1126,7 +1126,10 @@ mm_sms_singlepart_new (MMBaseModem *modem,
|
||||
{
|
||||
MMSms *self;
|
||||
|
||||
self = mm_sms_new (modem);
|
||||
g_assert (MM_IS_IFACE_MODEM_MESSAGING (modem));
|
||||
|
||||
/* Create an SMS object as defined by the interface */
|
||||
self = mm_iface_modem_messaging_create_sms (MM_IFACE_MODEM_MESSAGING (modem));
|
||||
g_object_set (self,
|
||||
"state", state,
|
||||
"storage", storage,
|
||||
@@ -1155,12 +1158,15 @@ mm_sms_multipart_new (MMBaseModem *modem,
|
||||
{
|
||||
MMSms *self;
|
||||
|
||||
g_assert (MM_IS_IFACE_MODEM_MESSAGING (modem));
|
||||
|
||||
/* If this is the first part of a RECEIVED SMS, we overwrite the state
|
||||
* as RECEIVING, to indicate that it is not completed yet. */
|
||||
if (state == MM_SMS_STATE_RECEIVED)
|
||||
state = MM_SMS_STATE_RECEIVING;
|
||||
|
||||
self = mm_sms_new (modem);
|
||||
/* Create an SMS object as defined by the interface */
|
||||
self = mm_iface_modem_messaging_create_sms (MM_IFACE_MODEM_MESSAGING (modem));
|
||||
g_object_set (self,
|
||||
MM_SMS_IS_MULTIPART, TRUE,
|
||||
MM_SMS_MAX_PARTS, max_parts,
|
||||
|
Reference in New Issue
Block a user