mirror of
https://github.com/vale981/ement.el
synced 2025-03-05 09:21:37 -05:00
Tidy
This commit is contained in:
parent
34818ee6a2
commit
6043b60e72
1 changed files with 7 additions and 2 deletions
9
ement.el
9
ement.el
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
;; Author: Adam Porter <adam@alphapapa.net>
|
;; Author: Adam Porter <adam@alphapapa.net>
|
||||||
;; Keywords: comm
|
;; Keywords: comm
|
||||||
|
;; URL: https://github.com/alphapapa/ement.el
|
||||||
;; Package-Requires: ((emacs "26.3") (plz "0.1-pre"))
|
;; Package-Requires: ((emacs "26.3") (plz "0.1-pre"))
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -21,7 +22,8 @@
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
;; Another Matrix client!
|
;; Another Matrix client! This one is written from scratch and is
|
||||||
|
;; intended to be more "Emacsy," more suitable for MELPA, etc.
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
@ -126,6 +128,8 @@
|
||||||
(alist-get selected-name name-to-room nil nil #'string=)))
|
(alist-get selected-name name-to-room nil nil #'string=)))
|
||||||
|
|
||||||
(cl-defun ement--sync (session &key since)
|
(cl-defun ement--sync (session &key since)
|
||||||
|
"Send sync request for SESSION.
|
||||||
|
SINCE may be such a token."
|
||||||
;; SPEC: <https://matrix.org/docs/spec/client_server/r0.6.1#id257>.
|
;; SPEC: <https://matrix.org/docs/spec/client_server/r0.6.1#id257>.
|
||||||
;; TODO: Filtering: <https://matrix.org/docs/spec/client_server/r0.6.1#filtering>.
|
;; TODO: Filtering: <https://matrix.org/docs/spec/client_server/r0.6.1#filtering>.
|
||||||
;; TODO: Timeout.
|
;; TODO: Timeout.
|
||||||
|
@ -138,13 +142,14 @@
|
||||||
"sync" data (apply-partially #'ement--sync-callback session))))
|
"sync" data (apply-partially #'ement--sync-callback session))))
|
||||||
|
|
||||||
(defun ement--sync-callback (session data)
|
(defun ement--sync-callback (session data)
|
||||||
"SESSION. DATA should be the parsed JSON response."
|
"FIXME: Docstring."
|
||||||
(pcase-let* (((map rooms) data)
|
(pcase-let* (((map rooms) data)
|
||||||
((map ('join joined-rooms)) rooms))
|
((map ('join joined-rooms)) rooms))
|
||||||
(mapc (apply-partially #'ement--push-joined-room-events session) joined-rooms)
|
(mapc (apply-partially #'ement--push-joined-room-events session) joined-rooms)
|
||||||
(message "Sync done")))
|
(message "Sync done")))
|
||||||
|
|
||||||
(defun ement--push-joined-room-events (session joined-room)
|
(defun ement--push-joined-room-events (session joined-room)
|
||||||
|
"Push events for JOINED-ROOM into that room in SESSION."
|
||||||
(pcase-let* ((`(,id . ,event-types) joined-room)
|
(pcase-let* ((`(,id . ,event-types) joined-room)
|
||||||
(room (or (cl-find-if (lambda (room)
|
(room (or (cl-find-if (lambda (room)
|
||||||
(equal id (ement-room-id room)))
|
(equal id (ement-room-id room)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue