Implement device renaming
This commit is contained in:
@@ -1258,7 +1258,7 @@ class MatrixClient(nio.AsyncClient):
|
||||
|
||||
|
||||
async def devices_info(self) -> List[Dict[str, Any]]:
|
||||
"""Get list of devices and their info for our user."""
|
||||
"""Get sorted list of devices and their info for our user."""
|
||||
|
||||
def get_type(device_id: str) -> str:
|
||||
# Return "current", "verified", "blacklisted", "ignored" or "unset"
|
||||
@@ -1301,6 +1301,16 @@ class MatrixClient(nio.AsyncClient):
|
||||
)
|
||||
|
||||
|
||||
async def rename_device(self, device_id: str, name: str) -> bool:
|
||||
"""Rename one of our device, return `False` if it doesn't exist."""
|
||||
|
||||
try:
|
||||
await self.update_device(device_id, {"display_name": name})
|
||||
return True
|
||||
except MatrixNotFound:
|
||||
return False
|
||||
|
||||
|
||||
# Functions to register/modify data into models
|
||||
|
||||
async def update_account_unread_counts(self) -> None:
|
||||
|
Reference in New Issue
Block a user