[telepathy-account-widgets] Remove Facebook XMPP support



commit dc0e9ed7d58fbcedadac21704c83ca472a414ceb
Author: ballogyor gmail com <ballogyor gmail com>
Date:   Fri Feb 3 18:08:58 2017 +0100

    Remove Facebook XMPP support
    
    The service is discontinued in 2015:
    https://developers.facebook.com/docs/chat
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747623

 tp-account-widgets/tpaw-account-widget-jabber.ui |  129 -------------------
 tp-account-widgets/tpaw-account-widget.c         |  150 +---------------------
 tp-account-widgets/tpaw-protocol.c               |   25 ----
 tp-account-widgets/tpaw-utils.c                  |    2 +-
 4 files changed, 5 insertions(+), 301 deletions(-)
---
diff --git a/tp-account-widgets/tpaw-account-widget-jabber.ui 
b/tp-account-widgets/tpaw-account-widget-jabber.ui
index a02b2f9..aa14eed 100644
--- a/tp-account-widgets/tpaw-account-widget-jabber.ui
+++ b/tp-account-widgets/tpaw-account-widget-jabber.ui
@@ -12,112 +12,6 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
-  <object class="GtkVBox" id="vbox_fb_simple">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkLabel" id="label_id_fb_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your Facebook username?</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkVBox" id="vbox2">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="margin_left">12</property>
-        <child>
-          <object class="GtkEntry" id="entry_id_fb_simple">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_fb_example">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="margin_top">4</property>
-            <property name="xalign">0.10000000149011612</property>
-            <property name="label" translatable="yes">This is your username, not your normal Facebook login.
-If you are facebook.com/&lt;b&gt;badger&lt;/b&gt;, enter &lt;b&gt;badger&lt;/b&gt;.
-Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to choose a Facebook username if 
you don’t have one.</property>
-            <property name="use_markup">True</property>
-            <attributes>
-              <attribute name="scale" value="0.80000000000000004"/>
-            </attributes>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_password_fb_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="ypad">6</property>
-        <property name="label" translatable="yes">What is your Facebook password?</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkEntry" id="entry_password_fb_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="margin_left">12</property>
-        <property name="visibility">False</property>
-        <property name="hexpand">True</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="remember_password_fb_simple">
-        <property name="label" translatable="yes">Remember password</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="use_action_appearance">False</property>
-        <property name="xalign">0</property>
-        <property name="active">True</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">4</property>
-      </packing>
-    </child>
-  </object>
   <object class="GtkVBox" id="vbox_gtalk_simple">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -311,29 +205,6 @@ Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to cho
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label_username_f_example">
-                <property name="can_focus">False</property>
-                <property name="valign">start</property>
-                <property name="hexpand">True</property>
-                <property name="xalign">0</property>
-                <property name="xpad">3</property>
-                <property name="label" translatable="yes" comments="This string is not wrapped in the dialog 
so you may have to add some '\n' to make it look nice.">This is your username, not your normal Facebook login.
-If you are facebook.com/&lt;b&gt;badger&lt;/b&gt;, enter &lt;b&gt;badger&lt;/b&gt;.
-Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to choose a Facebook username if 
you don’t have one.</property>
-                <property name="use_markup">True</property>
-                <property name="wrap">True</property>
-                <attributes>
-                  <attribute name="scale" value="0.80000000000000004"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
               <placeholder/>
             </child>
             <child>
diff --git a/tp-account-widgets/tpaw-account-widget.c b/tp-account-widgets/tpaw-account-widget.c
index b225246..a18a1d0 100644
--- a/tp-account-widgets/tpaw-account-widget.c
+++ b/tp-account-widgets/tpaw-account-widget.c
@@ -45,7 +45,6 @@ typedef enum
 {
   NO_SERVICE = 0,
   GTALK_SERVICE,
-  FACEBOOK_SERVICE,
   N_SERVICES
 } Service;
 
