Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Early WIP: "next-gen" client #27

Closed
wants to merge 139 commits into from
Closed
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
4868b25
Initial work
alphapapa Nov 23, 2017
3bfcc81
More stuff
alphapapa Nov 24, 2017
02b4b60
Rename function
alphapapa Nov 25, 2017
9d914b4
Bunch of changes
alphapapa Nov 25, 2017
c2400f5
More
alphapapa Nov 25, 2017
e2e9b75
Getting there
alphapapa Nov 25, 2017
398b168
Login and polling works
alphapapa Nov 25, 2017
2ca6468
Sending messages works
alphapapa Nov 25, 2017
ee427c7
Add /me
alphapapa Nov 25, 2017
0cb3ab6
Add /who
alphapapa Nov 25, 2017
647c422
Fix displayname
alphapapa Nov 25, 2017
d5007f6
Fix room display name
alphapapa Nov 25, 2017
7f2f400
WIP
alphapapa Nov 25, 2017
85980b4
Fixing WIP
alphapapa Nov 25, 2017
17d906e
Remove debug stuff from WIP commits
alphapapa Nov 25, 2017
d773a95
More things
alphapapa Nov 25, 2017
65cb04f
Trim request error callback message
alphapapa Nov 25, 2017
c5ca4f6
Minor fixes
alphapapa Nov 26, 2017
17eaf33
Use concat instead of format
alphapapa Nov 27, 2017
880f44b
Add comments
alphapapa Nov 27, 2017
6602a38
Add and use format$ macro
alphapapa Nov 29, 2017
8df3b3f
(matrix-session): If server is not given, assume it's matrix.org.
alphapapa Dec 1, 2017
f13363f
(matrix-session) Prepend "@" to username if necessary
alphapapa Dec 1, 2017
3fd8865
Add: Save user and access token
alphapapa Dec 26, 2017
ea8a7fe
Change/Fix: (with-room-buffer) Create buffer if necessary
alphapapa Dec 26, 2017
5bcc080
Indentation
alphapapa Dec 26, 2017
6abd967
Change: Update room name when members join/leave
alphapapa Dec 26, 2017
2654c43
Change: (matrix-client-ng-display-name) Adjust room name logic
alphapapa Dec 26, 2017
a34e689
Add: matrix-pp-string
alphapapa May 17, 2018
53c8928
Fix: (matrix-log) Always insert at end of buffer
alphapapa May 17, 2018
489ce3b
Change: (send-message-callback) Adjust log message
alphapapa May 17, 2018
c815386
Change: (matrix-sync-timeline) Adjust logging and indentation
alphapapa May 17, 2018
c936926
Change: (sync-callback) Log callback data
alphapapa May 17, 2018
2200329
Change: (matrix-client-ng-m.room.message) Log message events
alphapapa May 17, 2018
dad652e
Change: Rename funcall-if to apply-if-fn
alphapapa May 17, 2018
b51d161
Fix: (matrix-send-message) Encode messages with UTF-8
alphapapa May 24, 2018
cf9ecdd
Fixes
alphapapa Jun 3, 2018
40e2524
Change: Use url-with-retrieve-async instead of request
alphapapa Jun 3, 2018
221139e
Change: Use matrix-unimplemented for these notices
alphapapa Jun 5, 2018
fb92922
Use url-with-retrieve-async for images and avatars
alphapapa Jun 5, 2018
4ba7fe7
Delete matrix-client.el
alphapapa Jun 5, 2018
f665f89
Indentation
alphapapa Jun 5, 2018
9d42312
Retry sync errors, adjust args
alphapapa Jun 5, 2018
34c5015
Adjust logging
alphapapa Jun 5, 2018
b8d68fe
Improve disconnect/logout
alphapapa Jun 6, 2018
f14dcde
Add: Date headers from master branch
alphapapa Jun 7, 2018
1b953ca
Add: Don't prompt the user if Emacs is exited while /sync is waiting
alphapapa Jun 7, 2018
75719f7
Port: (-update-last-seen)
alphapapa Jun 7, 2018
85e9264
Port: (matrix-client-ng-send-input)
alphapapa Jun 7, 2018
80b4c55
Add: Login error callback
alphapapa Jun 7, 2018
bd42bb1
Port: Updates for image insertion
alphapapa Jun 7, 2018
7ce488e
Port: tracking
alphapapa Jun 7, 2018
73923ee
Fix: (matrix--next-property-change) Return nil when limit is reached
alphapapa Jun 7, 2018
c7e9d5c
Add: "Humanize" date headers
alphapapa Jun 7, 2018
e2d21c9
Change: (matrix-warn) Handle args better
alphapapa Jun 8, 2018
9ef85e8
Change: (matrix-warn) Handle args better
alphapapa Jun 8, 2018
0045a9b
Change: (url-with-retrieve-async) Add :url to error callback
alphapapa Jun 8, 2018
8cd41ff
Fix: (join-room-error-callback) Fix errors and messages
alphapapa Jun 8, 2018
22f3537
Fix: cl-lib usage
alphapapa Jun 8, 2018
b795e6d
Fix: matrix--next-property-change and message insertion
alphapapa Jun 8, 2018
075d25c
Fix: Don't send notifications on initial sync
alphapapa Jun 8, 2018
15f8602
Fix: Attempt workaround of potential timer/timeouts issue
alphapapa Jun 8, 2018
1f922e3
Fix: Don't move point when inserting messages
alphapapa Jun 8, 2018
fa297e8
Tidy: Remove unneeded logging
alphapapa Jun 11, 2018
f32594d
Fix: Ignore errors from dead buffers on disconnect
alphapapa Jun 11, 2018
9a3b3e7
Fix: (matrix-warn) Add string to args after calling matrix-log
alphapapa Jun 11, 2018
63f06f6
Fix: Call matrix-warn instead of display-warning directly
alphapapa Jun 11, 2018
4aadf50
Add: Kill buffers on disconnect
alphapapa Jun 11, 2018
bb594e6
Add/Fix: Persist transaction ID and initialize to random number
alphapapa Jun 11, 2018
52fc85b
Fix: Header insertion position for new day's messages
alphapapa Jun 11, 2018
e3d3bb9
Comment: Add note
alphapapa Jun 11, 2018
79e0498
Add/Change: Derived mode and -connect command
alphapapa Jun 11, 2018
250236d
Fix: Add matrix- prefix to url-with-retrieve-async
alphapapa Jun 11, 2018
061f362
Fix: (matrix-url-with-retrieve-async) Error when connection completel…
alphapapa Jun 12, 2018
d69e775
Add: (--human-format-date) "Yesterday"
alphapapa Jun 13, 2018
707ce17
Fix: Set initial-sync-p in -connect
alphapapa Jun 17, 2018
89fb7a7
Add: Process state messages on connect
alphapapa Jun 17, 2018
c93d73b
Change: Update format$ macro from elexandria
alphapapa Jun 17, 2018
32ddaeb
Change/Fix: Rename matrix-warn to matrix-error and fix warning
alphapapa Jul 26, 2018
185f27d
Comment: Add a MAYBE
alphapapa Jul 26, 2018
22fd026
Notes: Add bug
alphapapa Jul 26, 2018
4714218
Add: Customizable server hostname
alphapapa Jul 27, 2018
c9e5a75
Fix: (matrix-url-with-retrieve-async) Add URL to error callback
alphapapa Jul 30, 2018
caa82e9
Add: Display sending messages immediately, with button to resend
alphapapa Jun 11, 2018
742a8a1
Reorganize faces and room code into separate files
alphapapa Jul 31, 2018
4328abd
Port: Typing notifications
alphapapa Jul 31, 2018
65db145
Port: Room topic
alphapapa Jul 31, 2018
440abfd
Port: Room avatars
alphapapa Jul 31, 2018
33e412d
Port: Convenience commands in room buffers
alphapapa Jul 31, 2018
bdc631b
Fix: "Left" messages
alphapapa Aug 1, 2018
6d17fb1
Fix: Insertion position
alphapapa Aug 1, 2018
24183c4
Port: Fetch older messages
alphapapa Aug 1, 2018
d86690d
Fix: Move room-related macros into room file
alphapapa Aug 2, 2018
0a6ac76
Fix: matrix-session :server instance-initform
alphapapa Aug 4, 2018
d3b0233
Fix: UTF-8 encode JSON data
alphapapa Aug 5, 2018
2ebc6bf
Notes: Add todo
alphapapa Aug 5, 2018
8d10d98
Revert "Fix: UTF-8 encode JSON data"
alphapapa Aug 18, 2018
2d8fc62
Fix: UTF-8-encode POST data
alphapapa Aug 18, 2018
4b96cd5
Add: (-image-url-prefixes) i.redditmedia.com
alphapapa Aug 27, 2018
b84ad8f
Fix: Trim messages before quoting
alphapapa Aug 27, 2018
6ede86e
Fix: Update date headers when message arrives on new day
alphapapa Sep 1, 2018
7bea720
Fix: Special commands must start with /
alphapapa Sep 2, 2018
faa6056
Fix: /who: Don't insert "[pending]"
alphapapa Sep 2, 2018
2b4a733
Add: /html command
alphapapa Sep 22, 2018
b7fbd10
Tidy: Remove unused code
alphapapa Sep 27, 2018
74e28a9
Add: Message body faces
alphapapa Sep 27, 2018
ee5c7b7
Add: Simple room command macro
alphapapa Sep 28, 2018
98dec04
Change: Send room command methods the command argument
alphapapa Sep 29, 2018
ecc2ea9
Change: Improve room command macro and use it for commands
alphapapa Sep 29, 2018
86a5622
Fix: (matrix-client-ng-send-input) Split command on spaces
alphapapa Sep 29, 2018
f97869c
Change: (matrix-client-ng-def-room-command) Automatically propertize
alphapapa Sep 29, 2018
90efd96
Change: (matrix-client-ng-defevent) Improve debug declaration
alphapapa Oct 10, 2018
f34ed94
Add: Render messages quoted with mx-reply specially
alphapapa Oct 10, 2018
0bcb790
Add: /upload command for images
alphapapa Oct 10, 2018
21c8af2
Change: Use request instead of url.el
alphapapa Oct 10, 2018
728d0b3
Revert: "Change: Use request instead of url.el"
alphapapa Oct 10, 2018
3e80e3e
Add/Fix: Use request.el for uploading
alphapapa Oct 10, 2018
27114bf
Fix: Disable shr filling except for blockquotes
alphapapa Oct 10, 2018
4941b02
Change: (matrix-client-ng-update) Use matrix-client-ng-timeline
alphapapa Oct 13, 2018
e36883f
Change: Improve buffer naming, especially on initial sync
alphapapa Oct 15, 2018
3caf8b3
Add/Change: Use <backtab> to go to earlier events
alphapapa Oct 15, 2018
9b44eb5
Fix: Use correct show-images variable
alphapapa Oct 16, 2018
52d90d0
Fix: Remove newlines between HTML tags in mx-reply messages
alphapapa Oct 16, 2018
4f4687d
WIP: ordered-buffer code for inserting into room buffers
alphapapa Oct 13, 2018
0f24ad1
Add: Store timeline event IDs in hash table for deduplication
alphapapa Oct 14, 2018
86edb4e
Fix/Tidy: Fix small bug and move code around
alphapapa Oct 14, 2018
00c711b
Tidy: Comments and docstrings
alphapapa Oct 14, 2018
904d7f9
Tidy: Requirement
alphapapa Oct 14, 2018
f28a52e
Tidy: Remove obsoleted code
alphapapa Oct 14, 2018
8403a0e
Update: (--update-date-headers) For ordered-buffer changes
alphapapa Oct 14, 2018
d1bdd13
Add: timestamp-header-delta variable
alphapapa Oct 14, 2018
df7ea5c
Change/Fix: Process timeline events in order
alphapapa Oct 15, 2018
6e20bec
Change: Improve insertion of headers for old messages
alphapapa Oct 15, 2018
3a8b849
Add: Update date headers at midnight
alphapapa Oct 15, 2018
cdbf9e1
Fix: Don't return empty strings for room displaynames
alphapapa Oct 16, 2018
28839f0
Add: Fancy quoting
alphapapa Oct 16, 2018
77f7b2b
Change: Destructure mx-reply messages with esxml
alphapapa Oct 16, 2018
0e3bef5
Attempt to fix malformed replys
jgkamat Oct 17, 2018
35c8bc9
Merge pull request #55 from jgkamat/ordered-buffer
alphapapa Oct 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
693 changes: 481 additions & 212 deletions matrix-api-r0.3.0.el

