From: Magnus H. <leg...@us...> - 2015-02-09 11:25:35
|
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 11f665108db5da5a4510991703cb733084cf7a29 (commit) via a7ca3f0efacbdf4b2fa478ea7db8be7ebf0a426f (commit) from e2494578ff798b23eefc3f113a0819387c898e49 (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 11f665108db5da5a4510991703cb733084cf7a29 Author: Magnus Henoch <mag...@gm...> Date: Mon Feb 9 10:29:39 2015 +0000 Use contact hint in jabber-chat-with When asking for account, default to an account that has the provided JID in its roster, if any. diff --git a/jabber-chat.el b/jabber-chat.el index f27af4b..e6486f1 100644 --- a/jabber-chat.el +++ b/jabber-chat.el @@ -654,10 +654,10 @@ If DONT-PRINT-NICK-P is true, don't include nickname." "Open an empty chat window for chatting with JID. With a prefix argument, open buffer in other window. Returns the chat buffer." - (interactive (let ((jid + (interactive (let* ((jid (jabber-read-jid-completing "chat with:")) - (account - (jabber-read-account))) + (account + (jabber-read-account nil jid))) (list account jid current-prefix-arg))) (let ((buffer (jabber-chat-create-buffer jc jid))) commit a7ca3f0efacbdf4b2fa478ea7db8be7ebf0a426f Author: Magnus Henoch <mag...@gm...> Date: Mon Feb 9 10:28:55 2015 +0000 Add contact-hint optional argument to jabber-read-account If specified, default to an account that has the given JID in its roster. diff --git a/jabber-util.el b/jabber-util.el index 049eca6..b6e1304 100644 --- a/jabber-util.el +++ b/jabber-util.el @@ -21,7 +21,7 @@ ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -(eval-when-compile (require 'cl)) +(require 'cl) (condition-case nil (require 'password) (error nil)) @@ -348,10 +348,12 @@ Useful if the password proved to be wrong." (when (fboundp 'password-cache-remove) (password-cache-remove (jabber-password-key bare-jid)))) -(defun jabber-read-account (&optional always-ask) +(defun jabber-read-account (&optional always-ask contact-hint) "Ask for which connected account to use. If ALWAYS-ASK is nil and there is only one account, return that -account." +account. +If CONTACT-HINT is a string or a JID symbol, default to an account +that has that contact in its roster." (let ((completions (mapcar (lambda (c) (cons @@ -374,6 +376,15 @@ account." (jabber-connection-bare-jid at-point))) completions)) (let* ((default (or + (and contact-hint + (setq contact-hint (jabber-jid-symbol contact-hint)) + (let ((matching + (find-if + (lambda (jc) + (memq contact-hint (plist-get (fsm-get-state-data jc) :roster))) + jabber-connections))) + (when matching + (jabber-connection-bare-jid matching)))) ;; if the buffer is associated with a connection, use it (when (and jabber-buffer-connection (memq jabber-buffer-connection jabber-connections)) ----------------------------------------------------------------------- Summary of changes: jabber-chat.el | 6 +++--- jabber-util.el | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) hooks/post-receive -- emacs-jabber |