Add LimitExceededError nio callback
This commit is contained in:
		
							
								
								
									
										31
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								TODO.md
									
									
									
									
									
								
							@@ -2,6 +2,13 @@
 | 
			
		||||
- replace "property var" by "property <object>" where applicable
 | 
			
		||||
- [debug mode](https://docs.python.org/3/library/asyncio-dev.html)
 | 
			
		||||
 | 
			
		||||
ideas
 | 
			
		||||
(^/v) messages unread + messages still sending
 | 
			
		||||
sticky avatar at top
 | 
			
		||||
 | 
			
		||||
nio
 | 
			
		||||
fix `RoomForgetResponse.create_error`
 | 
			
		||||
 | 
			
		||||
OLD
 | 
			
		||||
 | 
			
		||||
- Refactoring
 | 
			
		||||
@@ -9,12 +16,8 @@ OLD
 | 
			
		||||
  - Don't bake in size properties for components
 | 
			
		||||
 | 
			
		||||
- Bug fixes
 | 
			
		||||
  - dataclass-like `default_factory` for ListItem
 | 
			
		||||
  - Prevent briefly seeing login screen if there are accounts to
 | 
			
		||||
    resumeSession for but they take time to appear
 | 
			
		||||
  - 100% CPU usage when hitting top edge to trigger messages loading
 | 
			
		||||
  - Sending `` → not clickable?
 | 
			
		||||
  - Icons, images and HStyle singleton aren't reloaded
 | 
			
		||||
  - `MessageDelegate.qml:63: TypeError: 'reloadPreviousItem' not a function`
 | 
			
		||||
  - RoomEventsList scrolling when resizing the window
 | 
			
		||||
 | 
			
		||||
@@ -55,19 +58,14 @@ OLD
 | 
			
		||||
  - nio.MatrixRoom has `typing_users`, no need to handle it on our own
 | 
			
		||||
  - Initial sync filter and lazy load, see weechat-matrix `_handle_login()`
 | 
			
		||||
    - See also `handle_response()`'s `keys_query` request
 | 
			
		||||
  - HTTP/2
 | 
			
		||||
  - `retry_after_ms` when rate-limited
 | 
			
		||||
  - Direct chats category
 | 
			
		||||
  - On sync, check messages API, if a limited sync timeline was received
 | 
			
		||||
  - Markdown: don't turn #things (no space) and `thing\n---` into title,
 | 
			
		||||
    disable `__` syntax for bold/italic
 | 
			
		||||
  - Push instead of replacing in stack view (remove getMemberFilter when done)
 | 
			
		||||
  - Make links in room subtitle clickable, formatting?
 | 
			
		||||
  - `<pre>` scrollbar on overflow
 | 
			
		||||
  - Handle cases where an avatar char is # or @ (#alias room, @user\_id)
 | 
			
		||||
  - When inviting someone to direct chat, room is "Empty room" until accepted,
 | 
			
		||||
    it should be the peer's display name instead.
 | 
			
		||||
  - Keep an accounts order
 | 
			
		||||
  - See `Qt.callLater()` potential usages
 | 
			
		||||
  - Banner name color instead of bold
 | 
			
		||||
  - Animate RoomEventDelegate DayBreak apparition
 | 
			
		||||
@@ -80,19 +78,6 @@ OLD
 | 
			
		||||
  - `m.room.aliases` event
 | 
			
		||||
  - Support "Empty room (was ...)" after peer left
 | 
			
		||||
 | 
			
		||||
- Waiting for approval/release
 | 
			
		||||
  - nio avatars
 | 
			
		||||
  - olm/olm-devel 0.3.1 in void repos
 | 
			
		||||
 | 
			
		||||
- Distribution
 | 
			
		||||
  - Review setup.py, add dependencies
 | 
			
		||||
  - List dependencies
 | 
			
		||||
  - README.md
 | 
			
		||||
  - Use PyInstaller or pyqtdeploy
 | 
			
		||||
    - Test command:
 | 
			
		||||
    ```
 | 
			
		||||
    pyinstaller --onefile --windowed --name harmonyqml \
 | 
			
		||||
                --add-data 'harmonyqml/components:harmonyqml/components' \
 | 
			
		||||
                --additional-hooks-dir . \
 | 
			
		||||
                --upx-dir ~/opt/upx-3.95-amd64_linux \
 | 
			
		||||
                run.py
 | 
			
		||||
    ```
 | 
			
		||||
 
 | 
			
		||||
@@ -143,7 +143,10 @@ class MatrixClient(nio.AsyncClient):
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        async with self.send_locks[room_id]:
 | 
			
		||||
            print(await self.room_send(room_id, "m.room.message", content))
 | 
			
		||||
            response = await self.room_send(room_id, "m.room.message", content)
 | 
			
		||||
 | 
			
		||||
            if isinstance(response, nio.RoomSendError):
 | 
			
		||||
                log.error("Failed to send message: %s", response)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # Callbacks for nio responses
 | 
			
		||||
@@ -194,6 +197,11 @@ class MatrixClient(nio.AsyncClient):
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    async def onLimitExceededError(self, resp: nio.LimitExceededError) -> None:
 | 
			
		||||
        # TODO: show something in the client
 | 
			
		||||
        log.warning("Failed to send message: %s", resp)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # Callbacks for nio events
 | 
			
		||||
 | 
			
		||||
    # Special %tokens for event contents:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user