[gnome-contacts/nielsdg/die-telepathy-die: 3/3] Remove all Telepathy patches




commit f853cbbc37ae346c4c1f8b1a6bdbc0eac03eef2e
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sun Jul 24 20:13:43 2022 +0200

    Remove all Telepathy patches
    
    We were keeping them alive because we thought Purism were using it, but
    apparently that's not the case (or no longer). Just remove it.

 meson.build                     |  5 ---
 meson_options.txt               |  1 -
 src/contacts-contact-sheet.vala | 19 +++--------
 src/contacts-store.vala         | 44 -------------------------
 src/contacts-utils.vala         | 72 -----------------------------------------
 src/meson.build                 |  5 ---
 6 files changed, 4 insertions(+), 142 deletions(-)
---
diff --git a/meson.build b/meson.build
index c6b3b1cd..f2d46698 100644
--- a/meson.build
+++ b/meson.build
@@ -61,11 +61,6 @@ libportal_dep = dependency('libportal-gtk4', version: '>= 0.6')
 # cheese_dep = dependency('cheese', required: get_option('cheese'))
 # cheese_gtk_dep = dependency('cheese-gtk', version: '>= 3.3.91', required: get_option('cheese'))
 
-if get_option('telepathy')
-  folks_telepathy = dependency('folks-telepathy', version: '>=' + min_folks_version)
-  telepathy_glib = dependency('telepathy-glib', version: '>= 0.22.0')
-endif
-
 valadoc = find_program('valadoc', required: get_option('docs'))
 
 
