Bug 37358

Summary: TpChannel: high level API for SMS
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: enhancement    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://cgit.collabora.com/git/user/cassidy/telepathy-glib/log/?h=sms-37358
Whiteboard: EmpathyTpChat, review+
i915 platform: i915 features:
Bug Depends on: 36334    
Bug Blocks:    
Attachments: ExampleEcho2Channel: implement SMS interface
TpTextChannel: add TP_TEXT_CHANNEL_FEATURE_SMS (#37358)
ExampleEcho2Channel: add a simple implementation of SMS.GetSMSLength()
add tp_text_channel_get_sms_length_async()

Description Guillaume Desmottes 2011-05-19 04:43:55 UTC
We should have a featuer and high level API for http://telepathy.freedesktop.org/spec/Channel_Interface_SMS.html
Comment 1 Guillaume Desmottes 2011-05-20 02:56:47 UTC
Created attachment 46940 [details] [review]
ExampleEcho2Channel: implement SMS interface
Comment 2 Guillaume Desmottes 2011-05-20 02:56:51 UTC
Created attachment 46941 [details] [review]
TpTextChannel: add TP_TEXT_CHANNEL_FEATURE_SMS (#37358)
Comment 3 Guillaume Desmottes 2011-05-20 02:56:56 UTC
Created attachment 46942 [details] [review]
ExampleEcho2Channel: add a simple implementation of SMS.GetSMSLength()
Comment 4 Guillaume Desmottes 2011-05-20 02:56:59 UTC
Created attachment 46943 [details] [review]
add tp_text_channel_get_sms_length_async()
Comment 5 Danielle Madeley 2011-05-24 01:20:11 UTC
-      destroyable_iface_init)
+      destroyable_iface_init);
+    G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_SMS, sms_iface_init);

These macros shouldn't end with a ; because it breaks some compilers (ask smcv for details).

+set_property (GObject *object,
+              guint property_id,
+              const GValue *value,
+              GParamSpec *pspec)

Not in Telepathy style.

+      case PROP_SMS:
+        self->priv->sms = g_value_get_boolean (value);
+        break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;

Weird indenting.

Similarly both for get_property()

+  static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = {
+      { TP_IFACE_CHANNEL_INTERFACE_SMS,
+        tp_dbus_properties_mixin_getter_gobject_properties,
+        NULL,
+        sms_props,
+      },
+      { NULL }
+  };

+  klass->dbus_properties_class.interfaces = prop_interfaces;
+  tp_dbus_properties_mixin_class_init (object_class,
+      G_STRUCT_OFFSET (ExampleEcho2ChannelClass, dbus_properties_class));

TpBaseChannel already implements TpSvcDBusProperties, you can use tp_dbus_properties_mixin_implement_interface()

Personally, I don't think SMS needs to be a separate feature, that it's worth just having in CORE.

+  param_spec = g_param_spec_boolean ("is-sms",

is-sms-channel ?

+  if (error != NULL)
+    {
+      DEBUG ("Failed to get SMS length: %s", error->message);
+
+      g_simple_async_result_set_from_error (result, error);
+    }

missing goto finally; ?
Comment 6 Guillaume Desmottes 2011-05-24 02:28:27 UTC
(In reply to comment #5)
> -      destroyable_iface_init)
> +      destroyable_iface_init);
> +    G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_SMS, sms_iface_init);
> 
> These macros shouldn't end with a ; because it breaks some compilers (ask smcv
> for details).

Right, I already experienced that as well; removed.

> +set_property (GObject *object,
> +              guint property_id,
> +              const GValue *value,
> +              GParamSpec *pspec)
> 
> Not in Telepathy style.

fixed.

> +      case PROP_SMS:
> +        self->priv->sms = g_value_get_boolean (value);
> +        break;
> +    default:
> +      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
> +      break;
> 
> Weird indenting.
> 
> Similarly both for get_property()

fixed.

> +  static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = {
> +      { TP_IFACE_CHANNEL_INTERFACE_SMS,
> +        tp_dbus_properties_mixin_getter_gobject_properties,
> +        NULL,
> +        sms_props,
> +      },
> +      { NULL }
> +  };
> 
> +  klass->dbus_properties_class.interfaces = prop_interfaces;
> +  tp_dbus_properties_mixin_class_init (object_class,
> +      G_STRUCT_OFFSET (ExampleEcho2ChannelClass, dbus_properties_class));
> 
> TpBaseChannel already implements TpSvcDBusProperties, you can use
> tp_dbus_properties_mixin_implement_interface()

Oh good point; done.

> Personally, I don't think SMS needs to be a separate feature, that it's worth
> just having in CORE.

The general philosophy is to restrict CORE as much as possible. Users won't
have to care about the SMS feature as most of them will use the default
factory preparing this iface (actually I forgot to add it but I did now. :)

> +  param_spec = g_param_spec_boolean ("is-sms",
> 
> is-sms-channel ?

renamed.

> +  if (error != NULL)
> +    {
> +      DEBUG ("Failed to get SMS length: %s", error->message);
> +
> +      g_simple_async_result_set_from_error (result, error);
> +    }
> 
> missing goto finally; ?

Ooops; fixed.

http://cgit.collabora.com/git/user/cassidy/telepathy-glib/log/?h=sms-37358
updated
Comment 7 Danielle Madeley 2011-05-24 17:16:39 UTC
++

Consider squashing before merge.

The comments refer to properties added in #36334. We should get that merged too.
Comment 8 Guillaume Desmottes 2011-05-25 00:14:26 UTC
Rebased, I'll push once bug #36334 is fixed.
Comment 9 Guillaume Desmottes 2011-05-30 00:50:57 UTC
Fixed and merged to master; will be in 0.15.1

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.