From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#39965: [PATCH] Add support for multiple gravatar-like services Date: Mon, 09 Mar 2020 11:39:18 +0100 Message-ID: References: <20200307001141.10771-1-philip@warpmail.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="16452"; mail-complaints-to="usenet@ciao.gmane.io" Cc: philip.kaludercic@fau.de, 39965@debbugs.gnu.org To: Philip K Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 09 11:40:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jBFpU-0004AT-Cl for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 09 Mar 2020 11:40:12 +0100 Original-Received: from localhost ([::1]:40478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBFpS-0006mS-Vc for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 09 Mar 2020 06:40:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40729) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBFpL-0006mM-VK for bug-gnu-emacs@gnu.org; Mon, 09 Mar 2020 06:40:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBFpK-0004nv-Pe for bug-gnu-emacs@gnu.org; Mon, 09 Mar 2020 06:40:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43879) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jBFpK-0004nh-J8 for bug-gnu-emacs@gnu.org; Mon, 09 Mar 2020 06:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jBFpK-0003ln-Go for bug-gnu-emacs@gnu.org; Mon, 09 Mar 2020 06:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Mar 2020 10:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39965 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 39965-submit@debbugs.gnu.org id=B39965.158375036914442 (code B ref 39965); Mon, 09 Mar 2020 10:40:02 +0000 Original-Received: (at 39965) by debbugs.gnu.org; 9 Mar 2020 10:39:29 +0000 Original-Received: from localhost ([127.0.0.1]:49852 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBFom-0003ks-Qo for submit@debbugs.gnu.org; Mon, 09 Mar 2020 06:39:29 -0400 Original-Received: from mail-wm1-f54.google.com ([209.85.128.54]:55088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBFok-0003kW-Sk for 39965@debbugs.gnu.org; Mon, 09 Mar 2020 06:39:27 -0400 Original-Received: by mail-wm1-f54.google.com with SMTP id n8so5211366wmc.4 for <39965@debbugs.gnu.org>; Mon, 09 Mar 2020 03:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version; bh=+CXOLs6pa0X4iWzaZpJYG1loj4Wm26F0/p8wiK65vro=; b=Cr22pfpkpZnNPSj2A4lXYymX6ovSlbqosbqy+hV4Kzy8QBpTUiqFxBb+RplAE8iUQu Fe9DkCnMw5em711J2ZtD21vo2PS4LsXEHKh1UtI2/VyDSK96MMMldZQTLsuf/l4JX3n4 HPHRUXX6fnAFt/O4x8AQ2bq6Av19jaziYfGZwwegDokS+Yi7hMUZhR8c+1fRGgylQP4s FcoFj/IfgFNhlWH7Jv2JkTUPUeHW8Mvdm/cZRfVpChXYEej9zpHhFX+4RcD7iycIKspF AiDXGHs+C5HGqDL5MAbdV1NMixtE6xF3rdUuq2gt5ICc2gE0/x6V+876iVbfe/HKbtMU rSBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version; bh=+CXOLs6pa0X4iWzaZpJYG1loj4Wm26F0/p8wiK65vro=; b=I1tmz842eLTtalKuFvCi9FY2u7ryOkGPmVlF0UQuT1gA6/zv/uofa9KYnPF8T4QMfF YuLNUlS1N8utBagunpkSLcbDwQaLw3+EFtShcej5/gvGt82znKtsp9wxDv6ks4IwwLtK WfdzNlcd77HNL0aIcCXwsxy9M0+7juqWxnHGTlmd2FWAEDJbSuHEsaLVyE0qrTOBnxg3 Bp1HA0mtlj7dvfS4cSHl51mjZ5cbpSpOuyJPDMF3JsFzWcW9k0bLP8PYzPRv35xKATEK ITeByiLnJmHXuYS/AuKWzcN9anwexUOkNjAtCiV2FPiPRbGi+XidMRMM/LsUNZ75EEXX aQgw== X-Gm-Message-State: ANhLgQ1WWlnxQ8TQ0qIz3yJxxMeisMIQPGR1duV4LP4jLpaYKGRrTldz F3MN2c8oE41Fo3UVFn0uyCM= X-Google-Smtp-Source: ADFU+vszSH9HcXh/8rZ44zj4oP1HtyKpJMPew5YVFDtIThePBpdqu4+gCXph7uEOZql0vFoScBUWuw== X-Received: by 2002:a1c:a307:: with SMTP id m7mr20499186wme.144.1583750360775; Mon, 09 Mar 2020 03:39:20 -0700 (PDT) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id a184sm24991361wmf.29.2020.03.09.03.39.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 03:39:19 -0700 (PDT) In-Reply-To: <20200307001141.10771-1-philip@warpmail.net> (Philip K.'s message of "Sat, 7 Mar 2020 01:11:41 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177086 Archived-At: >>>>> On Sat, 7 Mar 2020 01:11:41 +0100, Philip K 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