]> git.0d.be Git - empathy.git/commitdiff
Use tp-glib SMS high level API (#651242)
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 27 May 2011 13:13:34 +0000 (15:13 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 1 Jun 2011 10:02:52 +0000 (12:02 +0200)
libempathy-gtk/empathy-chat.c
libempathy/empathy-tp-chat.c
libempathy/empathy-tp-chat.h
src/empathy-chat-manager.c

index f026bbc8ee80f5676fb4f88f580cdecc3303347e..533b1e75138ca7550352d1088d1ca46d26dd943f 100644 (file)
@@ -3642,7 +3642,8 @@ chat_sms_channel_changed_cb (EmpathyChat *self)
 {
        EmpathyChatPriv *priv = GET_PRIV (self);
 
-       priv->sms_channel = empathy_tp_chat_is_sms_channel (priv->tp_chat);
+       priv->sms_channel = tp_text_channel_is_sms_channel (
+               (TpTextChannel *) priv->tp_chat);
        g_object_notify (G_OBJECT (self), "sms-channel");
 }
 
@@ -3703,7 +3704,7 @@ empathy_chat_set_tp_chat (EmpathyChat   *chat,
        g_signal_connect_swapped (tp_chat, "notify::password-needed",
                                  G_CALLBACK (chat_password_needed_changed_cb),
                                  chat);
-       g_signal_connect_swapped (tp_chat, "notify::sms-channel",
+       g_signal_connect_swapped (tp_chat, "notify::is-sms-channel",
                                  G_CALLBACK (chat_sms_channel_changed_cb),
                                  chat);
        g_signal_connect_swapped (tp_chat, "notify::n-messages-sending",
index 02bdc80e396eaf124204ac23f0e023ce11183ced..5d4ce26f7f3b14cf00c8bce3df42d73045b8d329 100644 (file)
@@ -54,8 +54,6 @@ struct _EmpathyTpChatPrivate {
         * (channel doesn't implement the Password interface) */
        gboolean               got_password_flags;
        gboolean               can_upgrade_to_muc;
-       gboolean               got_sms_channel;
-       gboolean               sms_channel;
 
        GHashTable            *messages_being_sent;
 
@@ -70,7 +68,6 @@ enum {
        PROP_ACCOUNT,
        PROP_REMOTE_CONTACT,
        PROP_PASSWORD_NEEDED,
-       PROP_SMS_CHANNEL,
        PROP_N_MESSAGES_SENDING,
 };
 
@@ -872,9 +869,6 @@ check_almost_ready (EmpathyTpChat *self)
        if (!self->priv->got_password_flags)
                return;
 
-       if (!self->priv->got_sms_channel)
-               return;
-
        /* We need either the members (room) or the remote contact (private chat).
         * If the chat is protected by a password we can't get these information so
         * consider the chat as ready so it can be presented to the user. */
@@ -1264,41 +1258,6 @@ got_password_flags_cb (TpChannel *proxy,
        check_almost_ready (EMPATHY_TP_CHAT (self));
 }
 
-static void
-sms_channel_changed_cb (TpChannel *channel,
-                       gboolean   sms_channel,
-                       gpointer   user_data,
-                       GObject   *chat)
-{
-       EmpathyTpChat *self = (EmpathyTpChat *) chat;
-
-       self->priv->sms_channel = sms_channel;
-
-       g_object_notify (G_OBJECT (chat), "sms-channel");
-}
-
-static void
-get_sms_channel_cb (TpProxy      *channel,
-                   const GValue *value,
-                   const GError *in_error,
-                   gpointer      user_data,
-                   GObject      *chat)
-{
-       EmpathyTpChat *self = (EmpathyTpChat *) chat;
-
-       if (in_error != NULL) {
-               DEBUG ("Failed to get SMSChannel: %s", in_error->message);
-               return;
-       }
-
-       g_return_if_fail (G_VALUE_HOLDS_BOOLEAN (value));
-
-       self->priv->sms_channel = g_value_get_boolean (value);
-       self->priv->got_sms_channel = TRUE;
-
-       check_almost_ready (EMPATHY_TP_CHAT (chat));
-}
-
 static void
 tp_chat_get_property (GObject    *object,
                      guint       param_id,
@@ -1317,9 +1276,6 @@ tp_chat_get_property (GObject    *object,
        case PROP_PASSWORD_NEEDED:
                g_value_set_boolean (value, empathy_tp_chat_password_needed (self));
                break;
-       case PROP_SMS_CHANNEL:
-               g_value_set_boolean (value, self->priv->sms_channel);
-               break;
        case PROP_N_MESSAGES_SENDING:
                g_value_set_uint (value,
                        g_hash_table_size (self->priv->messages_being_sent));
@@ -1413,14 +1369,6 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass)
                                                               FALSE,
                                                               G_PARAM_READABLE));
 
-       g_object_class_install_property (object_class,
-                                        PROP_SMS_CHANNEL,
-                                        g_param_spec_boolean ("sms-channel",
-                                                              "SMS Channel",
-                                                              "TRUE if channel is for sending SMSes",
-                                                              FALSE,
-                                                              G_PARAM_READABLE));
-
        g_object_class_install_property (object_class,
                                         PROP_N_MESSAGES_SENDING,
                                         g_param_spec_uint ("n-messages-sending",
@@ -1805,15 +1753,6 @@ empathy_tp_chat_get_self_contact (EmpathyTpChat *self)
        return self->priv->user;
 }
 
-
-gboolean
-empathy_tp_chat_is_sms_channel (EmpathyTpChat *self)
-{
-       g_return_val_if_fail (EMPATHY_IS_TP_CHAT (self), FALSE);
-
-       return self->priv->sms_channel;
-}
-
 GQuark
 empathy_tp_chat_get_feature_ready (void)
 {
@@ -1926,21 +1865,6 @@ conn_prepared_cb (GObject *source,
                /* No Password interface, so no need to fetch the password flags */
                self->priv->got_password_flags = TRUE;
        }
-
-       /* Check if the chat is for SMS */
-       if (tp_proxy_has_interface_by_id (channel,
-                                         TP_IFACE_QUARK_CHANNEL_INTERFACE_SMS)) {
-               tp_cli_channel_interface_sms_connect_to_sms_channel_changed (
-                       channel,
-                       sms_channel_changed_cb, self, NULL, G_OBJECT (self), NULL);
-
-               tp_cli_dbus_properties_call_get (channel, -1,
-                       TP_IFACE_CHANNEL_INTERFACE_SMS, "SMSChannel",
-                       get_sms_channel_cb, self, NULL, G_OBJECT (self));
-       } else {
-               /* if there's no SMS support, then we're not waiting for it */
-               self->priv->got_sms_channel = TRUE;
-       }
 }
 
 static void
index de55c1a8cf04e9605c1ddf8e1388be12b4b5ecc0..20ba02a6829af8de1a314e2bad5966840959fdbd 100644 (file)
@@ -121,8 +121,6 @@ TpChannelChatState
 
 EmpathyContact * empathy_tp_chat_get_self_contact   (EmpathyTpChat      *self);
 
-gboolean       empathy_tp_chat_is_sms_channel       (EmpathyTpChat      *chat);
-
 G_END_DECLS
 
 #endif /* __EMPATHY_TP_CHAT_H__ */
index 4ed26af30c598a0ba7f227edf0523691c9f43c3e..e6ffaa0e926deb2c42c460fb8b065a6b4567b476 100644 (file)
@@ -148,7 +148,7 @@ process_tp_chat (EmpathyChatManager *self,
   if (!tp_str_empty (id))
     {
       chat = empathy_chat_window_find_chat (account, id,
-          empathy_tp_chat_is_sms_channel (tp_chat));
+          tp_text_channel_is_sms_channel ((TpTextChannel *) tp_chat));
     }
 
   if (chat != NULL)