@@ -65,254 +65,6 @@ @interface MonalAppDelegate()
65
65
66
66
@implementation MonalAppDelegate
67
67
68
- // **************************** xml parser and query language tests ****************************
69
- -(void ) runParserTests
70
- {
71
- NSString * xml = @" <?xml version='1.0'?>\n \
72
- <stream:stream xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xmlns='jabber:client' xml:lang='en' from='example.org' id='a344b8bb-518e-4456-9140-d15f66c1d2db'>\n \
73
- <stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>SCRAM-SHA-1</mechanism><mechanism>PLAIN</mechanism></mechanisms></stream:features>\n \
74
- <message from='[email protected] ' id='some_id' xmlns='jabber:client'>\n \
75
- <body>Message text</body>\n \
76
- <body xmlns='urn:some:different:namespace'>This will NOT be used</body>\n \
77
- </message>\n \
78
- <iq id='18382ACA-EF9D-4BC9-8779-7901C63B6631' to='[email protected] /Monal-iOS.ef313600' xmlns='jabber:client' type='result' from='[email protected] '><query xmlns='http://jabber.org/protocol/disco#info'><feature var='http://jabber.org/protocol/muc#request'/><feature var='muc_hidden'/><feature var='muc_unsecured'/><feature var='muc_membersonly'/><feature var='muc_unmoderated'/><feature var='muc_persistent'/><identity type='text' name='testchat gruppe' category='conference'/><feature var='urn:xmpp:mam:2'/><feature var='urn:xmpp:sid:0'/><feature var='muc_nonanonymous'/><feature var='http://jabber.org/protocol/muc'/><feature var='http://jabber.org/protocol/muc#stable_id'/><feature var='http://jabber.org/protocol/muc#self-ping-optimization'/><feature var='jabber:iq:register'/><feature var='vcard-temp'/><x type='result' xmlns='jabber:x:data'><field type='hidden' var='FORM_TYPE'><value>http://jabber.org/protocol/muc#roominfo</value></field><field label='Description' var='muc#roominfo_description' type='text-single'><value/></field><field label='Number of occupants' var='muc#roominfo_occupants' type='text-single'><value>2</value></field><field label='Allow members to invite new members' var='{http://prosody.im/protocol/muc}roomconfig_allowmemberinvites' type='boolean'><value>0</value></field><field label='Allow users to invite other users' var='muc#roomconfig_allowinvites' type='boolean'><value>0</value></field><field label='Title' var='muc#roomconfig_roomname' type='text-single'><value>testchat gruppe</value></field><field type='boolean' var='muc#roomconfig_changesubject'/><field type='text-single' var='{http://modules.prosody.im/mod_vcard_muc}avatar#sha1'/><field type='text-single' var='muc#roominfo_lang'><value/></field></x></query></iq>\n\
79
- <iq id='605818D4-4D16-4ACC-B003-BFA3E11849E1' to='[email protected] /Monal-iOS.15e153a8' xmlns='jabber:client' type='result' from='[email protected] '><pubsub xmlns='http://jabber.org/protocol/pubsub'><subscription node='eu.siacs.conversations.axolotl.devicelist' subid='6795F13596465' subscription='subscribed' jid='[email protected] '/></pubsub></iq>\n \
80
- <iq from='[email protected] /230193' id='disco1' to='[email protected] /chamber' type='result'>\n \
81
- <query xmlns='http://jabber.org/protocol/disco#info' node='http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w='>\n \
82
- <identity xml:lang='en' category='client' name='Psi 0.11' type='pc'/>\n \
83
- <identity xml:lang='el' category='client' name='Ψ 0.11' type='pc'/>\n \
84
- <feature var='http://jabber.org/protocol/caps'/>\n \
85
- <feature var='http://jabber.org/protocol/disco#info'/>\n \
86
- <feature var='http://jabber.org/protocol/disco#items'/>\n \
87
- <feature var='http://jabber.org/protocol/muc'/>\n \
88
- <x xmlns='jabber:x:data' type='result'>\n \
89
- <field var='FORM_TYPE' type='hidden'>\n \
90
- <value>urn:xmpp:dataforms:softwareinfo</value>\n \
91
- </field>\n \
92
- <field var='ip_version'>\n \
93
- <value>ipv4</value>\n \
94
- <value>ipv6</value>\n \
95
- </field>\n \
96
- <field var='os'>\n \
97
- <value>Mac</value>\n \
98
- </field>\n \
99
- <field var='os_version'>\n \
100
- <value>10.5.1</value>\n \
101
- </field>\n \
102
- <field var='software'>\n \
103
- <value>Psi</value>\n \
104
- </field>\n \
105
- <field var='software_version'>\n \
106
- <value>0.11</value>\n \
107
- </field>\n \
108
- </x>\n \
109
- </query>\n \
110
- </iq>\n \
111
- </stream:stream>" ;
112
- DDLogInfo (@" creating parser delegate for xml: %@ " , xml);
113
- // yes, but this is not insecure because these are string literals boxed into an NSArray below rather than containing unchecked user input
114
- // see here: https://releases.llvm.org/13.0.0/tools/clang/docs/DiagnosticsReference.html#wformat-security
115
- #pragma clang diagnostic push
116
- #pragma clang diagnostic ignored "-Wformat-security"
117
- MLBasePaser* delegate = [[MLBasePaser alloc ] initWithCompletion: ^(MLXMLNode* _Nullable parsedStanza) {
118
- if (parsedStanza != nil )
119
- {
120
- DDLogInfo (@" Got new parsed stanza: %@ " , parsedStanza);
121
- for (NSString * query in @[
122
- @" {http://jabber.org/protocol/disco#info}query/\\ {http://jabber.org/protocol/muc#roominfo}result@muc#roomconfig_roomname\\ " ,
123
- @" /{jabber:client}iq/{http://jabber.org/protocol/pubsub}pubsub/items<node~eu\\ .siacs\\ .conversations\\ .axolotl\\ .bundles:[0-9]+>@node" ,
124
- @" body#" ,
125
- ])
126
- {
127
- id result = [parsedStanza find: query];
128
- DDLogDebug (@" Query: '%@ ', result: '%@ '" , query, result);
129
- }
130
- NSString * specialQuery1 = @" /<type=%@ >/{http://jabber.org/protocol/pubsub}pubsub/subscription<node=%@ ><subscription=%s ><jid=%@ >" ;
131
- id result = [parsedStanza
find: specialQuery1,
@" result" ,
@" eu.siacs.conversations.axolotl.devicelist" ,
" subscribed" ,
@" [email protected] " ];
132
- DDLogDebug (@" Query: '%@ ', result: '%@ '" , specialQuery1, result);
133
-
134
- // handle gajim disco hash testcase
135
- if ([parsedStanza check: @" /<id=disco1>" ])
136
- {
137
- // the the original implementation in MLIQProcessor $$class_handler(handleEntityCapsDisco)
138
- NSMutableArray * identities = [NSMutableArray new ];
139
- for (MLXMLNode* identity in [parsedStanza find: @" {http://jabber.org/protocol/disco#info}query/identity" ])
140
- [identities addObject: [NSString stringWithFormat: @" %@ /%@ /%@ /%@ " , [identity findFirst: @" /@category" ], [identity findFirst: @" /@type" ], ([identity check: @" /@xml:lang" ] ? [identity findFirst: @" /@xml:lang" ] : @" " ), ([identity check: @" /@name" ] ? [identity findFirst: @" /@name" ] : @" " )]];
141
- NSSet * features = [NSSet setWithArray: [parsedStanza find: @" {http://jabber.org/protocol/disco#info}query/feature@var" ]];
142
- NSArray * forms = [parsedStanza find: @" {http://jabber.org/protocol/disco#info}query/{jabber:x:data}x" ];
143
- NSString * ver = [HelperTools getEntityCapsHashForIdentities: identities andFeatures: features andForms: forms];
144
- DDLogDebug (@" Caps hash calculated: %@ " , ver);
145
- MLAssert ([@" q07IKJEyjvHSyhy//CH0CxmKi8w=" isEqualToString: ver], @" Caps hash NOT equal to testcase hash 'q07IKJEyjvHSyhy//CH0CxmKi8w='!" );
146
- }
147
- }
148
- }];
149
- #pragma clang diagnostic pop
150
-
151
- // create xml parser, configure our delegate and feed it with data
152
- NSXMLParser * xmlParser = [[NSXMLParser alloc ] initWithData: [xml dataUsingEncoding: NSUTF8StringEncoding]];
153
- [xmlParser setShouldProcessNamespaces: YES ];
154
- [xmlParser setShouldReportNamespacePrefixes: YES ]; // for debugging only
155
- [xmlParser setShouldResolveExternalEntities: NO ];
156
- [xmlParser setDelegate: delegate];
157
- DDLogInfo (@" calling parse" );
158
- [xmlParser parse ]; // blocking operation
159
- DDLogInfo (@" parse ended" );
160
- [DDLog flushLog ];
161
- // make sure apple's code analyzer will not reject the app for the appstore because of our call to exit()
162
- #ifdef IS_ALPHA
163
- exit (0 );
164
- #endif
165
- }
166
-
167
- -(void ) runSDPTests
168
- {
169
- DDLogVerbose (@" SDP2XML: %@ " , [HelperTools sdp2xml: @" v=0\n \
170
- o=- 2005859539484728435 2 IN IP4 127.0.0.1\n \
171
- s=-\n \
172
- t=0 0\n \
173
- a=group:BUNDLE 0 1 2\n \
174
- a=extmap-allow-mixed\n \
175
- a=msid-semantic: WMS stream\n \
176
- m=audio 9 UDP/TLS/RTP/SAVPF 111 63 9 102 0 8 13 110 126\n \
177
- c=IN IP4 0.0.0.0\n \
178
- a=candidate:1076231993 2 udp 41885694 198.51.100.52 50002 typ relay raddr 0.0.0.0 rport 0 generation 0 ufrag V4as network-id 2 network-cost 10\n \
179
- a=rtcp:9 IN IP4 0.0.0.0\n \
180
- a=ice-ufrag:Pt2c\n \
181
- a=ice-pwd:XKe021opw+vupIkkLCI1+kP4\n \
182
- a=ice-options:trickle renomination\n \
183
- a=fingerprint:sha-256 1F:CE:47:40:5F:F2:FC:66:F2:21:F7:7D:3D:D6:0D:B0:67:6F:BD:CF:8B:0E:B7:90:5D:8C:33:9E:AD:F2:CB:FC\n \
184
- a=setup:actpass\n \
185
- a=mid:0\n \
186
- a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\n \
187
- a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\n \
188
- a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\n \
189
- a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\n \
190
- a=sendrecv\n \
191
- a=msid:stream audio0\n \
192
- a=rtcp-mux\n \
193
- a=rtpmap:111 opus/48000/2\n \
194
- a=rtcp-fb:111 transport-cc\n \
195
- a=fmtp:111 minptime=10;useinbandfec=1\n \
196
- a=rtpmap:63 red/48000/2\n \
197
- a=fmtp:63 111/111\n \
198
- a=rtpmap:9 G722/8000\n \
199
- a=rtpmap:102 ILBC/8000\n \
200
- a=rtpmap:0 PCMU/8000\n \
201
- a=rtpmap:8 PCMA/8000\n \
202
- a=rtpmap:13 CN/8000\n \
203
- a=rtpmap:110 telephone-event/48000\n \
204
- a=rtpmap:126 telephone-event/8000\n \
205
- a=ssrc:109112503 cname:vUpPwDICjVuwEwGO\n \
206
- a=ssrc:109112503 msid:stream audio0\n \
207
- m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127 103 35 36 104 105 106\n \
208
- c=IN IP4 0.0.0.0\n \
209
- a=rtcp:9 IN IP4 0.0.0.0\n \
210
- a=ice-ufrag:Pt2c\n \
211
- a=ice-pwd:XKe021opw+vupIkkLCI1+kP4\n \
212
- a=ice-options:trickle renomination\n \
213
- a=fingerprint:sha-256 1F:CE:47:40:5F:F2:FC:66:F2:21:F7:7D:3D:D6:0D:B0:67:6F:BD:CF:8B:0E:B7:90:5D:8C:33:9E:AD:F2:CB:FC\n \
214
- a=setup:actpass\n \
215
- a=mid:1\n \
216
- a=extmap:14 urn:ietf:params:rtp-hdrext:toffset\n \
217
- a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\n \
218
- a=extmap:13 urn:3gpp:video-orientation\n \
219
- a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\n \
220
- a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\n \
221
- a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\n \
222
- a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\n \
223
- a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space\n \
224
- a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\n \
225
- a=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\n \
226
- a=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\n \
227
- a=sendrecv\n \
228
- a=msid:stream video0\n \
229
- a=rtcp-mux\n \
230
- a=rtcp-rsize\n \
231
- a=rtpmap:96 H264/90000\n \
232
- a=rtcp-fb:96 goog-remb\n \
233
- a=rtcp-fb:96 transport-cc\n \
234
- a=rtcp-fb:96 ccm fir\n \
235
- a=rtcp-fb:96 nack\n \
236
- a=rtcp-fb:96 nack pli\n \
237
- a=fmtp:96 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c34\n \
238
- a=rtpmap:97 rtx/90000\n \
239
- a=fmtp:97 apt=96\n \
240
- a=rtpmap:98 H264/90000\n \
241
- a=rtcp-fb:98 goog-remb\n \
242
- a=rtcp-fb:98 transport-cc\n \
243
- a=rtcp-fb:98 ccm fir\n \
244
- a=rtcp-fb:98 nack\n \
245
- a=rtcp-fb:98 nack pli\n \
246
- a=fmtp:98 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e034\n \
247
- a=rtpmap:99 rtx/90000\n \
248
- a=fmtp:99 apt=98\n \
249
- a=rtpmap:100 VP8/90000\n \
250
- a=rtcp-fb:100 goog-remb\n \
251
- a=rtcp-fb:100 transport-cc\n \
252
- a=rtcp-fb:100 ccm fir\n \
253
- a=rtcp-fb:100 nack\n \
254
- a=rtcp-fb:100 nack pli\n \
255
- a=rtpmap:101 rtx/90000\n \
256
- a=fmtp:101 apt=100\n \
257
- a=rtpmap:127 VP9/90000\n \
258
- a=rtcp-fb:127 goog-remb\n \
259
- a=rtcp-fb:127 transport-cc\n \
260
- a=rtcp-fb:127 ccm fir\n \
261
- a=rtcp-fb:127 nack\n \
262
- a=rtcp-fb:127 nack pli\n \
263
- a=rtpmap:103 rtx/90000\n \
264
- a=fmtp:103 apt=127\n \
265
- a=rtpmap:35 AV1/90000\n \
266
- a=rtcp-fb:35 goog-remb\n \
267
- a=rtcp-fb:35 transport-cc\n \
268
- a=rtcp-fb:35 ccm fir\n \
269
- a=rtcp-fb:35 nack\n \
270
- a=rtcp-fb:35 nack pli\n \
271
- a=rtpmap:36 rtx/90000\n \
272
- a=fmtp:36 apt=35\n \
273
- a=rtpmap:104 red/90000\n \
274
- a=rtpmap:105 rtx/90000\n \
275
- a=fmtp:105 apt=104\n \
276
- a=rtpmap:106 ulpfec/90000\n \
277
- a=ssrc-group:FID 3733210709 4025710505\n \
278
- a=ssrc:3733210709 cname:vUpPwDICjVuwEwGO\n \
279
- a=ssrc:3733210709 msid:stream video0\n \
280
- a=ssrc:4025710505 cname:vUpPwDICjVuwEwGO\n \
281
- a=ssrc:4025710505 msid:stream video0\n \
282
- m=application 9 UDP/DTLS/SCTP webrtc-datachannel\n \
283
- c=IN IP4 0.0.0.0\n \
284
- a=ice-ufrag:Pt2c\n \
285
- a=ice-pwd:XKe021opw+vupIkkLCI1+kP4\n \
286
- a=ice-options:trickle renomination\n \
287
- a=fingerprint:sha-256 1F:CE:47:40:5F:F2:FC:66:F2:21:F7:7D:3D:D6:0D:B0:67:6F:BD:CF:8B:0E:B7:90:5D:8C:33:9E:AD:F2:CB:FC\n \
288
- a=setup:actpass\n \
289
- a=mid:2\n \
290
- a=sctp-port:5000\n \
291
- a=max-message-size:262144\n " withInitiator: YES ]);
292
- }
293
-
294
- $$class_handler(handlerTest01, $$ID(NSObject *, dummyObj))
295
- DDLogError (@" HandlerTest01 completed" );
296
- $$
297
-
298
- $$class_handler(handlerTest02, $$ID(monal_void_block_t , dummyCallback))
299
- DDLogError (@" HandlerTest02 completed" );
300
- $$
301
-
302
- -(void ) runHandlerTests
303
- {
304
- DDLogError (@" NSClassFromString: '%@ '" , NSClassFromString (@" monal_void_block_t" ));
305
-
306
- if ([^{} isKindOfClass:[NSObject class ]])
307
- DDLogError (@" isKindOfClass" );
308
-
309
- MLHandler* handler01 = $newHandler ([self class ], handlerTest01);
310
- $call (handler01, $ID (dummyObj, [NSString new ]));
311
-
312
- MLHandler* handler02 = $newHandler ([self class ], handlerTest02);
313
- $call (handler02, $ID (dummyCallback, ^{}));
314
- }
315
-
316
68
-(id ) init
317
69
{
318
70
// someone (suspect: AppKit) resets our exception handler between the call to [MonalAppDelegate initialize] and [MonalAppDelegate init]
@@ -330,10 +82,6 @@ -(id) init
330
82
DDLogInfo (@" calling MonalAppDelegate configureBackgroundTasks" );
331
83
[self configureBackgroundTasks ];
332
84
333
- // [self runParserTests];
334
- // [self runSDPTests];
335
- // [HelperTools flushLogsWithTimeout:0.250];
336
- // [self runHandlerTests];
337
85
return self;
338
86
}
339
87
0 commit comments