Function: tramp-get-goa-accounts

tramp-get-goa-accounts is a byte-compiled function defined in tramp-gvfs.el.gz.

Signature

(tramp-get-goa-accounts VEC)

Documentation

Retrieve GNOME Online Accounts, and cache them.

The hash key is a tramp-goa-account structure. The value is an alist of the properties of tramp-goa-interface-account and tramp-goa-interface-files of the corresponding GNOME Online Account. Additionally, a property "prefix" is added. VEC is used only for traces.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-gvfs.el.gz
(defun tramp-get-goa-accounts (vec)
  "Retrieve GNOME Online Accounts, and cache them.
The hash key is a `tramp-goa-account' structure.  The value is an
alist of the properties of `tramp-goa-interface-account' and
`tramp-goa-interface-files' of the corresponding GNOME Online
Account.  Additionally, a property \"prefix\" is added.
VEC is used only for traces."
  (with-tramp-connection-property nil "goa-accounts"
    (dolist
	(object-path
	 (mapcar
	  #'car
	  (tramp-dbus-function
	   vec #'dbus-get-all-managed-objects
	   `(:session ,tramp-goa-service ,tramp-goa-path))))
      (let* ((account-properties
	      (with-tramp-dbus-get-all-properties vec
		:session tramp-goa-service object-path
		tramp-goa-interface-account))
	     (files-properties
	      (with-tramp-dbus-get-all-properties vec
		:session tramp-goa-service object-path
		tramp-goa-interface-files))
	     (identity
	      (or (cdr (assoc "PresentationIdentity" account-properties)) ""))
	     key)
	;; Only accounts which matter.
	(when (and
	       (not (cdr (assoc "FilesDisabled" account-properties)))
	       (member
		(cdr (assoc "ProviderType" account-properties))
		'("google" "owncloud"))
	       (string-match tramp-goa-identity-regexp identity))
	  (setq key (make-tramp-goa-account
		     :method (cdr (assoc "ProviderType" account-properties))
		     :user (match-string 1 identity)
		     :host (match-string 2 identity)
		     :port (match-string 3 identity)))
	  (when (string-equal (tramp-goa-account-method key) "google")
	    (setf (tramp-goa-account-method key) "gdrive"))
	  (when (string-equal (tramp-goa-account-method key) "owncloud")
	    (setf (tramp-goa-account-method key) "nextcloud"))
	  ;; Cache all properties.
	  (dolist (prop (nconc account-properties files-properties))
	    (tramp-set-connection-property key (car prop) (cdr prop)))
	  ;; Cache "prefix".
	  (tramp-message
	   vec 10 "%s prefix %s" key
	   (tramp-set-connection-property
	    key "prefix"
	    (directory-file-name
	     (url-filename
	      (url-generic-parse-url
	       (tramp-get-connection-property key "Uri" "file:///")))))))))
    ;; Mark, that goa accounts have been cached.
    "cached"))