branch: elpa/jabber
commit fb7a66eca15a225df2acf9c6d731a5cf8433eb09
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>

    util: Reuse jabber-roster-contact-p at roster-membership sites
---
 lisp/jabber-roster.el |  9 +++------
 lisp/jabber-util.el   | 10 ++++------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/lisp/jabber-roster.el b/lisp/jabber-roster.el
index 9eca35cb6e..7455d4511d 100644
--- a/lisp/jabber-roster.el
+++ b/lisp/jabber-roster.el
@@ -522,12 +522,9 @@ entry is offered to clear the scope."
 
 (defun jabber-roster--jc-for-jid (jid)
   "Return the connection that has JID in its roster."
-  (let ((sym (jabber-jid-symbol jid)))
-    (or (cl-find-if
-         (lambda (jc)
-           (memq sym (plist-get (fsm-get-state-data jc) :roster)))
-         jabber-connections)
-        (car jabber-connections))))
+  (or (cl-find-if (lambda (jc) (jabber-roster-contact-p jc jid))
+                  jabber-connections)
+      (car jabber-connections)))
 
 (defun jabber-roster--action-chat ()
   "Open chat with the selected contact."
diff --git a/lisp/jabber-util.el b/lisp/jabber-util.el
index a1f1f504b0..9a9f8c7fd9 100644
--- a/lisp/jabber-util.el
+++ b/lisp/jabber-util.el
@@ -442,15 +442,13 @@ that has that contact in its roster."
                    completions))
        (let* ((default
                (or
-               (and contact-hint
-                    (setq contact-hint (jabber-jid-symbol contact-hint))
-                    (let ((matching
+               (and-let* ((contact-hint)
+                          (matching
                            (cl-find-if
                             (lambda (jc)
-                              (memq contact-hint (plist-get 
(fsm-get-state-data jc) :roster)))
+                              (jabber-roster-contact-p jc contact-hint))
                             jabber-connections)))
-                      (when matching
-                        (jabber-connection-bare-jid matching))))
+                 (jabber-connection-bare-jid matching))
                 ;; if the buffer is associated with a connection, use it
                 (when (and jabber-buffer-connection
                           (jabber-find-active-connection 
jabber-buffer-connection))

Reply via email to