Differences From Artifact [a9c991a2fb]:
- File
src/MTXClient.h
— part of check-in
[17e299f073]
at
2020-10-03 21:56:23
on branch trunk
— Initial support for sync
Only sends the sync, does not do anything with the response yet. Handling the response will be implemented in the next several commits, piece by piece. (user: js, size: 6286) [annotate] [blame] [check-ins using]
To Artifact [4640a34e7e]:
- File src/MTXClient.h — part of check-in [63d344bd1d] at 2020-10-31 17:09:42 on branch trunk — Make sync loop automatic (user: js, size: 6819) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | /** * @brief A block called when the response for an operation was received. * * @param exception `nil` on success, otherwise an exception */ typedef void (^mtx_client_response_block_t)(id _Nullable exception); /** * @brief A block called when the room list was fetched. * * @param rooms An array of joined rooms, or nil on error * @param exception An exception if fetching the room list failed */ typedef void (^mtx_client_room_list_block_t)( | > > > > > > > | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | /** * @brief A block called when the response for an operation was received. * * @param exception `nil` on success, otherwise an exception */ typedef void (^mtx_client_response_block_t)(id _Nullable exception); /** * @brief A block called when an exception occurred during sync. * * @param exception The exception which occurred during sync */ typedef void (^mtx_sync_exception_handler_block_t)(id exception); /** * @brief A block called when the room list was fetched. * * @param rooms An array of joined rooms, or nil on error * @param exception An exception if fetching the room list failed */ typedef void (^mtx_client_room_list_block_t)( |
︙ | ︙ | |||
88 89 90 91 92 93 94 95 96 97 98 99 100 101 | @property (readonly, nonatomic) OFURL *homeserver; /** * @brief The storage used by the client. */ @property (readonly, nonatomic) id <MTXStorage> storage; /** * @brief Creates a new client with the specified access token on the specified * homeserver. * * @param userID The user ID for the client * @param deviceID The device ID for the client * @param accessToken The access token for the client | > > > > > > > > > > > > > | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | @property (readonly, nonatomic) OFURL *homeserver; /** * @brief The storage used by the client. */ @property (readonly, nonatomic) id <MTXStorage> storage; /** * @brief The timeout for sync requests. * * Defaults to 5 minutes. */ @property (nonatomic) of_time_interval_t syncTimeout; /** * @brief A block to handle exceptions that occurred during sync. */ @property (copy, nonatomic) mtx_sync_exception_handler_block_t syncExceptionHandler; /** * @brief Creates a new client with the specified access token on the specified * homeserver. * * @param userID The user ID for the client * @param deviceID The device ID for the client * @param accessToken The access token for the client |
︙ | ︙ | |||
139 140 141 142 143 144 145 | deviceID: (OFString *)deviceID accessToken: (OFString *)accessToken homeserver: (OFURL *)homeserver storage: (id <MTXStorage>)storage OF_DESIGNATED_INITIALIZER; /** | | | > | > > > > > | < | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | deviceID: (OFString *)deviceID accessToken: (OFString *)accessToken homeserver: (OFURL *)homeserver storage: (id <MTXStorage>)storage OF_DESIGNATED_INITIALIZER; /** * @brief Starts the sync loop. */ - (void)startSyncLoop; /** * @brief Stops the sync loop. * * The currently waiting sync is not aborted, but after it returns, no new sync * will be started. */ - (void)stopSyncLoop; /** * @brief Logs out the device and invalidates the access token. * * @warning The client can no longer be used after this succeeded! * * @param block A block to call when logging out succeeded or failed |
︙ | ︙ |