ObjMatrix  Diff

Differences From Artifact [247888a299]:

To Artifact [9eabf30e59]:


28
29
30
31
32
33
34

35
36
37
38
39
40
41
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42







+







@end

OF_APPLICATION_DELEGATE(Tests)

@implementation Tests
{
	MTXClient *_client;
	OFString *_roomID;
}

- (void)applicationDidFinishLaunching
{
	__auto_type environment = OFApplication.environment;
	if (environment[@"OBJMATRIX_USER"] == nil ||
	    environment[@"OBJMATRIX_PASS"] == nil ||
102
103
104
105
106
107
108

109

110















111

112
113
114
115

116
117
118

119
120
121
122

123
124
125
126

127
128

129
130
131
132

133
134

135
136
137
138
139
140
141

142
143
144
145
146
147
148
103
104
105
106
107
108
109
110

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127

128
129
130
131

132
133
134

135
136
137
138

139
140
141
142

143
144

145
146
147
148

149
150

151
152
153
154
155
156
157

158
159
160
161
162
163
164
165







+
-
+

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+



-
+


-
+



-
+



-
+

-
+



-
+

-
+






-
+







	[_client joinRoom: room
		    block: ^ (OFString *roomID, id exception) {
		if (exception != nil) {
			of_log(@"Failed to join room %@: %@", room, exception);
			[OFApplication terminateWithStatus: 1];
		}

		_roomID = [roomID copy];
		of_log(@"Joined room %@", roomID);
		of_log(@"Joined room %@", _roomID);

		[self sync2];
	}];
}

- (void)sync2
{
	[_client syncWithTimeout: 5
			   block: ^ (id exception) {
		if (exception != nil) {
			of_log(@"Failed to sync: %@", exception);
			[OFApplication terminateWithStatus: 1];
		}

		of_log(@"Synced");

		[self sendMessage: roomID];
		[self sendMessage];
	}];
}

- (void)sendMessage: (OFString *)roomID
- (void)sendMessage
{
	[_client sendMessage: @"ObjMatrix test successful!"
		      roomID: roomID
		      roomID: _roomID
		       block: ^ (id exception) {
		if (exception != nil) {
			of_log(@"Failed to send message to room %@: %@",
			    roomID, exception);
			    _roomID, exception);
			[OFApplication terminateWithStatus: 1];
		}

		of_log(@"Message sent to %@", roomID);
		of_log(@"Message sent to %@", _roomID);

		[self leaveRoom: roomID];
		[self leaveRoom];
	}];
}

- (void)leaveRoom: (OFString *)roomID
- (void)leaveRoom
{
	[_client leaveRoom: roomID
	[_client leaveRoom: _roomID
		     block: ^ (id exception) {
		if (exception != nil) {
			of_log(@"Failed to leave room %@: %@", exception);
			[OFApplication terminateWithStatus: 1];
		}

		of_log(@"Left room %@", roomID);
		of_log(@"Left room %@", _roomID);

		[self logOut];
	}];
}

- (void)logOut
{