diff options
author | Boutade <thegoofist@protonmail.com> | 2019-09-26 20:35:11 -0500 |
---|---|---|
committer | Boutade <thegoofist@protonmail.com> | 2019-09-26 20:35:11 -0500 |
commit | db1d26d76fc1946512469774afdce1d8e4ee28d5 (patch) | |
tree | b01633f4af7c3faf6c5b9c9465cd2098a9a04a38 /utility-apps.lisp | |
parent | 2bef1cf67a681cc34748b6e71df9fa813cee7a20 (diff) |
send-text-message given format args, contact query utils added
Diffstat (limited to 'utility-apps.lisp')
-rw-r--r-- | utility-apps.lisp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/utility-apps.lisp b/utility-apps.lisp index c9789bf..ec52773 100644 --- a/utility-apps.lisp +++ b/utility-apps.lisp @@ -115,6 +115,23 @@ (and like (search name (room-name room) :test #'string-equal))) :collect (if full room (room-id room))))) +(defun client-contacts (client) + "Returns a list of all users this client knows about." + (let (contacts) + (loop :for room :being :the :hash-values :of (directory-table client) :do + (dolist (user (room-members room)) + (pushnew user contacts :test #'equal))) + contacts)) + +(defun find-contact (client name &key like) + "Finds a specific matrix ID by name. If LIKE is NIL, returns a string equal to + NAME if this client has a contact with that NAME, or NIL otherwise. If LIKE + is not NIL returns the first matrix ID found that contains NAME as a + substring, or NIL if no such matrix ID is found." + (find-if (lambda (contact) + (or (equal name contact) + (and like (search name contact :test #'string-equal)))) + (client-contacts client))) ;;; Basic Joiner Bot |