Compare commits
8 Commits
151355a790
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
5062c9dd15
|
|||
|
f844be04b0
|
|||
|
eb8fff42bf
|
|||
|
d94c1342b0
|
|||
|
cb4945d469
|
|||
|
5bbb2e6afa
|
|||
|
5756d8ba39
|
|||
|
9e95b1fd78
|
@@ -88,7 +88,7 @@ function API:sync(options)
|
||||
filter = options.filter,
|
||||
since = options.since,
|
||||
full_state = options.full or false,
|
||||
set_presence = online and nil or "offline",
|
||||
set_presence = options.online and nil or "offline",
|
||||
timeout = options.timeout,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -228,6 +228,7 @@ function Room:get_alias_or_id()
|
||||
end
|
||||
end
|
||||
|
||||
local make_unimplemented_handler
|
||||
local make_unimplemented_handler = function (self, event)
|
||||
local env_value = os.getenv("MATRIX_CLIENT_LOG_UNHANDLED_EVENTS")
|
||||
if env_value and #env_value > 0 and env_value ~= "0" then
|
||||
@@ -445,16 +446,20 @@ function Client:_sync(options)
|
||||
|
||||
for _, kind in ipairs { "join", "invite", "leave" } do
|
||||
local handle = self["_sync_handle_room__" .. kind]
|
||||
for room_id, room_data in pairs(response.rooms[kind]) do
|
||||
self._log("sync: %s %s", kind, room_id)
|
||||
-- XXX: Maybe this is abusing pcall() too much to allow handler
|
||||
-- code to bail and continue with the next room instead of
|
||||
-- completely failing to sync. Dunno.
|
||||
local ok, err = xpcall(handle, xpcall_add_traceback, self, room_id, room_data)
|
||||
if not ok then
|
||||
self._log("sync: Error handling '%s' event for room %s:\n%s", kind, room_id, err)
|
||||
self._log("sync: Event payload: %s", json.encode(room_data))
|
||||
end
|
||||
if response.rooms == nil or response.rooms[kind] == nil then
|
||||
self._log("sync: Error syncing rooms (nil value)")
|
||||
else
|
||||
for room_id, room_data in pairs(response.rooms[kind]) do
|
||||
self._log("sync: %s %s", kind, room_id)
|
||||
-- XXX: Maybe this is abusing pcall() too much to allow handler
|
||||
-- code to bail and continue with the next room instead of
|
||||
-- completely failing to sync. Dunno.
|
||||
local ok, err = xpcall(handle, xpcall_add_traceback, self, room_id, room_data)
|
||||
if not ok then
|
||||
self._log("sync: Error handling '%s' event for room %s:\n%s", kind, room_id, err)
|
||||
self._log("sync: Event payload: %s", json.encode(room_data))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user