diff --git a/meson_options.txt b/meson_options.txt
index c672bba5..600f1095 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,4 @@
 option('profile', type: 'combo', choices: [ 'default', 'development' ], value: 'default', description: 
'Indicate whether this is a nightly build (used for CI purposes)')
 option('camera', type: 'boolean', value: true, description: 'Support creaing an avatar with the webcam using 
the XDG camera portal')
-option('telepathy', type: 'boolean', value: false, description: 'Enable Telepathy call/chat support.')
 option('manpage', type: 'boolean', value: true, description: 'Enable building man pages.')
 option('docs', type: 'boolean', value: false, description: 'Whether to build the valadoc docs.')
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index 5c6677ed..17f6940d 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -307,7 +307,10 @@ public class Contacts.ContactSheet : Gtk.Grid {
   }
 
   private void add_im_addresses (Persona persona, string property) {
-#if HAVE_TELEPATHY
+    // NOTE: We _could_ enable this again, but only for specific services.
+    // Right now, this just enables a million "Windows Live Messenger" and
+    // "Jabber", ... fields, which are all resting in their respective coffins.
+#if 0
     unowned var im_details = persona as ImDetails;
     if (im_details == null)
       return;
@@ -315,23 +318,9 @@ public class Contacts.ContactSheet : Gtk.Grid {
     var rows = new GLib.List<Gtk.ListBoxRow> ();
     foreach (var protocol in im_details.im_addresses.get_keys ()) {
       foreach (var id in im_details.im_addresses[protocol]) {
-        if (!(persona is Tpf.Persona))
-          continue;
-
         var row = new ContactSheetRow (property,
                                        id.value,
                                        ImService.get_display_name (protocol));
-        var button = row.add_button ("user-available-symbolic");
-        button.clicked.connect (() => {
-          var im_persona = Utils.find_im_persona (individual, protocol, id.value);
-          if (im_persona != null) {
-            var type = im_persona.presence_type;
-            if (type != PresenceType.UNSET && type != PresenceType.ERROR &&
-                type != PresenceType.OFFLINE && type != PresenceType.UNKNOWN) {
-              Utils.start_chat (this.individual, protocol, id.value);
-            }
-          }
-        });
         rows.append (row);
       }
     }
diff --git a/src/contacts-store.vala b/src/contacts-store.vala
index c3366296..739d23d2 100644
--- a/src/contacts-store.vala
+++ b/src/contacts-store.vala
@@ -62,10 +62,6 @@ public class Contacts.Store : GLib.Object {
 
   public Gee.HashMultiMap<string, string> dont_suggest_link;
 
-#if HAVE_TELEPATHY
-  public TelepathyGLib.Account? caller_account { get; private set; default = null; }
-#endif
-
   private void read_dont_suggest_db () {
     dont_suggest_link.clear ();
 
@@ -169,10 +165,6 @@ public class Contacts.Store : GLib.Object {
 
     this.aggregator.individuals_changed_detailed.connect (on_individuals_changed_detailed);
     aggregator.prepare.begin ();
-
-#if HAVE_TELEPATHY
-    check_call_capabilities.begin ();
-#endif
   }
 
   public Store (GLib.Settings settings, Folks.Query query) {
@@ -298,40 +290,4 @@ public class Contacts.Store : GLib.Object {
 
     return Gtk.INVALID_LIST_POSITION;
   }
-
-#if HAVE_TELEPATHY
-  // TODO: listen for changes in Account#URISchemes
-  private async void check_call_capabilities () {
-    var account_manager = TelepathyGLib.AccountManager.dup ();
-
-    try {
-      yield account_manager.prepare_async (null);
-
-      account_manager.account_enabled.connect (check_account_caps);
-      account_manager.account_disabled.connect (check_account_caps);
-
-      foreach (var account in account_manager.dup_valid_accounts ())
-        yield check_account_caps (account);
-    } catch (GLib.Error e) {
-      warning ("Unable to check accounts caps %s", e.message);
-    }
-  }
-
-  private async void check_account_caps (TelepathyGLib.Account account) {
-    GLib.Quark addressing = TelepathyGLib.Account.get_feature_quark_addressing ();
-    if (!account.is_prepared (addressing)) {
-      GLib.Quark[] features = { addressing };
-      try {
-        yield account.prepare_async (features);
-      } catch (GLib.Error e) {
-        warning ("Unable to prepare account %s", e.message);
-      }
-    }
-
-    if (account.is_prepared (addressing)) {
-      if (account.is_enabled () && account.associated_with_uri_scheme ("tel"))
-        this.caller_account = account;
-    }
-  }
-#endif
 }
diff --git a/src/contacts-utils.vala b/src/contacts-utils.vala
index f5d6a665..012b8db3 100644
--- a/src/contacts-utils.vala
+++ b/src/contacts-utils.vala
@@ -40,41 +40,6 @@ namespace Contacts.Utils {
     Gtk.show_uri (null, mailto_uri, 0);
   }
 
-#if HAVE_TELEPATHY
-  public void start_chat (Individual individual, string protocol, string id) {
-    var im_persona = Utils.find_im_persona (individual, protocol, id);
-    var account = (im_persona.store as Tpf.PersonaStore).account;
-    var request_dict = new HashTable<string, Value?>(str_hash, str_equal);
-    request_dict.insert (TelepathyGLib.PROP_CHANNEL_CHANNEL_TYPE,
-                         TelepathyGLib.IFACE_CHANNEL_TYPE_TEXT);
-    request_dict.insert (TelepathyGLib.PROP_CHANNEL_TARGET_HANDLE_TYPE,
-                         (int) TelepathyGLib.HandleType.CONTACT);
-    request_dict.insert (TelepathyGLib.PROP_CHANNEL_TARGET_ID,
-                         id);
-
-    // TODO: Should really use the event time like:
-    // tp_user_action_time_from_x11(gtk_get_current_event_time())
-    var request = new TelepathyGLib.AccountChannelRequest(account, request_dict, int64.MAX);
-    request.ensure_channel_async.begin ("org.freedesktop.Telepathy.Client.Empathy.Chat", null);
-  }
-
-  public void start_call (string contact_id, TelepathyGLib.Account account) {
-    var request_dict = new HashTable<string,GLib.Value?>(str_hash, str_equal);
-
-    request_dict.insert (TelepathyGLib.PROP_CHANNEL_CHANNEL_TYPE,
-                         TelepathyGLib.IFACE_CHANNEL_TYPE_CALL);
-    request_dict.insert (TelepathyGLib.PROP_CHANNEL_TARGET_HANDLE_TYPE,
-                         (int) TelepathyGLib.HandleType.CONTACT);
-    request_dict.insert (TelepathyGLib.PROP_CHANNEL_TARGET_ID,
-                         contact_id);
-    request_dict.insert (TelepathyGLib.PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO,
-                         true);
-
-    var request = new TelepathyGLib.AccountChannelRequest(account, request_dict, int64.MAX);
-    request.ensure_channel_async.begin ("org.freedesktop.Telepathy.Client.Empathy.Call", null);
-  }
-#endif
-
   public T? get_first<T> (Gee.Collection<T> collection) {
     var i = collection.iterator();
     if (i.next())
@@ -289,19 +254,6 @@ namespace Contacts.Utils {
     return "maps:q=%s".printf (GLib.Uri.escape_string (address_parts));
   }
 
-#if HAVE_TELEPATHY
-  public Tpf.Persona? find_im_persona (Individual individual, string protocol, string im_address) {
-    var iid = protocol + ":" + im_address;
-    foreach (var p in individual.personas) {
-      unowned var tp = p as Tpf.Persona;
-      if (tp != null && tp.iid == iid) {
-        return tp;
-      }
-    }
-    return null;
-  }
-#endif
-
   /* We claim something is "removable" if at least one persona is removable,
   that will typically unlink the rest. */
   public bool can_remove_personas (Individual individual) {
@@ -385,12 +337,6 @@ namespace Contacts.Utils {
       if (eds_name != null)
         return eds_name;
     }
-#if HAVE_TELEPATHY
-    if (store.type_id == "telepathy") {
-      var account = (store as Tpf.PersonaStore).account;
-      return Contacts.ImService.get_display_name (account.service);
-    }
-#endif
 
     return store.display_name;
   }
@@ -445,12 +391,6 @@ namespace Contacts.Utils {
       if (eds_name != null)
         return eds_name;
     }
-#if HAVE_TELEPATHY
-    if (store.type_id == "telepathy") {
-      unowned var account = (store as Tpf.PersonaStore).account;
-      return Contacts.ImService.get_display_name (account.service);
-    }
-#endif
 
     return store.display_name;
   }
@@ -580,16 +520,4 @@ namespace Contacts.Utils {
         return info.icon_name;
     return null;
   }
-
-#if HAVE_TELEPATHY
-  public void fetch_contact_info (Individual individual) {
-    /* TODO: Ideally Folks should have API for this (#675131) */
-    foreach (var p in individual.personas) {
-      unowned var tp = p as Tpf.Persona;
-      if (tp != null) {
-        tp.contact.request_contact_info_async.begin (null);
-      }
-    }
-  }
-#endif
 }
diff --git a/src/meson.build b/src/meson.build
index c246b612..eb55c0b3 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -50,11 +50,6 @@ contacts_deps = [
   math,
 ]
 
-if get_option('telepathy')
-  contacts_deps += [ folks_telepathy, telepathy_glib ]
-  contacts_vala_args += [ '-D', 'HAVE_TELEPATHY' ]
-endif
-
 libcontacts = static_library('contacts',
   libcontacts_sources,
   include_directories: config_h_dir,


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