"Find domain that hosts avatars for email address ADDR."
;; implements https://wiki.libravatar.org/api/
(save-match-data
- (unless (string-match ".+@\\(.+\\)" addr)
- (error "%s is not an email address" addr))
- (let ((domain (match-string 1 addr)))
- (catch 'found
- (dolist (record '(("_avatars-sec" . "https")
- ("_avatars" . "http")))
- (let* ((query (concat (car record) "._tcp." domain))
- (result (dns-query query 'SRV)))
- (when result
- (throw 'found (format "%s://%s/avatar"
- (cdr record)
- result)))))
- "https://seccdn.libravatar.org/avatar"))))
+ (if (not (string-match ".+@\\(.+\\)" addr))
+ "https://seccdn.libravatar.org/avatar"
+ (let ((domain (match-string 1 addr)))
+ (catch 'found
+ (dolist (record '(("_avatars-sec" . "https")
+ ("_avatars" . "http")))
+ (let* ((query (concat (car record) "._tcp." domain))
+ (result (dns-query query 'SRV)))
+ (when result
+ (throw 'found (format "%s://%s/avatar"
+ (cdr record)
+ result)))))
+ "https://seccdn.libravatar.org/avatar")))))
(defun gravatar-hash (mail-address)
"Return the Gravatar hash for MAIL-ADDRESS."
(gravatar-force-default nil)
(gravatar-size nil))
(should (equal (gravatar-build-url "foo") "\
-https://www.gravatar.com/avatar/acbd18db4cc2f85cedef654fccc4a4d8?r=g"))))
+https://seccdn.libravatar.org/avatar/acbd18db4cc2f85cedef654fccc4a4d8?r=g"))))
;;; gravatar-tests.el ends here