Adjust to ObjFW changes
FossilOrigin-Name: 531eb84cf5c27b39f7701dfa446886e2962aad9a8b60c3623e3b70833b18c592
This commit is contained in:
parent
0166881d65
commit
4252cbf3f2
10 changed files with 69 additions and 55 deletions
|
@ -1,5 +1,5 @@
|
||||||
package_format 1
|
package_format 1
|
||||||
package_depends_on ObjOpenSSL
|
package_depends_on ObjFWTLS
|
||||||
package_depends_on ObjSQLite3
|
package_depends_on ObjSQLite3
|
||||||
LIBS="-lobjmatrix $LIBS"
|
LIBS="-lobjmatrix $LIBS"
|
||||||
FRAMEWORK_LIBS="-framework ObjMatrix $FRAMEWORK_LIBS"
|
FRAMEWORK_LIBS="-framework ObjMatrix $FRAMEWORK_LIBS"
|
||||||
|
|
|
@ -9,8 +9,7 @@ It is currently in early development stages.
|
||||||
|
|
||||||
## How to build it?
|
## How to build it?
|
||||||
|
|
||||||
You need [ObjFW](https://objfw.nil.im),
|
You need [ObjFW](https://objfw.nil.im) and
|
||||||
[ObjOpenSSL](https://fossil.nil.im/objopenssl) and
|
|
||||||
[ObjSQLite3](https://fossil.nil.im/objsqlite3) installed in order to do this.
|
[ObjSQLite3](https://fossil.nil.im/objsqlite3) installed in order to do this.
|
||||||
|
|
||||||
ObjMatrix uses modern Objective-C, and hence cannot be compiled with GCC, but
|
ObjMatrix uses modern Objective-C, and hence cannot be compiled with GCC, but
|
||||||
|
@ -18,7 +17,7 @@ only with Clang. So install Clang first and ObjFW will automatically pick it up.
|
||||||
|
|
||||||
You can install them all like this:
|
You can install them all like this:
|
||||||
|
|
||||||
$ for i in objfw objopenssl objsqlite3 objmatrix; do
|
$ for i in objfw objsqlite3 objmatrix; do
|
||||||
fossil clone https://fossil.nil.im/$i $i.fossil &&
|
fossil clone https://fossil.nil.im/$i $i.fossil &&
|
||||||
mkdir $i &&
|
mkdir $i &&
|
||||||
cd $i &&
|
cd $i &&
|
||||||
|
|
|
@ -16,10 +16,10 @@ AS_IF([test x"$OBJFW_CONFIG" = x""], [
|
||||||
AC_MSG_ERROR(You need ObjFW and objfw-config installed!)
|
AC_MSG_ERROR(You need ObjFW and objfw-config installed!)
|
||||||
])
|
])
|
||||||
|
|
||||||
AS_IF([$OBJFW_CONFIG --package ObjOpenSSL], [
|
AS_IF([$OBJFW_CONFIG --package ObjFWTLS], [
|
||||||
OBJFW_CONFIG_FLAGS="$OBJFW_CONFIG_FLAGS --package ObjOpenSSL"
|
OBJFW_CONFIG_FLAGS="$OBJFW_CONFIG_FLAGS --package ObjFWTLS"
|
||||||
], [
|
], [
|
||||||
AC_MSG_ERROR(ObjOpenSSL not found!)
|
AC_MSG_ERROR(ObjFWTLS not found!)
|
||||||
])
|
])
|
||||||
AS_IF([$OBJFW_CONFIG --package ObjSQLite3], [
|
AS_IF([$OBJFW_CONFIG --package ObjSQLite3], [
|
||||||
OBJFW_CONFIG_FLAGS="$OBJFW_CONFIG_FLAGS --package ObjSQLite3"
|
OBJFW_CONFIG_FLAGS="$OBJFW_CONFIG_FLAGS --package ObjSQLite3"
|
||||||
|
|
|
@ -92,7 +92,7 @@ typedef void (^MTXClientRoomJoinBlock)(OFString *_Nullable roomID,
|
||||||
/**
|
/**
|
||||||
* @brief The homeserver used by the client.
|
* @brief The homeserver used by the client.
|
||||||
*/
|
*/
|
||||||
@property (readonly, nonatomic) OFURL *homeserver;
|
@property (readonly, nonatomic) OFIRI *homeserver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The storage used by the client.
|
* @brief The storage used by the client.
|
||||||
|
@ -118,14 +118,14 @@ typedef void (^MTXClientRoomJoinBlock)(OFString *_Nullable roomID,
|
||||||
* @param userID The user ID for the client
|
* @param userID The user ID for the client
|
||||||
* @param deviceID The device ID for the client
|
* @param deviceID The device ID for the client
|
||||||
* @param accessToken The access token for the client
|
* @param accessToken The access token for the client
|
||||||
* @param homeserver The URL of the homeserver
|
* @param homeserver The IRI of the homeserver
|
||||||
* @param storage The storage the client should use
|
* @param storage The storage the client should use
|
||||||
* @return An autoreleased MTXClient
|
* @return An autoreleased MTXClient
|
||||||
*/
|
*/
|
||||||
+ (instancetype)clientWithUserID: (OFString *)userID
|
+ (instancetype)clientWithUserID: (OFString *)userID
|
||||||
deviceID: (OFString *)deviceID
|
deviceID: (OFString *)deviceID
|
||||||
accessToken: (OFString *)accessToken
|
accessToken: (OFString *)accessToken
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
storage: (id <MTXStorage>)storage;
|
storage: (id <MTXStorage>)storage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,7 +139,7 @@ typedef void (^MTXClientRoomJoinBlock)(OFString *_Nullable roomID,
|
||||||
*/
|
*/
|
||||||
+ (void)logInWithUser: (OFString *)user
|
+ (void)logInWithUser: (OFString *)user
|
||||||
password: (OFString *)password
|
password: (OFString *)password
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
storage: (id <MTXStorage>)storage
|
storage: (id <MTXStorage>)storage
|
||||||
block: (MTXClientLoginBlock)block;
|
block: (MTXClientLoginBlock)block;
|
||||||
|
|
||||||
|
@ -150,14 +150,14 @@ typedef void (^MTXClientRoomJoinBlock)(OFString *_Nullable roomID,
|
||||||
* @param userID The user ID for the client
|
* @param userID The user ID for the client
|
||||||
* @param deviceID The device ID for the client
|
* @param deviceID The device ID for the client
|
||||||
* @param accessToken The access token for the client
|
* @param accessToken The access token for the client
|
||||||
* @param homeserver The URL of the homeserver
|
* @param homeserver The IRI of the homeserver
|
||||||
* @param storage The storage the client should use
|
* @param storage The storage the client should use
|
||||||
* @return An initialized MTXClient
|
* @return An initialized MTXClient
|
||||||
*/
|
*/
|
||||||
- (instancetype)initWithUserID: (OFString *)userID
|
- (instancetype)initWithUserID: (OFString *)userID
|
||||||
deviceID: (OFString *)deviceID
|
deviceID: (OFString *)deviceID
|
||||||
accessToken: (OFString *)accessToken
|
accessToken: (OFString *)accessToken
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
storage: (id <MTXStorage>)storage
|
storage: (id <MTXStorage>)storage
|
||||||
OF_DESIGNATED_INITIALIZER;
|
OF_DESIGNATED_INITIALIZER;
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,12 @@
|
||||||
#import "MTXSyncFailedException.h"
|
#import "MTXSyncFailedException.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
validateHomeserver(OFURL *homeserver)
|
validateHomeserver(OFIRI *homeserver)
|
||||||
{
|
{
|
||||||
if (![homeserver.scheme isEqual: @"http"] &&
|
if (![homeserver.scheme isEqual: @"http"] &&
|
||||||
![homeserver.scheme isEqual: @"https"])
|
![homeserver.scheme isEqual: @"https"])
|
||||||
@throw [OFUnsupportedProtocolException
|
@throw [OFUnsupportedProtocolException
|
||||||
exceptionWithURL: homeserver];
|
exceptionWithIRI: homeserver];
|
||||||
|
|
||||||
if (homeserver.path != nil && ![homeserver.path isEqual: @"/"])
|
if (homeserver.path != nil && ![homeserver.path isEqual: @"/"])
|
||||||
@throw [OFInvalidArgumentException exception];
|
@throw [OFInvalidArgumentException exception];
|
||||||
|
@ -55,7 +55,7 @@ validateHomeserver(OFURL *homeserver)
|
||||||
+ (instancetype)clientWithUserID: (OFString *)userID
|
+ (instancetype)clientWithUserID: (OFString *)userID
|
||||||
deviceID: (OFString *)deviceID
|
deviceID: (OFString *)deviceID
|
||||||
accessToken: (OFString *)accessToken
|
accessToken: (OFString *)accessToken
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
storage: (id <MTXStorage>)storage
|
storage: (id <MTXStorage>)storage
|
||||||
{
|
{
|
||||||
return [[[self alloc] initWithUserID: userID
|
return [[[self alloc] initWithUserID: userID
|
||||||
|
@ -67,7 +67,7 @@ validateHomeserver(OFURL *homeserver)
|
||||||
|
|
||||||
+ (void)logInWithUser: (OFString *)user
|
+ (void)logInWithUser: (OFString *)user
|
||||||
password: (OFString *)password
|
password: (OFString *)password
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
storage: (id <MTXStorage>)storage
|
storage: (id <MTXStorage>)storage
|
||||||
block: (MTXClientLoginBlock)block
|
block: (MTXClientLoginBlock)block
|
||||||
{
|
{
|
||||||
|
@ -112,22 +112,24 @@ validateHomeserver(OFURL *homeserver)
|
||||||
if (![userID isKindOfClass: OFString.class] ||
|
if (![userID isKindOfClass: OFString.class] ||
|
||||||
![deviceID isKindOfClass: OFString.class] ||
|
![deviceID isKindOfClass: OFString.class] ||
|
||||||
![accessToken isKindOfClass: OFString.class]) {
|
![accessToken isKindOfClass: OFString.class]) {
|
||||||
block(nil, [OFInvalidServerReplyException exception]);
|
block(nil,
|
||||||
|
[OFInvalidServerResponseException exception]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OFString *baseURL =
|
OFString *baseIRI =
|
||||||
response[@"well_known"][@"m.homeserver"][@"base_url"];
|
response[@"well_known"][@"m.homeserver"][@"base_url"];
|
||||||
if (baseURL != nil &&
|
if (baseIRI != nil &&
|
||||||
![baseURL isKindOfClass: OFString.class]) {
|
![baseIRI isKindOfClass: OFString.class]) {
|
||||||
block(nil, [OFInvalidServerReplyException exception]);
|
block(nil,
|
||||||
|
[OFInvalidServerResponseException exception]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OFURL *realHomeserver;
|
OFIRI *realHomeserver;
|
||||||
if (baseURL != nil) {
|
if (baseIRI != nil) {
|
||||||
@try {
|
@try {
|
||||||
realHomeserver = [OFURL URLWithString: baseURL];
|
realHomeserver = [OFIRI IRIWithString: baseIRI];
|
||||||
} @catch (id e) {
|
} @catch (id e) {
|
||||||
block(nil, e);
|
block(nil, e);
|
||||||
return;
|
return;
|
||||||
|
@ -149,7 +151,7 @@ validateHomeserver(OFURL *homeserver)
|
||||||
- (instancetype)initWithUserID: (OFString *)userID
|
- (instancetype)initWithUserID: (OFString *)userID
|
||||||
deviceID: (OFString *)deviceID
|
deviceID: (OFString *)deviceID
|
||||||
accessToken: (OFString *)accessToken
|
accessToken: (OFString *)accessToken
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
storage: (id <MTXStorage>)storage
|
storage: (id <MTXStorage>)storage
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
@ -212,11 +214,20 @@ validateHomeserver(OFURL *homeserver)
|
||||||
MTXRequest *request = [self
|
MTXRequest *request = [self
|
||||||
requestWithPath: @"/_matrix/client/r0/sync"];
|
requestWithPath: @"/_matrix/client/r0/sync"];
|
||||||
unsigned long long timeoutMs = _syncTimeout * 1000;
|
unsigned long long timeoutMs = _syncTimeout * 1000;
|
||||||
OFMutableDictionary<OFString *, OFString *> *query =
|
OFMutableArray<OFPair <OFString *, OFString *> *> *queryItems =
|
||||||
[OFMutableDictionary dictionaryWithObject: @(timeoutMs).stringValue
|
[OFMutableArray array];
|
||||||
forKey: @"timeout"];
|
OFString *since = [_storage nextBatchForDeviceID: _deviceID];
|
||||||
query[@"since"] = [_storage nextBatchForDeviceID: _deviceID];
|
|
||||||
request.query = query;
|
[queryItems addObject:
|
||||||
|
[OFPair pairWithFirstObject: @"timeout"
|
||||||
|
secondObject: @(timeoutMs).stringValue]];
|
||||||
|
|
||||||
|
if (since != nil)
|
||||||
|
[queryItems addObject:
|
||||||
|
[OFPair pairWithFirstObject: @"since"
|
||||||
|
secondObject: since]];
|
||||||
|
|
||||||
|
request.queryItems = queryItems;
|
||||||
[request performWithBlock: ^ (MTXResponse response, int statusCode,
|
[request performWithBlock: ^ (MTXResponse response, int statusCode,
|
||||||
id exception) {
|
id exception) {
|
||||||
if (exception != nil) {
|
if (exception != nil) {
|
||||||
|
@ -238,7 +249,8 @@ validateHomeserver(OFURL *homeserver)
|
||||||
if (![nextBatch isKindOfClass: OFString.class]) {
|
if (![nextBatch isKindOfClass: OFString.class]) {
|
||||||
if (_syncExceptionHandler != NULL)
|
if (_syncExceptionHandler != NULL)
|
||||||
_syncExceptionHandler(
|
_syncExceptionHandler(
|
||||||
[OFInvalidServerReplyException exception]);
|
[OFInvalidServerResponseException
|
||||||
|
exception]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,13 +336,15 @@ validateHomeserver(OFURL *homeserver)
|
||||||
|
|
||||||
OFArray<OFString *> *joinedRooms = response[@"joined_rooms"];
|
OFArray<OFString *> *joinedRooms = response[@"joined_rooms"];
|
||||||
if (![joinedRooms isKindOfClass: OFArray.class]) {
|
if (![joinedRooms isKindOfClass: OFArray.class]) {
|
||||||
block(nil, [OFInvalidServerReplyException exception]);
|
block(nil,
|
||||||
|
[OFInvalidServerResponseException exception]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (OFString *room in joinedRooms) {
|
for (OFString *room in joinedRooms) {
|
||||||
if (![room isKindOfClass: OFString.class]) {
|
if (![room isKindOfClass: OFString.class]) {
|
||||||
block(nil,
|
block(nil,
|
||||||
[OFInvalidServerReplyException exception]);
|
[OFInvalidServerResponseException
|
||||||
|
exception]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,7 +379,8 @@ validateHomeserver(OFURL *homeserver)
|
||||||
|
|
||||||
OFString *roomID = response[@"room_id"];
|
OFString *roomID = response[@"room_id"];
|
||||||
if (![roomID isKindOfClass: OFString.class]) {
|
if (![roomID isKindOfClass: OFString.class]) {
|
||||||
block(nil, [OFInvalidServerReplyException exception]);
|
block(nil,
|
||||||
|
[OFInvalidServerResponseException exception]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,9 +54,9 @@ typedef void (^MTXRequestBlock)(MTXResponse _Nullable response, int statusCode,
|
||||||
@property (readonly, nonatomic, nullable) OFString *accessToken;
|
@property (readonly, nonatomic, nullable) OFString *accessToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The URL of the homeserver to send the request to.
|
* @brief The IRI of the homeserver to send the request to.
|
||||||
*/
|
*/
|
||||||
@property (readonly, nonatomic) OFURL *homeserver;
|
@property (readonly, nonatomic) OFIRI *homeserver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The HTTP request method.
|
* @brief The HTTP request method.
|
||||||
|
@ -71,10 +71,10 @@ typedef void (^MTXRequestBlock)(MTXResponse _Nullable response, int statusCode,
|
||||||
@property (copy, nonatomic) OFString *path;
|
@property (copy, nonatomic) OFString *path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The query for the request.
|
* @brief The query items for the request.
|
||||||
*/
|
*/
|
||||||
@property (copy, nullable, nonatomic)
|
@property (copy, nullable, nonatomic)
|
||||||
OFDictionary<OFString *, OFString *> *query;
|
OFArray<OFPair<OFString *, OFString *> *> *queryItems;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An optional body to send along with the request.
|
* @brief An optional body to send along with the request.
|
||||||
|
@ -92,7 +92,7 @@ typedef void (^MTXRequestBlock)(MTXResponse _Nullable response, int statusCode,
|
||||||
*/
|
*/
|
||||||
+ (instancetype)requestWithPath: (OFString *)path
|
+ (instancetype)requestWithPath: (OFString *)path
|
||||||
accessToken: (nullable OFString *)accessToken
|
accessToken: (nullable OFString *)accessToken
|
||||||
homeserver: (OFURL *)homeserver;
|
homeserver: (OFIRI *)homeserver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initializes an already allocated request with the specified access
|
* @brief Initializes an already allocated request with the specified access
|
||||||
|
@ -104,7 +104,7 @@ typedef void (^MTXRequestBlock)(MTXResponse _Nullable response, int statusCode,
|
||||||
*/
|
*/
|
||||||
- (instancetype)initWithPath: (OFString *)path
|
- (instancetype)initWithPath: (OFString *)path
|
||||||
accessToken: (nullable OFString *)accessToken
|
accessToken: (nullable OFString *)accessToken
|
||||||
homeserver: (OFURL *)homeserver;
|
homeserver: (OFIRI *)homeserver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Performs the request and calls the specified block once the request
|
* @brief Performs the request and calls the specified block once the request
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
+ (instancetype)requestWithPath: (OFString *)path
|
+ (instancetype)requestWithPath: (OFString *)path
|
||||||
accessToken: (OFString *)accessToken
|
accessToken: (OFString *)accessToken
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
{
|
{
|
||||||
return [[[self alloc] initWithPath: path
|
return [[[self alloc] initWithPath: path
|
||||||
accessToken: accessToken
|
accessToken: accessToken
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
- (instancetype)initWithPath: (OFString *)path
|
- (instancetype)initWithPath: (OFString *)path
|
||||||
accessToken: (OFString *)accessToken
|
accessToken: (OFString *)accessToken
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
|
@ -91,11 +91,11 @@
|
||||||
|
|
||||||
if (_block != nil)
|
if (_block != nil)
|
||||||
/* Not the best exception to indicate it's already in-flight. */
|
/* Not the best exception to indicate it's already in-flight. */
|
||||||
@throw [OFAlreadyConnectedException exception];
|
@throw [OFAlreadyOpenException exceptionWithObject: self];
|
||||||
|
|
||||||
OFMutableURL *requestURL = [[_homeserver mutableCopy] autorelease];
|
OFMutableIRI *requestIRI = [[_homeserver mutableCopy] autorelease];
|
||||||
requestURL.path = _path;
|
requestIRI.path = _path;
|
||||||
requestURL.queryDictionary = _query;
|
requestIRI.queryItems = _queryItems;
|
||||||
|
|
||||||
OFMutableDictionary *headers = [OFMutableDictionary dictionary];
|
OFMutableDictionary *headers = [OFMutableDictionary dictionary];
|
||||||
headers[@"User-Agent"] = @"ObjMatrix";
|
headers[@"User-Agent"] = @"ObjMatrix";
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
if (_body != nil)
|
if (_body != nil)
|
||||||
headers[@"Content-Length"] = @(_body.count).stringValue;
|
headers[@"Content-Length"] = @(_body.count).stringValue;
|
||||||
|
|
||||||
OFHTTPRequest *request = [OFHTTPRequest requestWithURL: requestURL];
|
OFHTTPRequest *request = [OFHTTPRequest requestWithIRI: requestIRI];
|
||||||
request.method = _method;
|
request.method = _method;
|
||||||
request.headers = headers;
|
request.headers = headers;
|
||||||
|
|
||||||
|
|
|
@ -28,16 +28,16 @@ OF_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface MTXLoginFailedException: OFException
|
@interface MTXLoginFailedException: OFException
|
||||||
@property (readonly, nonatomic) OFString *user;
|
@property (readonly, nonatomic) OFString *user;
|
||||||
@property (readonly, nonatomic) OFURL *homeserver;
|
@property (readonly, nonatomic) OFIRI *homeserver;
|
||||||
@property (readonly, nonatomic) int statusCode;
|
@property (readonly, nonatomic) int statusCode;
|
||||||
@property (readonly, nonatomic) MTXResponse response;
|
@property (readonly, nonatomic) MTXResponse response;
|
||||||
|
|
||||||
+ (instancetype)exceptionWithUser: (OFString *)user
|
+ (instancetype)exceptionWithUser: (OFString *)user
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
statusCode: (int)statusCode
|
statusCode: (int)statusCode
|
||||||
response: (MTXResponse)response;
|
response: (MTXResponse)response;
|
||||||
- (instancetype)initWithUser: (OFString *)user
|
- (instancetype)initWithUser: (OFString *)user
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
statusCode: (int)statusCode
|
statusCode: (int)statusCode
|
||||||
response: (MTXResponse)response;
|
response: (MTXResponse)response;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
@implementation MTXLoginFailedException
|
@implementation MTXLoginFailedException
|
||||||
+ (instancetype)exceptionWithUser: (OFString *)user
|
+ (instancetype)exceptionWithUser: (OFString *)user
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
statusCode: (int)statusCode
|
statusCode: (int)statusCode
|
||||||
response: (MTXResponse)response
|
response: (MTXResponse)response
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithUser: (OFString *)user
|
- (instancetype)initWithUser: (OFString *)user
|
||||||
homeserver: (OFURL *)homeserver
|
homeserver: (OFIRI *)homeserver
|
||||||
statusCode: (int)statusCode
|
statusCode: (int)statusCode
|
||||||
response: (MTXResponse)response
|
response: (MTXResponse)response
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ OF_APPLICATION_DELEGATE(Tests)
|
||||||
OFString *_roomID;
|
OFString *_roomID;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching
|
- (void)applicationDidFinishLaunching: (OFNotification *)notification
|
||||||
{
|
{
|
||||||
__auto_type environment = OFApplication.environment;
|
__auto_type environment = OFApplication.environment;
|
||||||
if (environment[@"OBJMATRIX_USER"] == nil ||
|
if (environment[@"OBJMATRIX_USER"] == nil ||
|
||||||
|
@ -47,7 +47,7 @@ OF_APPLICATION_DELEGATE(Tests)
|
||||||
[OFApplication terminateWithStatus: 1];
|
[OFApplication terminateWithStatus: 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
OFURL *homeserver = [OFURL URLWithString: environment[@"OBJMATRIX_HS"]];
|
OFIRI *homeserver = [OFIRI IRIWithString: environment[@"OBJMATRIX_HS"]];
|
||||||
id <MTXStorage> storage =
|
id <MTXStorage> storage =
|
||||||
[MTXSQLite3Storage storageWithPath: @"tests.db"];
|
[MTXSQLite3Storage storageWithPath: @"tests.db"];
|
||||||
[MTXClient logInWithUser: environment[@"OBJMATRIX_USER"]
|
[MTXClient logInWithUser: environment[@"OBJMATRIX_USER"]
|
Loading…
Add table
Add a link
Reference in a new issue