diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-09-06 15:58:48 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-09-06 19:58:01 +0200 |
commit | a90d149ce476010747a32398df8b556ec597afb1 (patch) | |
tree | 474cab8192ad5176d457d950d101553519a8594b | |
parent | 11740e9075fd43009929c57b86d78d82c34aed78 (diff) |
sms: SMS objects need to be create by `create_modem()' in the Messaging iface
So that plugins can subclass the generic SMS object.
-rw-r--r-- | src/mm-broadband-modem.c | 11 | ||||
-rw-r--r-- | src/mm-iface-modem-messaging.c | 10 | ||||
-rw-r--r-- | src/mm-iface-modem-messaging.h | 5 | ||||
-rw-r--r-- | src/mm-sms.c | 10 |
4 files changed, 32 insertions, 4 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 06514c8f..2b2debd8 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -4859,6 +4859,15 @@ modem_messaging_load_initial_sms_parts (MMIfaceModemMessaging *self, } /*****************************************************************************/ +/* Create SMS (Messaging interface) */ + +static MMSms * +modem_messaging_create_sms (MMIfaceModemMessaging *self) +{ + return mm_sms_new (MM_BASE_MODEM (self)); +} + +/*****************************************************************************/ /* ESN loading (CDMA interface) */ static gchar * @@ -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 diff --git a/src/mm-iface-modem-messaging.c b/src/mm-iface-modem-messaging.c index 278a5ec7..75e42e47 100644 --- a/src/mm-iface-modem-messaging.c +++ b/src/mm-iface-modem-messaging.c @@ -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; diff --git a/src/mm-iface-modem-messaging.h b/src/mm-iface-modem-messaging.h index 66d2a7ae..23deafc7 100644 --- a/src/mm-iface-modem-messaging.h +++ b/src/mm-iface-modem-messaging.h @@ -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 */ diff --git a/src/mm-sms.c b/src/mm-sms.c index d9c5ac66..776615ca 100644 --- a/src/mm-sms.c +++ b/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, |