Large diffs are not rendered by default.

243 changes: 0 additions & 243 deletions matrix-api.el

This file was deleted.

18 changes: 10 additions & 8 deletions matrix-client-handlers.el
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ the Matrix spec for more information about its format."
matrix-client-input-filter-leave
matrix-client-send-to-current-room)))))

(defun matrix-client-handler-m.room.avatar (con room data)
(cl-defmethod matrix-client-handler-m.room.avatar ((session matrix-session) room data)
(when matrix-client-show-room-avatars
(pcase-let* (((map sender content) data)
((map url) content)
Expand All @@ -82,13 +82,15 @@ the Matrix spec for more information about its format."
(if url
;; New avatar
;; TODO: Maybe display the new avatar in the chat list, like Riot.
(request (matrix-transform-mxc-uri url)
:parser (apply-partially #'matrix-client-parse-image room :max-width 32 :max-height 32)
:success (apply-partially #'matrix-client-room-avatar-callback
:room room
:message msg
:max-width 32
:max-height 32))
(matrix-url-with-retrieve-async (matrix-transform-mxc-uri session url)
:silent t
:inhibit-cookies t
:parser (apply-partially #'matrix-client-parse-image room :max-width 32 :max-height 32)
:success (apply-partially #'matrix-client-room-avatar-callback
:room room
:message msg
:max-width 32
:max-height 32))
;; Avatar removed
(oset room avatar nil)
;; TODO: A function to automatically propertize a string with its related event data would be nice.
Expand Down
28 changes: 16 additions & 12 deletions matrix-client-images.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ to match until the next whitespace character."
for regexp = (rx-to-string `(seq (regexp ,regexp) (1+ (not space))))
append (-map #'first (s-match-strings-all regexp text))))

(cl-defmethod matrix-client-insert-image ((room matrix-client-room) message-id url)
(cl-defmethod matrix-client-insert-image ((room matrix-room) message-id url)
"Download image from URL and insert it at message MESSAGE-ID in ROOM."
(request url
:parser (apply-partially #'matrix-client-parse-image room)
:success (apply-partially #'matrix-client-insert-image-callback
:room room
:message-id message-id
:url url)))
(matrix-url-with-retrieve-async url
:silent t
:inhibit-cookies t
:query-on-exit nil
:parser (apply-partially #'matrix-client-parse-image room)
:success (apply-partially #'matrix-client-insert-image-callback
:room room
:message-id message-id
:url url)))

(cl-defmethod matrix-client-parse-image ((room matrix-client-room) &rest rescale-args)
(cl-defmethod matrix-client-parse-image ((room matrix-room) &rest rescale-args)
"Parse image from current HTTP response buffer and return image object.
RESCALE-ARGS are passed to `matrix-client-rescale-image'."
(pcase-let* ((data (progn
Expand All @@ -43,7 +46,8 @@ RESCALE-ARGS are passed to `matrix-client-rescale-image'."
(mm-disable-multibyte)
;; Point is where the body starts, after the headers
(buffer-substring (point) (point-max))))
((eieio buffer) room))
((eieio extra) room)
((eieio buffer) extra))
(with-current-buffer buffer
;; Rescale image in room buffer to get proper size
(apply #'matrix-client-rescale-image data rescale-args))))
Expand Down Expand Up @@ -72,15 +76,15 @@ determined by the size of the buffer's window."
:max-width max-width
:max-height max-height)))

(cl-defmethod matrix-client-insert-image-callback (&key (room matrix-client-room) message-id url
(cl-defmethod matrix-client-insert-image-callback (&key (room matrix-room) message-id url
data error-thrown symbol-status response
&allow-other-keys)
"Insert image into proper place at URL in message MESSAGE-ID in ROOM.
Image is passed from parser as DATA, which should be an image
object made with `create-image'. This function should be called
as an async callback when the image is downloaded."
(with-slots (buffer) room
(with-current-buffer buffer
(with-current-buffer (oref* room extra buffer)
(save-excursion
;; Starting with last message, search backward to find message
(cl-loop initially do (goto-char (point-max))
for event_id = (get-text-property (point) 'event_id)
Expand Down
Loading