@@ -58,7 +57,6 @@ typedef struct
 static ServiceInfo services_infos[N_SERVICES] = {
     { "label_username_example", TRUE },
     { "label_username_g_example", FALSE },
-    { "label_username_f_example", FALSE },
 };
 
 struct _TpawAccountWidgetPriv {
@@ -104,10 +102,6 @@ struct _TpawAccountWidgetPriv {
 
   /* Used only for IRC accounts */
   TpawIrcNetworkChooser *irc_network_chooser;
-
-  /* Used for 'special' XMPP account having a service associated ensuring that
-   * JIDs have a specific suffix; such as Facebook for example */
-  gchar *jid_suffix;
 };
 
 enum {
@@ -1198,80 +1192,6 @@ account_widget_build_msn (TpawAccountWidget *self,
   return box;
 }
 
-static void
-suffix_id_widget_changed_cb (GtkWidget *entry,
-    TpawAccountWidget *self)
-{
-  gchar *account;
-
-  g_assert (self->priv->jid_suffix != NULL);
-
-  account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE);
-
-  account = tpaw_account_settings_dup_string (self->priv->settings,
-      "account");
-
-  if (!TPAW_STR_EMPTY (account) &&
-      !g_str_has_suffix (account, self->priv->jid_suffix))
-    {
-      gchar *tmp;
-
-      tmp = g_strdup_printf ("%s%s", account, self->priv->jid_suffix);
-
-      DEBUG ("Change account from '%s' to '%s'", account, tmp);
-
-      tpaw_account_settings_set (self->priv->settings, "account",
-          g_variant_new_string (tmp));
-      g_free (tmp);
-    }
-
-  tpaw_account_widget_changed (self);
-
-  g_free (account);
-}
-
-static gchar *
-remove_jid_suffix (TpawAccountWidget *self,
-    const gchar *str)
-{
-  g_assert (self->priv->jid_suffix != NULL);
-
-  if (!g_str_has_suffix (str, self->priv->jid_suffix))
-    return g_strdup (str);
-
-  return g_strndup (str, strlen (str) - strlen (self->priv->jid_suffix));
-}
-
-static void
-setup_id_widget_with_suffix (TpawAccountWidget *self,
-    GtkWidget *widget,
-    const gchar *suffix)
-{
-  gchar *str = NULL;
-
-  g_object_set_data_full (G_OBJECT (widget), "param_name",
-      g_strdup ("account"), g_free);
-
-  g_assert (self->priv->jid_suffix == NULL);
-  self->priv->jid_suffix = g_strdup (suffix);
-
-  str = tpaw_account_settings_dup_string (self->priv->settings, "account");
-  if (str != NULL)
-    {
-      gchar *tmp;
-
-      tmp = remove_jid_suffix (self, str);
-      gtk_entry_set_text (GTK_ENTRY (widget), tmp);
-      g_free (tmp);
-      g_free (str);
-    }
-
-  self->priv->param_account_widget = widget;
-
-  g_signal_connect (widget, "changed",
-      G_CALLBACK (suffix_id_widget_changed_cb), self);
-}
-
 static Service
 account_widget_get_service (TpawAccountWidget *self)
 {
@@ -1280,16 +1200,12 @@ account_widget_get_service (TpawAccountWidget *self)
   icon_name = tpaw_account_settings_get_icon_name (self->priv->settings);
   service = tpaw_account_settings_get_service (self->priv->settings);
 
-  /* Previous versions of Tpaw didn't set the Service property on Facebook
-   * and gtalk accounts, so we check using the icon name as well. */
+  /* Previous versions of Tpaw didn't set the Service property on gtalk
+   * account, so we check using the icon name as well. */
   if (!tp_strdiff (icon_name, "im-google-talk") ||
       !tp_strdiff (service, "google-talk"))
     return GTALK_SERVICE;
 
-  if (!tp_strdiff (icon_name, "im-facebook") ||
-      !tp_strdiff (service, "facebook"))
-    return FACEBOOK_SERVICE;
-
   return NO_SERVICE;
 }
 
@@ -1300,7 +1216,6 @@ account_widget_build_jabber (TpawAccountWidget *self,
   GtkWidget *spinbutton_port;
   GtkWidget *checkbutton_ssl;
   GtkWidget *label_id, *label_password;
-  GtkWidget *label_example_fb;
   GtkWidget *label_example;
   GtkWidget *expander_advanced;
   GtkWidget *entry_id;
@@ -1350,37 +1265,16 @@ account_widget_build_jabber (TpawAccountWidget *self,
           gtk_builder_get_object (self->ui_details->gui,
             "remember_password_g_simple"));
     }
-  else if (self->priv->simple && service == FACEBOOK_SERVICE)
-    {
-      /* Simple widget for Facebook */
-      self->ui_details->gui = tpaw_builder_get_resource (filename,
-          "vbox_fb_simple", &box,
-          "entry_id_fb_simple", &entry_id,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_password_fb_simple", "password",
-          NULL);
-
-      setup_id_widget_with_suffix (self, entry_id, "@chat.facebook.com");
-
-      self->ui_details->default_focus = g_strdup ("entry_id_fb_simple");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui,
-            "remember_password_fb_simple"));
-    }
   else
     {
       ServiceInfo info = services_infos[service];
 
-      /* Full widget for XMPP, Google Talk and Facebook*/
+      /* Full widget for XMPP and Google Talk */
       self->ui_details->gui = tpaw_builder_get_resource (filename,
           "grid_common_settings", &self->priv->grid_common_settings,
           "vbox_jabber_settings", &box,
           "spinbutton_port", &spinbutton_port,
           "checkbutton_ssl", &checkbutton_ssl,
-          "label_username_f_example", &label_example_fb,
           info.label_username_example, &label_example,
           "expander_advanced", &expander_advanced,
           "entry_id", &entry_id,
@@ -1398,18 +1292,7 @@ account_widget_build_jabber (TpawAccountWidget *self,
           "checkbutton_encryption", "require-encryption",
           NULL);
 
-      if (service == FACEBOOK_SERVICE)
-        {
-          gtk_label_set_label (GTK_LABEL (label_id), _("Username:"));
-
-          /* Facebook special case the entry ID widget to hide the
-           * "@chat.facebook.com" part */
-          setup_id_widget_with_suffix (self, entry_id, "@chat.facebook.com");
-        }
-      else
-        {
-          tpaw_account_widget_setup_widget (self, entry_id, "account");
-        }
+      tpaw_account_widget_setup_widget (self, entry_id, "account");
 
       self->ui_details->default_focus = g_strdup ("entry_id");
       self->priv->spinbutton_port = spinbutton_port;
@@ -1421,19 +1304,6 @@ account_widget_build_jabber (TpawAccountWidget *self,
           G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
           self);
 
-      if (service == FACEBOOK_SERVICE)
-        {
-          GtkContainer *parent;
-          GList *children;
-
-          /* Removing the label from list of focusable widgets */
-          parent = GTK_CONTAINER (gtk_widget_get_parent (label_example_fb));
-          children = gtk_container_get_children (parent);
-          children = g_list_remove (children, label_example_fb);
-          gtk_container_set_focus_chain (parent, children);
-          g_list_free (children);
-        }
-
       gtk_widget_show (label_example);
 
       if (!info.show_advanced)
@@ -2000,8 +1870,6 @@ do_finalize (GObject *obj)
   g_free (self->ui_details->default_focus);
   g_slice_free (TpawAccountWidgetUIDetails, self->ui_details);
 
-  g_free (self->priv->jid_suffix);
-
   if (G_OBJECT_CLASS (tpaw_account_widget_parent_class)->finalize != NULL)
     G_OBJECT_CLASS (tpaw_account_widget_parent_class)->finalize (obj);
 }
@@ -2150,12 +2018,10 @@ tpaw_account_widget_get_default_display_name (TpawAccountWidget *self)
   gchar *login_id;
   const gchar *protocol, *p;
   gchar *default_display_name;
-  Service service;
 
   login_id = tpaw_account_settings_dup_string (self->priv->settings,
       "account");
   protocol = tpaw_account_settings_get_protocol (self->priv->settings);
-  service = account_widget_get_service (self);
 
   if (login_id != NULL)
     {
@@ -2176,14 +2042,6 @@ tpaw_account_widget_get_default_display_name (TpawAccountWidget *self)
           default_display_name = g_strdup_printf (_("%1$s on %2$s"),
               login_id, tpaw_irc_network_get_name (network));
         }
-      else if (service == FACEBOOK_SERVICE && self->priv->jid_suffix != NULL)
-        {
-          gchar *tmp;
-
-          tmp = remove_jid_suffix (self, login_id);
-          default_display_name = g_strdup_printf ("Facebook (%s)", tmp);
-          g_free (tmp);
-        }
       else
         {
           default_display_name = g_strdup (login_id);
diff --git a/tp-account-widgets/tpaw-protocol.c b/tp-account-widgets/tpaw-protocol.c
index 51d7a46..0e98bb9 100644
--- a/tp-account-widgets/tpaw-protocol.c
+++ b/tp-account-widgets/tpaw-protocol.c
@@ -98,21 +98,6 @@ tpaw_protocol_create_account_settings (TpawProtocol *self)
               g_variant_new_strv (extra_certificate_identities, -1));
         }
     }
-  else if (!tp_strdiff (self->priv->service_name, "facebook"))
-    {
-      const gchar *fallback_servers[] = {
-          "chat.facebook.com:443",
-          NULL };
-
-      tpaw_account_settings_set_icon_name_async (settings, "im-facebook",
-          NULL, NULL);
-      tpaw_account_settings_set (settings, "require-encryption",
-          g_variant_new_boolean (TRUE));
-      tpaw_account_settings_set (settings, "server",
-          g_variant_new_string ("chat.facebook.com"));
-      tpaw_account_settings_set (settings, "fallback-servers",
-          g_variant_new_strv (fallback_servers, -1));
-    }
 
   return settings;
 }
@@ -366,12 +351,6 @@ add_cm (GetProtocolsData *data,
         continue;
 
       if (!tp_strdiff (cm_name, "haze") &&
-          !tp_strdiff (proto_name, "facebook"))
-        /* Facebook now supports XMPP so drop the purple facebook plugin; user
-         * should use Gabble */
-        continue;
-
-      if (!tp_strdiff (cm_name, "haze") &&
           !tp_strdiff (proto_name, "irc"))
         /* Use Idle for IRC (bgo #711226) */
         continue;
@@ -410,10 +389,6 @@ add_cm (GetProtocolsData *data,
           add_protocol (data, cm, proto_name, "google-talk",
               tpaw_service_name_to_display_name ("google-talk"),
               "im-google-talk");
-
-          add_protocol (data, cm, proto_name, "facebook",
-              tpaw_service_name_to_display_name ("facebook"),
-              "im-facebook");
         }
 
       g_free (icon_name);
diff --git a/tp-account-widgets/tpaw-utils.c b/tp-account-widgets/tpaw-utils.c
index 184247b..6b6b79f 100644
--- a/tp-account-widgets/tpaw-utils.c
+++ b/tp-account-widgets/tpaw-utils.c
@@ -130,6 +130,7 @@ tpaw_protocol_name_to_display_name (const gchar *proto_name)
     { "skype-dbus", "Skype (D-BUS)", FALSE },
     { "skype-x11", "Skype (X11)", FALSE },
     { "zephyr", "Zephyr", FALSE },
+    { "facebook", "Facebook Messenger", FALSE },
     { NULL, NULL }
   };
 
@@ -157,7 +158,6 @@ tpaw_service_name_to_display_name (const gchar *service_name)
     gboolean translated;
   } names[] = {
     { "google-talk", N_("Google Talk"), FALSE },
-    { "facebook", N_("Facebook Chat"), TRUE },
     { NULL, NULL }
   };
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]