GNU bug report logs - #39965
[PATCH] Add support for multiple gravatar-like services

Previous Next

Package: emacs;

Reported by: Philip K <philip <at> warpmail.net>

Date: Sat, 7 Mar 2020 00:12:02 UTC

Severity: normal

Tags: patch

Fixed in version 28.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 39965 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Philip K <philip <at> warpmail.net>
Cc: philip.kaludercic <at> fau.de, 39965 <at> debbugs.gnu.org
Subject: Re: bug#39965: [PATCH] Add support for multiple gravatar-like services
Date: Mon, 09 Mar 2020 11:39:18 +0100
>>>>> On Sat,  7 Mar 2020 01:11:41 +0100, Philip K <philip <at> warpmail.net> said:

    Philip> Specifically, the non-proprietary services libravatar (now default)
    Philip> and unicornify have been added. The behaviour is customised via the
    Philip> new variable `gravatar-service'.
    Philip> ---
    Philip>  lisp/image/gravatar.el            | 19 +++++++++++++++----
    Philip>  test/lisp/image/gravatar-tests.el |  1 +
    Philip>  2 files changed, 16 insertions(+), 4 deletions(-)

    Philip> diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el
    Philip> index b8542bc3c3..c1ae0cefe3 100644
    Philip> --- a/lisp/image/gravatar.el
    Philip> +++ b/lisp/image/gravatar.el
    Philip> @@ -118,9 +118,16 @@ gravatar-force-default
    Philip>    :version "27.1"
    Philip>    :group 'gravatar)
 
    Philip> -(defconst gravatar-base-url
    Philip> -  "https://www.gravatar.com/avatar"
    Philip> -  "Base URL for getting gravatars.")
    Philip> +(defcustom gravatar-service 'libravatar
    Philip> +  "Symbol denoting gravatar-like service to use."
    Philip> +  :type '(choice (const libravatar)
    Philip> +                 (const gravatar)
    Philip> +                 (const unicornify))
    Philip> +  :version "27.1"
    Philip> +  :link '(url-link "https://www.libravatar.org/")
    Philip> +  :link '(url-link "https://unicornify.pictures/")
    Philip> +  :link '(url-link "https://gravatar.com/")
    Philip> +  :group 'gravatar)

If you make this an alist then your cond below becomes just
'alist-get', and you have the URLS in just one place.

    Philip>  (defun gravatar-hash (mail-address)
    Philip>    "Return the Gravatar hash for MAIL-ADDRESS."
    Philip> @@ -142,7 +149,11 @@ gravatar-build-url
    Philip>    "Return the URL of a gravatar for MAIL-ADDRESS."
    Philip>    ;; https://gravatar.com/site/implement/images/
    Philip>    (format "%s/%s?%s"
    Philip> -          gravatar-base-url
    Philip> +          (cond ((eq gravatar-service 'gravatar)
    Philip> +                 "https://www.gravatar.com/avatar")
    Philip> +                ((eq gravatar-service 'unicornify)
    Philip> +                 "https://unicornify.pictures/avatar/")
    Philip> +                (t "https://seccdn.libravatar.org/avatar"))
    Philip>            (gravatar-hash mail-address)
    Philip>            (gravatar--query-string)))

This is changing the default from gravatar->libravatar, won't that
break stuff?

Robert




This bug report was last modified 5 years and 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.