From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Philip K Newsgroups: gmane.emacs.bugs Subject: bug#39965: [PATCH] Add support for multiple gravatar-like services Date: Sat, 7 Mar 2020 01:11:41 +0100 Message-ID: <20200307001141.10771-1-philip@warpmail.net> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="82052"; mail-complaints-to="usenet@ciao.gmane.io" Cc: philip.kaludercic@fau.de To: 39965@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 07 01:12:18 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 1jAN4j-000LDk-R2 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 Mar 2020 01:12:18 +0100 Original-Received: from localhost ([::1]:43752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAN4i-0001Ok-IZ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 06 Mar 2020 19:12:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43869) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAN4W-0001Lm-6b for bug-gnu-emacs@gnu.org; Fri, 06 Mar 2020 19:12:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAN4V-0007uw-0n for bug-gnu-emacs@gnu.org; Fri, 06 Mar 2020 19:12:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40061) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jAN4U-0007uS-Th for bug-gnu-emacs@gnu.org; Fri, 06 Mar 2020 19:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jAN4U-0007GM-PI for bug-gnu-emacs@gnu.org; Fri, 06 Mar 2020 19:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip K Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Mar 2020 00:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39965 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.158353991327887 (code B ref -1); Sat, 07 Mar 2020 00:12:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Mar 2020 00:11:53 +0000 Original-Received: from localhost ([127.0.0.1]:46032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAN4G-0007Fd-Oz for submit@debbugs.gnu.org; Fri, 06 Mar 2020 19:11:53 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:35313) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAN4F-0007FW-A3 for submit@debbugs.gnu.org; Fri, 06 Mar 2020 19:11:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43127) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAN4E-000171-1f for bug-gnu-emacs@gnu.org; Fri, 06 Mar 2020 19:11:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAN4C-0006m9-VE for bug-gnu-emacs@gnu.org; Fri, 06 Mar 2020 19:11:45 -0500 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:38943) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jAN4C-0006kw-RI for bug-gnu-emacs@gnu.org; Fri, 06 Mar 2020 19:11:44 -0500 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 8F24B22340; Fri, 6 Mar 2020 19:11:44 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 06 Mar 2020 19:11:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=warpmail.net; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm2; bh=5hsqVLf+pXhvVHZEVmbGSB8wvl jIIEYH96EfMG8XK5E=; b=eRaQsUY9dxy1a+4p7Enj1ki0jvfi+wB+KnK6UVV7Ic YAq6YhNvHKaUdoX+szUR4zq4hZICZY6odGZ41zE2cYR8J6KssbHc/56w4WUAq0Cp 4BLrKcLmYqbtHAxObdCa3SniIPHIX04/sN9W75ToNGDFvCWaxJoQMyzhqAXC1kXh wQO4NtjPDSe9JqKq/vRsXoN7Bwc/bizUuFBgHfsmoWKmxGTwGCNghO0lyzr/uYLZ 6CD7zOV/SNK3r8A4O8UNnZF1JNSItMwgTE6qQ+SINjkQEU+bkwQgoF4SzwdZrQKL nH7ckFB0tsi1oL3q3L5JcgwL5eSFTsvsB0zlbSayDf1g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=5hsqVLf+pXhvVHZEV mbGSB8wvljIIEYH96EfMG8XK5E=; b=HUkAIU/SYGGdFgtoEz8vul7HsTQfc/FuC Pu8qsIUvhXGqKf8XMx3DEtGKMMxDrRaaAhy27Ev6WcWf3nsUn/E8RFjJQVDwyzW2 D3uoPcQg6NpRCOczOdDrgrAxvFiUuvZE38oLMqLuugaf+wac5YQNyjB2a7j+p/kx 4AiTAd0gbnAi9OZmMe6za9sZVh2WKY4u+k1L0K5eZTH0tO0tpgpR4yG77OBlHAdw 7BHSb8A3RQVba7+2wXPsVwJb7aWrI2a1kEo34OprvALQNsAVc3cw/exK3Plt3dVF /EY9B2gauLfs+czIsVdrnGW5cOOGSjAxU2rM5TP1oyhkUbGwPKSsw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedruddufedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdekredtre dttdenucfhrhhomheprfhhihhlihhpucfmuceophhhihhlihhpseifrghrphhmrghilhdr nhgvtheqnecuffhomhgrihhnpehgrhgrvhgrthgrrhdrtghomhdplhhisghrrghvrghtrg hrrdhorhhgpdhunhhitghorhhnihhfhidrphhitghtuhhrvghsnecukfhppeejledrvddu ledrudelfedrudeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepphhhihhlihhpseifrghrphhmrghilhdrnhgvth X-ME-Proxy: Original-Received: from localhost (p4fdbc112.dip0.t-ipconnect.de [79.219.193.18]) by mail.messagingengine.com (Postfix) with ESMTPA id DBE4E3280064; Fri, 6 Mar 2020 19:11:43 -0500 (EST) X-Mailer: git-send-email 2.20.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] 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:176982 Archived-At: Specifically, the non-proprietary services libravatar (now default) and unicornify have been added. The behaviour is customised via the new variable `gravatar-service'. --- lisp/image/gravatar.el | 19 +++++++++++++++---- test/lisp/image/gravatar-tests.el | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el index b8542bc3c3..c1ae0cefe3 100644 --- a/lisp/image/gravatar.el +++ b/lisp/image/gravatar.el @@ -118,9 +118,16 @@ gravatar-force-default :version "27.1" :group 'gravatar) -(defconst gravatar-base-url - "https://www.gravatar.com/avatar" - "Base URL for getting gravatars.") +(defcustom gravatar-service 'libravatar + "Symbol denoting gravatar-like service to use." + :type '(choice (const libravatar) + (const gravatar) + (const unicornify)) + :version "27.1" + :link '(url-link "https://www.libravatar.org/") + :link '(url-link "https://unicornify.pictures/") + :link '(url-link "https://gravatar.com/") + :group 'gravatar) (defun gravatar-hash (mail-address) "Return the Gravatar hash for MAIL-ADDRESS." @@ -142,7 +149,11 @@ gravatar-build-url "Return the URL of a gravatar for MAIL-ADDRESS." ;; https://gravatar.com/site/implement/images/ (format "%s/%s?%s" - gravatar-base-url + (cond ((eq gravatar-service 'gravatar) + "https://www.gravatar.com/avatar") + ((eq gravatar-service 'unicornify) + "https://unicornify.pictures/avatar/") + (t "https://seccdn.libravatar.org/avatar")) (gravatar-hash mail-address) (gravatar--query-string))) diff --git a/test/lisp/image/gravatar-tests.el b/test/lisp/image/gravatar-tests.el index e66b5c6803..31a28293fa 100644 --- a/test/lisp/image/gravatar-tests.el +++ b/test/lisp/image/gravatar-tests.el @@ -65,6 +65,7 @@ gravatar-build-url "Test `gravatar-build-url'." (let ((gravatar-default-image nil) (gravatar-force-default nil) + (gravatar-service 'gravatar) (gravatar-size nil)) (should (equal (gravatar-build-url "foo") "\ https://www.gravatar.com/avatar/acbd18db4cc2f85cedef654fccc4a4d8?r=g")))) -- 2.20.1