From: Magnus H. <leg...@us...> - 2015-03-05 12:18:54
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "emacs-jabber". The branch, master has been updated via 787d3bdba70e717218afb8189b3ae7d4d7e4b8fb (commit) via 5b65c87dc05a23d1d1995e447ccd7ac3c9b8efa1 (commit) via a9238d2b045f3452ee8a2c14903a5c5760ac77e6 (commit) via 255f6804aff9dd8b58bfaed5d751d141647c4993 (commit) via 04a683d8b2f894380579f7cb4b6f1d1b5147e2cd (commit) via fd80b92552c0131b2cfd5c1368445b0950f1d749 (commit) via 1f5bc9548e1767a25689afcf073ec3ae71d42245 (commit) via ad667999ee2f65709c18e6af235c7f2e0dd65007 (commit) via e33a361a0f324f8bd3c8e3dc54e2ae15d0dc7f9b (commit) via bc212947ff13119dcb161f0c920c8f906e2594c4 (commit) via 38ee56392bb03bbcf2b3260aec1a4141f3078b24 (commit) via cc8d30f7e1849f40d242274b9f37b648868574bb (commit) via d2b369ea018b390ff23e8b05f9e676e0b01bf889 (commit) from 1a46db7f4b4b51925138557355395f70f440e66b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 787d3bdba70e717218afb8189b3ae7d4d7e4b8fb Merge: 5b65c87 04a683d Author: Magnus Henoch <mag...@gm...> Date: Thu Mar 5 10:50:48 2015 +0000 Merge branch 'travis' Compile and run tests automatically using Travis CI. commit 5b65c87dc05a23d1d1995e447ccd7ac3c9b8efa1 Author: Magnus Henoch <mag...@gm...> Date: Thu Mar 5 10:48:35 2015 +0000 Don't assume jabber-account-list is bound in menu test Just in case jabber-menu.el gets loaded without jabber.el or jabber-autoloads.el. diff --git a/jabber-menu.el b/jabber-menu.el index 528181e..40082ee 100644 --- a/jabber-menu.el +++ b/jabber-menu.el @@ -155,7 +155,7 @@ With prefix argument, remove it." `(or (eq jabber-display-menu t) (and (eq jabber-display-menu 'maybe) (or ,user-installed-package - jabber-account-list + (bound-and-true-p jabber-account-list) (bound-and-true-p jabber-connections))))))) (defvar jabber-jid-chat-menu nil commit a9238d2b045f3452ee8a2c14903a5c5760ac77e6 Author: Magnus Henoch <mag...@gm...> Date: Thu Mar 5 01:37:31 2015 +0000 Add test for jabber-disco hashing Use example from XEP-0115. diff --git a/tests/Makefile.am b/tests/Makefile.am index 01f07e0..8575ddb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,4 +2,5 @@ # check" or "make distcheck" to work with earlier versions. LOG_COMPILER = env top_builddir=$(top_builddir) $(EMACS) -batch -L $(top_builddir) -L $(top_srcdir) -L $(srcdir) -l TESTS = load-all.el skip-tag-forward.el history.el jabberd.el nick-change-fail.el +TESTS += caps-hash.el dist_noinst_DATA = $(TESTS) diff --git a/tests/caps-hash.el b/tests/caps-hash.el new file mode 100644 index 0000000..55d18b9 --- /dev/null +++ b/tests/caps-hash.el @@ -0,0 +1,51 @@ +;; Test disco hash against examples in XEP-0115 + +(message "Let's go") +(condition-case e + (require 'jabber-disco) + (error + (message "disco bad! %S" e))) +(message "more") +(condition-case e + (require 'jabber-widget) + (error + (message "bad! %S" e))) +(message "done!") + +(let ((query + (with-temp-buffer + (insert "<query xmlns='http://jabber.org/protocol/disco#info' + node='http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w='> + <identity xml:lang='en' category='client' name='Psi 0.11' type='pc'/> + <identity xml:lang='el' category='client' name='Ψ 0.11' type='pc'/> + <feature var='http://jabber.org/protocol/caps'/> + <feature var='http://jabber.org/protocol/disco#info'/> + <feature var='http://jabber.org/protocol/disco#items'/> + <feature var='http://jabber.org/protocol/muc'/> + <x xmlns='jabber:x:data' type='result'> + <field var='FORM_TYPE' type='hidden'> + <value>urn:xmpp:dataforms:softwareinfo</value> + </field> + <field var='ip_version'> + <value>ipv4</value> + <value>ipv6</value> + </field> + <field var='os'> + <value>Mac</value> + </field> + <field var='os_version'> + <value>10.5.1</value> + </field> + <field var='software'> + <value>Psi</value> + </field> + <field var='software_version'> + <value>0.11</value> + </field> + </x> + </query>") + (car (xml-parse-region (point-min) (point-max)))))) + (message "parsed xml") + (unless (equal "q07IKJEyjvHSyhy//CH0CxmKi8w=" + (jabber-caps-ver-string query "sha-1")) + (error "Incorrect caps hash"))) commit 255f6804aff9dd8b58bfaed5d751d141647c4993 Author: Magnus Henoch <mag...@gm...> Date: Thu Mar 5 01:34:08 2015 +0000 Don't use `features' as a variable This is already a global variable. If a module is loaded, it might be added to our temporary variable instead of the global one. diff --git a/jabber-disco.el b/jabber-disco.el index b538e87..4669e17 100644 --- a/jabber-disco.el +++ b/jabber-disco.el @@ -496,7 +496,7 @@ Return (IDENTITIES FEATURES), or nil if not in cache." ;; 1. Initialize an empty string S. (with-temp-buffer (let* ((identities (jabber-xml-get-children query 'identity)) - (features (mapcar (lambda (feature) (jabber-xml-get-attribute feature 'var)) + (disco-features (mapcar (lambda (f) (jabber-xml-get-attribute f 'var)) (jabber-xml-get-children query 'feature))) (maybe-forms (jabber-xml-get-children query 'x)) (forms (remove-if-not @@ -521,11 +521,11 @@ Return (IDENTITIES FEATURES), or nil if not in cache." ;; `insert', since `concat' tolerates nil values. (insert (concat category "/" type "/" xml:lang "/" name "<")))) ;; 4. Sort the supported service discovery features. [17] - (setq features (sort features #'string<)) + (setq disco-features (sort disco-features #'string<)) ;; 5. For each feature, append the feature to S, followed by the ;; '<' character. - (dolist (feature features) - (insert feature "<")) + (dolist (f disco-features) + (insert f "<")) ;; 6. If the service discovery information response includes ;; XEP-0128 data forms, sort the forms by the FORM_TYPE (i.e., ;; by the XML character data of the <value/> element). commit 04a683d8b2f894380579f7cb4b6f1d1b5147e2cd Author: Magnus Henoch <mag...@gm...> Date: Thu Mar 5 00:42:59 2015 +0000 Use Automake 1.12 for Travis "make check" doesn't work for Automake 1.11 or earlier. Let's get a newer version from a PPA. diff --git a/.travis.yml b/.travis.yml index 24540d6..4f08543 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,13 @@ env: before_install: # PPA for stable Emacs packages - sudo add-apt-repository -y ppa:cassou/emacs + # PPA for Automake 1.12 + - sudo add-apt-repository -y ppa:dns/gnu - sudo apt-get update -qq - - sudo apt-get install -qq -yy ${EMACS}-nox texinfo + - sudo apt-get install -qq -yy ${EMACS}-nox texinfo automake script: - emacs --version + - automake --version - autoreconf -i - ./configure - make all check commit fd80b92552c0131b2cfd5c1368445b0950f1d749 Author: Magnus Henoch <mag...@gm...> Date: Thu Mar 5 00:22:44 2015 +0000 Use "make all check" for Travis "make distcheck" requires TeX to be installed. Let's not bother with that. diff --git a/.travis.yml b/.travis.yml index 6696933..24540d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,4 @@ script: - emacs --version - autoreconf -i - ./configure - - make distcheck + - make all check commit 1f5bc9548e1767a25689afcf073ec3ae71d42245 Author: Magnus Henoch <mag...@gm...> Date: Thu Mar 5 00:11:16 2015 +0000 Need to install texinfo for Travis build to succeed diff --git a/.travis.yml b/.travis.yml index f854218..6696933 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ before_install: # PPA for stable Emacs packages - sudo add-apt-repository -y ppa:cassou/emacs - sudo apt-get update -qq - - sudo apt-get install -qq -yy ${EMACS}-nox + - sudo apt-get install -qq -yy ${EMACS}-nox texinfo script: - emacs --version - autoreconf -i commit ad667999ee2f65709c18e6af235c7f2e0dd65007 Author: Magnus Henoch <mag...@gm...> Date: Thu Mar 5 00:04:37 2015 +0000 Call configure before make for Travis diff --git a/.travis.yml b/.travis.yml index ef96de8..f854218 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,5 @@ before_install: script: - emacs --version - autoreconf -i + - ./configure - make distcheck commit e33a361a0f324f8bd3c8e3dc54e2ae15d0dc7f9b Author: Magnus Henoch <mag...@gm...> Date: Thu Mar 5 00:03:23 2015 +0000 Need PPA to install Emacs 24 for Travis diff --git a/.travis.yml b/.travis.yml index 5fa8ad8..ef96de8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ env: - EMACS=emacs23 - EMACS=emacs24 before_install: + # PPA for stable Emacs packages + - sudo add-apt-repository -y ppa:cassou/emacs - sudo apt-get update -qq - sudo apt-get install -qq -yy ${EMACS}-nox script: commit bc212947ff13119dcb161f0c920c8f906e2594c4 Author: Magnus Henoch <mag...@gm...> Date: Thu Mar 5 00:01:22 2015 +0000 Forgot to call autoreconf in .travis.yml diff --git a/.travis.yml b/.travis.yml index 961235c..5fa8ad8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,5 @@ before_install: - sudo apt-get install -qq -yy ${EMACS}-nox script: - emacs --version + - autoreconf -i - make distcheck commit 38ee56392bb03bbcf2b3260aec1a4141f3078b24 Author: Magnus Henoch <mag...@gm...> Date: Wed Mar 4 23:54:38 2015 +0000 Initial attempt at .travis.yml file Adapted from https://github.com/abo-abo/tiny/blob/master/.travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..961235c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +env: + - EMACS=emacs23 + - EMACS=emacs24 +before_install: + - sudo apt-get update -qq + - sudo apt-get install -qq -yy ${EMACS}-nox +script: + - emacs --version + - make distcheck commit cc8d30f7e1849f40d242274b9f37b648868574bb Author: Adam Sjøgren <as...@ko...> Date: Mon Feb 9 17:04:29 2015 +0100 Scale avatars if width/height is above a value. If ImageMagick support is available. diff --git a/jabber-avatar.el b/jabber-avatar.el index e3dcbca..ac02523 100644 --- a/jabber-avatar.el +++ b/jabber-avatar.el @@ -52,6 +52,16 @@ :group 'jabber-avatar :type 'boolean) +(defcustom jabber-avatar-max-width 96 + "Maximum width of avatars." + :group 'jabber-avatar + :type 'integer) + +(defcustom jabber-avatar-max-height 96 + "Maximum height of avatars." + :group 'jabber-avatar + :type 'integer) + ;;;; Avatar data handling (defstruct avatar sha1-sum mime-type url base64-data height width bytes) @@ -97,7 +107,7 @@ If MIME-TYPE is not specified, try to find it from the image data." (base64-data (or base64-string (base64-encode-string raw-data))) (type (or mime-type (cdr (assq (get :type (cdr (condition-case nil - (create-image data nil t) + (jabber-create-image data nil t) (error nil)))) '((png "image/png") (jpeg "image/jpeg") @@ -118,7 +128,7 @@ If MIME-TYPE is not specified, try to find it from the image data." "Create an image from AVATAR. Return nil if images of this type are not supported." (condition-case nil - (create-image (with-temp-buffer + (jabber-create-image (with-temp-buffer (set-buffer-multibyte nil) (insert (avatar-base64-data avatar)) (base64-decode-region (point-min) (point-max)) @@ -194,7 +204,7 @@ AVATAR may be one of: (setq hash avatar) (setq image (lambda () (condition-case nil - (create-image (jabber-avatar-find-cached avatar)) + (jabber-create-image (jabber-avatar-find-cached avatar)) (error nil))))) (t (setq hash nil) @@ -205,5 +215,20 @@ AVATAR may be one of: (put jid-symbol 'avatar-hash hash) (jabber-presence-update-roster jid-symbol)))) +(defun jabber-create-image (file-or-data &optional type data-p) + "Create image, scaled down to jabber-avatar-max-width/height, +if width/height exceeds either of those, and ImageMagick is +available." + (let* ((image (create-image file-or-data type data-p)) + (size (image-size image t)) + (spec (cdr image))) + (when (and (functionp 'imagemagick-types) + (or (> (car size) jabber-avatar-max-width) + (> (cdr size) jabber-avatar-max-height))) + (plist-put spec :type 'imagemagick) + (plist-put spec :width jabber-avatar-max-width) + (plist-put spec :height jabber-avatar-max-height)) + image)) + (provide 'jabber-avatar) ;; arch-tag: 2405c3f8-8eaa-11da-826c-000a95c2fcd0 diff --git a/jabber-vcard.el b/jabber-vcard.el index fd347da..aab91cd 100644 --- a/jabber-vcard.el +++ b/jabber-vcard.el @@ -396,7 +396,7 @@ The top node should be the `vCard' node." (when (and photo-type photo-binval) (condition-case nil ;; ignore the type, let create-image figure it out. - (let ((image (create-image (base64-decode-string photo-binval) nil t))) + (let ((image (jabber-create-image (base64-decode-string photo-binval) nil t))) (insert-image image "[Photo]") (insert "\n")) (error (insert "Couldn't display photo\n"))))))) commit d2b369ea018b390ff23e8b05f9e676e0b01bf889 Author: Magnus Henoch <mag...@gm...> Date: Wed Mar 4 23:32:10 2015 +0000 Fix capabilities hash for Emacs 23 Emacs 23 doesn't have the function secure-hash. Fall back to the sha1 function. Thanks to Andres Ramirez Ramos for reporting this bug. diff --git a/jabber-disco.el b/jabber-disco.el index cab427f..b538e87 100644 --- a/jabber-disco.el +++ b/jabber-disco.el @@ -360,11 +360,16 @@ invalidate cache and get fresh data." (defvar jabber-caps-cache (make-hash-table :test 'equal)) (defconst jabber-caps-hash-names - '(("sha-1" . sha1) - ("sha-224" . sha224) - ("sha-256" . sha256) - ("sha-384" . sha384) - ("sha-512" . sha512)) + (if (fboundp 'secure-hash) + '(("sha-1" . sha1) + ("sha-224" . sha224) + ("sha-256" . sha256) + ("sha-384" . sha384) + ("sha-512" . sha512)) + ;; `secure-hash' was introduced in Emacs 24. For Emacs 23, fall + ;; back to the `sha1' function, handled specially in + ;; `jabber-caps--secure-hash'. + '(("sha-1" . sha1))) "Hash function name map. Maps names defined in http://www.iana.org/assignments/hash-function-text-names to symbols accepted by `secure-hash'. @@ -562,7 +567,18 @@ Return (IDENTITIES FEATURES), or nil if not in cache." ;; with binary output and encoded using Base64 as specified in ;; Section 4 of RFC 4648 [20] (note: the Base64 output MUST NOT ;; include whitespace and MUST set padding bits to zero). [21] - (base64-encode-string (secure-hash algorithm s nil nil t) t)))) + (base64-encode-string (jabber-caps--secure-hash algorithm s) t)))) + +(defun jabber-caps--secure-hash (algorithm string) + (cond + ;; `secure-hash' was introduced in Emacs 24 + ((fboundp 'secure-hash) + (secure-hash algorithm string nil nil t)) + ((eq algorithm 'sha1) + ;; For SHA-1, we can use the `sha1' function. + (sha1 string nil nil t)) + (t + (error "Cannot use hash algorithm %s!" algorithm)))) (defun jabber-caps-identity-< (a b) (let ((a-category (jabber-xml-get-attribute a 'category)) ----------------------------------------------------------------------- Summary of changes: .travis.yml | 16 ++++++++++++++++ jabber-avatar.el | 31 ++++++++++++++++++++++++++++--- jabber-disco.el | 36 ++++++++++++++++++++++++++---------- jabber-menu.el | 2 +- jabber-vcard.el | 2 +- tests/Makefile.am | 1 + tests/caps-hash.el | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 124 insertions(+), 15 deletions(-) create mode 100644 .travis.yml create mode 100644 tests/caps-hash.el hooks/post-receive -- emacs-jabber |