-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTNStropheConnection.j
662 lines (543 loc) · 24.5 KB
/
TNStropheConnection.j
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
/*
* TNStropheConnection.j
*
* Copyright (C) 2010 Antoine Mercadal <antoine.mercadal@inframonde.eu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import <Foundation/Foundation.j>
@import "Resources/Strophe/strophe.js"
@import "TNStropheJID.j"
@import "TNStropheStanza.j"
TNStropheConnectionStatusAuthenticatingNotification = @"TNStropheConnectionStatusAuthenticatingNotification"
TNStropheConnectionStatusAuthFailureNotification = @"TNStropheConnectionStatusAuthFailureNotification";
TNStropheConnectionStatusConnectedNotification = @"TNStropheConnectionStatusConnectedNotification";
TNStropheConnectionStatusConnectingNotification = @"TNStropheConnectionStatusConnectingNotification";
TNStropheConnectionStatusConnectionFailureNotification = @"TNStropheConnectionStatusConnectionFailureNotification";
TNStropheConnectionStatusDisconnectedNotification = @"TNStropheConnectionStatusDisconnectedNotification";
TNStropheConnectionStatusDisconnectingNotification = @"TNStropheConnectionStatusDisconnectingNotification";
TNStropheConnectionStatusErrorNotification = @"TNStropheConnectionStatusErrorNotification";
TNStropheConnectionStatusWillDisconnectNotification = @"TNStropheConnectionStatusWillDisconnectNotification";
var TNStropheTimerRunLoopMode = @"TNStropheTimerRunLoopMode";
/*! @ingroup strophecappuccino
this is an Cappuccino implementation of an XMPP connection
using javascript library Strophe by Stanziq.
@par Delegate Methods
\c -onStropheConnecting:
when strophe is connecting (notification TNStropheConnectionStatusConnectingNotification sent)
\c -onStropheConnectFail:
if strophe connection fails (notification TNStropheConnectionStatusFailure sent)
\c -onStropheDisconnecting
when strophe is disconnecting (notification TNStropheConnectionStatusDisconnectingNotification sent)
\c -onStropheConnected:
when strophe is disconnected (notification TNStropheConnectionStatusDisconnectedNotification sent)
\c -onStropheConnecting:
when strophe is connected (notification TNStropheConnectionStatusConnectedNotification sent)
@par Notifications:
The following notifications are sent by TNStropheConnection:
#TNStropheConnectionStatusConnectingNotification
#TNStropheConnectionStatusConnectedNotification
#TNStropheConnectionStatusDisconnectingNotification
#TNStropheConnectionStatusDisconnectedNotification
#TNStropheConnectionStatusConnectionFailureNotification
# TNStropheConnectionStatusAuthFailureNotification
#TNStropheConnectionStatusErrorNotification
*/
@implementation TNStropheConnection : CPObject
{
BOOL _connected @accessors(getter=isConnected);
CPString _password @accessors(property=password);
float _giveupTimeout @accessors(property=giveupTimeout);
id _currentStatus @accessors(getter=currentStatus);
id _delegate @accessors(getter=delegate);
int _connectionTimeout @accessors(property=connectionTimeout);
int _maxConnections @accessors(property=maxConnections);
CPArray _registeredHandlers;
CPArray _registeredTimedHandlers;
CPDictionary _timersIds;
CPString _boshService;
CPString _userPresenceShow;
CPString _userPresenceStatus;
CPTimer _giveUpTimer;
float _stropheJSRunloopInterval;
id _connection;
TNStropheJID _JID;
}
#pragma mark -
#pragma mark Class methods
+ (void)addNamespaceWithName:(CPString)aName value:(CPString)aValue
{
Strophe.addNamespace(aName, aValue);
}
/*! instanciate a TNStropheConnection object
@param aService a url of a bosh service (MUST be complete url with http://)
@return a valid TNStropheConnection
*/
+ (TNStropheConnection)connectionWithService:(CPString)aService andDelegate:(id)aDelegate
{
return [[TNStropheConnection alloc] initWithService:aService andDelegate:aDelegate];
}
#pragma mark -
#pragma mark Initialization
/*! initialize the TNStropheConnection
@param aService a url of a bosh service (MUST be complete url with http://)
*/
- (id)initWithService:(CPString)aService andDelegate:(id)aDelegate
{
if (self = [super init])
{
var bundle = [CPBundle bundleForClass:[self class]];
_registeredHandlers = [CPArray array];
_registeredTimedHandlers = [CPArray array];
_connected = NO;
_maxConnections = [bundle objectForInfoDictionaryKey:@"TNStropheConnectionMaxConnection"];
_connectionTimeout = [bundle objectForInfoDictionaryKey:@"TNStropheConnectionTimeout"];
_giveupTimeout = [bundle objectForInfoDictionaryKey:@"TNStropheConnectionGiveUpTimer"];
_currentStatus = Strophe.Status.DISCONNECTED;
_boshService = aService;
_connection = new Strophe.Connection(_boshService);
_delegate = aDelegate;
_timersIds = [CPDictionary dictionary];
_stropheJSRunloopInterval = [bundle objectForInfoDictionaryKey:@"TNStropheJSRunLoopInterval"];
if ([bundle objectForInfoDictionaryKey:@"TNStropheJSUseCappuccinoRunLoop"] == 1)
{
CPLog.info("StropheCappuccino has been compiled to use the Cappuccino runloop. unsing interval of " + _stropheJSRunloopInterval);
Strophe.setTimeout = function(f, delay)
{
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
var timerID = [self getUniqueId],
timer = [CPTimer timerWithTimeInterval:_stropheJSRunloopInterval target:self selector:@selector(triggerStropheTimer:) userInfo:{"function": f, "id": timerID} repeats:NO];
[[CPRunLoop currentRunLoop] addTimer:timer forMode:CPDefaultRunLoopMode];
[_timersIds setObject:timer forKey:timerID];
return timerID;
}
Strophe.clearTimeout = function(tid)
{
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
var timer = [_timersIds objectForKey:tid];
[timer invalidate];
[_timersIds removeObjectForKey:tid];
}
}
}
return self;
}
#pragma mark -
#pragma mark Cappuccino's stropheJS runloop
/*! computer the stropheJS timers
@param aTimer the timer that have sent the event
*/
- (void)triggerStropheTimer:(CPTimer)aTimer
{
[_timersIds removeObjectForKey:[aTimer userInfo]["id"]];
[aTimer userInfo]["function"]();
[aTimer invalidate];
}
#pragma mark -
#pragma mark Connection
- (TNStropheJID)JID
{
if ([_delegate respondsToSelector:@selector(JID)])
return [_delegate JID];
else
return _JID;
}
/*! connect to the XMPP Bosh Service. on different events, messages are sent to delegate and notification are sent
*/
- (void)connectWithJID:(TNStropheJID)aJID andPassword:(CPString)aPassword
{
if (_currentStatus !== Strophe.Status.DISCONNECTED)
return;
_JID = aJID;
_connection.connect([aJID full], aPassword, function (status, errorCond)
{
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
var selector,
notificationName;
_currentStatus = status;
if (errorCond)
{
_currentStatus = Strophe.Status.DISCONNECTED;
if ([_delegate respondsToSelector:@selector(connection:errorCondition:)])
[_delegate connection:self errorCondition:errorCond];
}
else
{
switch (status)
{
case Strophe.Status.ERROR:
selector = @selector(onStropheError:);
notificationName = TNStropheConnectionStatusErrorNotification;
break;
case Strophe.Status.CONNECTING:
selector = @selector(onStropheConnecting:);
notificationName = TNStropheConnectionStatusConnectingNotification;
_giveUpTimer = [CPTimer scheduledTimerWithTimeInterval:_giveupTimeout callback:function(aTimer) {
_currentStatus = Strophe.Status.DISCONNECTED;
_giveUpTimer = nil;
[self reset]
if ((_currentStatus === Strophe.Status.CONNECTING) && ([_delegate respondsToSelector:@selector(connection:errorCondition:)]))
[_delegate connection:self errorCondition:@"Cannot connect"];
} repeats:NO];
break;
case Strophe.Status.CONNFAIL:
selector = @selector(onStropheConnectFail:);
notificationName = TNStropheConnectionStatusConnectionFailureNotification;
_connected = NO;
break;
case Strophe.Status.AUTHENTICATING:
selector = @selector(onStropheAuthenticating:);
notificationName = TNStropheConnectionStatusAuthenticatingNotification;
_connected = NO;
break;
case Strophe.Status.AUTHFAIL:
selector = @selector(onStropheAuthFail:);
notificationName = TNStropheConnectionStatusAuthFailureNotification;
_connected = NO;
break;
case Strophe.Status.DISCONNECTING:
selector = @selector(onStropheDisconnecting:);
notificationName = TNStropheConnectionStatusDisconnectingNotification;
_connected = YES;
break;
case Strophe.Status.DISCONNECTED:
[self deleteAllRegisteredSelectors];
selector = @selector(onStropheDisconnected:);
notificationName = TNStropheConnectionStatusDisconnectedNotification;
_connected = NO;
break;
case Strophe.Status.CONNECTED:
selector = @selector(onStropheConnected:);
notificationName = TNStropheConnectionStatusConnectedNotification;
_connected = YES;
if (_giveUpTimer)
[_giveUpTimer invalidate];
break;
}
}
if (selector && [_delegate respondsToSelector:selector])
[_delegate performSelector:selector withObject:self];
if (notificationName)
[[CPNotificationCenter defaultCenter] postNotificationName:notificationName object:self];
}, /* wait */ _connectionTimeout, /* hold */ _maxConnections);
}
/*! this disconnect the XMPP connection
*/
- (void)disconnect
{
if (_currentStatus === Strophe.Status.DISCONNECTED)
return;
[[CPNotificationCenter defaultCenter] postNotificationName:TNStropheConnectionStatusWillDisconnectNotification object:self];
_connection.disconnect();
}
/*! Reset the current connection
*/
- (void)reset
{
if (_connection)
_connection.reset();
}
/*! pause the current connection
*/
- (void)pause
{
if (_connection)
_connection.pause();
}
/*! resume the current connection if paused
*/
- (void)resume
{
if (_connection)
_connection.pause();
}
/*! Immediately send any pending outgoing data
*/
- (void)flush
{
_connection.flush();
}
- (TNStropheJID)JID
{
return [_delegate JID];
}
#pragma mark -
#pragma mark Sending
/*! send a TNStropheStanza object
@param aStanza: the stanza to send
*/
- (void)send:(TNStropheStanza)aStanza
{
if (_currentStatus == Strophe.Status.CONNECTED)
{
CPLog.trace("StropheCappuccino Stanza Send:")
CPLog.trace(aStanza);
[[CPRunLoop currentRunLoop] performSelector:@selector(performSend:) target:self argument:aStanza order:0 modes:[CPDefaultRunLoopMode]];
}
}
- (void)performSend:(TNStropheStanza)aStanza
{
_connection.send([aStanza tree]);
}
/*! generates an unique identifier
*/
- (CPString)getUniqueId
{
return [self getUniqueIdWithSuffix:null];
}
/*! generates an unique identifier prefixed by
@param prefix will prefixes the unique identifier
*/
- (CPString)getUniqueIdWithSuffix:(CPString)suffix
{
return _connection.getUniqueId(suffix);
}
#pragma mark -
#pragma mark Handlers
/*! allows to register a selector for beeing fired on XMPP events, according to the content of a dictionnary parameter.
The dictionnary should contains zero to many of the followings :
- <b>namespace</b>: the namespace of the stanza or of the first child (like query)
- <b>name</b>: the name of the stanza (message, iq or presence)
- <b>type</b>: the type of the stanza
- <b>id</b>: the unique identifier
- <b>from</b>: the stanza sender
- <b>options</b>: an array of options. only {MatchBare: True} works.
if all the conditions are mets, the selector is fired and the stanza is given as parameter.
The selector should return YES to not be unregistered. If it returns NO or nothing, it will be
unregistered
@param aSelector the selector to be performed
@param anObject the receiver of the selector
@param aDict a dictionnary of parameters
@param someUserInfo user infos
@param handlerDelegate a temp delegate that can implement stropheConnection:performedHandlerId:
@return an id of the handler registration used to remove it
*/
- (id)registerSelector:(SEL)aSelector ofObject:(CPObject)anObject withDict:(id)aDict userInfo:(id)someUserInfo handlerDelegate:(id)aHandlerDelegate
{
var from = ([[aDict valueForKey:@"from"] isKindOfClass:CPString]) ? [aDict valueForKey:@"from"] : [[aDict valueForKey:@"from"] stringValue],
handlerId = _connection.addHandler(function(stanza)
{
// seems to be a good practice to pump the runloop in async function
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
var stanzaObject = [TNStropheStanza stanzaWithStanza:stanza],
ret;
if (someUserInfo)
ret = [anObject performSelector:aSelector withObject:stanzaObject withObject:someUserInfo];
else
ret = [anObject performSelector:aSelector withObject:stanzaObject];
CPLog.trace("StropheCappuccino stanza received that trigger selector : " + [anObject class] + "." + aSelector);
CPLog.trace(stanzaObject);
// experimental thing
delete aDict.options;
delete someUserInfo;
if (aHandlerDelegate && [aHandlerDelegate respondsToSelector:@selector(stropheConnection:performedHandlerId:)])
[aHandlerDelegate stropheConnection:self performedHandlerId:handlerId]
someUserInfo = nil;
[_registeredHandlers removeObject:handlerId];
return ret;
},
[aDict valueForKey:@"namespace"],
[aDict valueForKey:@"name"],
[aDict valueForKey:@"type"],
[aDict valueForKey:@"id"],
from,
[aDict valueForKey:@"options"]);
[_registeredHandlers addObject:handlerId];
return handlerId;
}
/*! allows to register a selector for beeing fired on XMPP events, according to the content of a dictionnary parameter.
The dictionnary should contains zero to many of the followings :
- <b>namespace</b>: the namespace of the stanza or of the first child (like query)
- <b>name</b>: the name of the stanza (message, iq or presence)
- <b>type</b>: the type of the stanza
- <b>id</b>: the unique identifier
- <b>from</b>: the stanza sender
- <b>options</b>: an array of options. only {MatchBare: True} works.
if all the conditions are mets, the selector is fired and the stanza is given as parameter.
The selector should return YES to not be unregistered. If it returns NO or nothing, it will be
unregistered
@param aSelector the selector to be performed
@param anObject the receiver of the selector
@param aDict a dictionnary of parameters
@param handlerDelegate a temp delegate that can implement stropheConnection:performedHandlerId:
@return an id of the handler registration used to remove it
*/
- (id)registerSelector:(SEL)aSelector ofObject:(CPObject)anObject withDict:(id)aDict handlerDelegate:(id)aHandlerDelegate
{
return [self registerSelector:aSelector ofObject:anObject withDict:aDict userInfo:nil handlerDelegate:aHandlerDelegate];
}
/*! allows to register a selector for beeing fired on XMPP events, according to the content of a dictionnary parameter.
The dictionnary should contains zero to many of the followings :
- <b>namespace</b>: the namespace of the stanza or of the first child (like query)
- <b>name</b>: the name of the stanza (message, iq or presence)
- <b>type</b>: the type of the stanza
- <b>id</b>: the unique identifier
- <b>from</b>: the stanza sender
- <b>options</b>: an array of options. only {MatchBare: True} works.
if all the conditions are mets, the selector is fired and the stanza is given as parameter.
The selector should return YES to not be unregistered. If it returns NO or nothing, it will be
unregistered
@param aSelector the selector to be performed
@param anObject the receiver of the selector
@param aDict a dictionnary of parameters
@param someUserInfo user infos
@return an id of the handler registration used to remove it
*/
- (id)registerSelector:(SEL)aSelector ofObject:(CPObject)anObject withDict:(id)aDict userInfo:(id)someUserInfo
{
return [self registerSelector:aSelector ofObject:anObject withDict:aDict userInfo:someUserInfo handlerDelegate:nil];
}
/*! allows to register a selector for beeing fired on XMPP events, according to the content of a dictionnary parameter.
The dictionnary should contains zero to many of the followings :
- <b>namespace</b>: the namespace of the stanza or of the first child (like query)
- <b>name</b>: the name of the stanza (message, iq or presence)
- <b>type</b>: the type of the stanza
- <b>id</b>: the unique identifier
- <b>from</b>: the stanza sender
- <b>options</b>: an array of options. only {MatchBare: True} works.
if all the conditions are mets, the selector is fired and the stanza is given as parameter.
The selector should return YES to not be unregistered. If it returns NO or nothing, it will be
unregistered
@param aSelector the selector to be performed
@param anObject the receiver of the selector
@param aDict a dictionnary of parameters
@return an id of the handler registration used to remove it
*/
- (id)registerSelector:(SEL)aSelector ofObject:(CPObject)anObject withDict:(id)aDict
{
return [self registerSelector:aSelector ofObject:anObject withDict:aDict userInfo:nil handlerDelegate:nil];
}
/*! Registred selector will be performed if the stanza response is not received after a given amout of time.
The selector will be performed at every timeout interval until it returns NO.
@param aTimeoutSelector the selector to be performed if stanza timeouts
@param anObject the receiver of the selector
@param aDict a dictionnary of parameters
@param timeout float timeout of the handler
@return an id of the handler registration used to remove it
*/
- (id)registerTimeoutSelector:(SEL)aTimeoutSelector ofObject:(CPObject)anObject withDict:(id)aDict forTimeout:(float)aTimeout
{
var from = ([[aDict valueForKey:@"from"] isKindOfClass:CPString]) ? [aDict valueForKey:@"from"] : [[aDict valueForKey:@"from"] stringValue],
handlerId = _connection.addTimedHandler(aTimeout, function(stanza) {
if (!stanza)
{
// seems to be a good practice to pump the runloop in async function
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
var ret = [anObject performSelector:aTimeoutSelector];
CPLog.trace("StropheCappuccino stanza timeout that trigger selector : " + [anObject class] + "." + aTimeoutSelector);
// experimental thing
delete aDict.options;
return ret;
}
[_registeredTimedHandlers removeObject:handlerId];
return NO;
},
[aDict valueForKey:@"namespace"],
[aDict valueForKey:@"name"],
[aDict valueForKey:@"type"],
[aDict valueForKey:@"id"],
from,
[aDict valueForKey:@"options"]);
[_registeredTimedHandlers addObject:handlerId];
return handlerId;
}
/*! delete a registered selector
@param aHandlerId the handler id to remove
*/
- (void)deleteRegisteredSelector:(id)aHandlerId
{
_connection.deleteHandler(aHandlerId);
[_registeredHandlers removeObject:aHandlerId];
}
/*! delete a registered timed selector
@param aHandlerId the handler id to remove
*/
- (void)deleteRegisteredTimedSelector:(id)aTimedHandlerId
{
_connection.deleteTimedHandler(aTimedHandlerId);
[_registeredTimedHandlers removeObject:aTimedHandlerId];
}
/*! unrgister all registered selectors (including timeouted ones)
*/
- (void)deleteAllRegisteredSelectors
{
for (var i = 0; i < [_registeredHandlers count]; i++)
[self deleteRegisteredSelector:[_registeredHandlers objectAtIndex:i]];
for (var i = 0; i < [_registeredTimedHandlers count]; i++)
[self deleteRegisteredTimedSelector:[_registeredTimedHandlers objectAtIndex:i]];
[_registeredHandlers removeAllObjects];
[_registeredTimedHandlers removeAllObjects];
}
/*! register a selector to listen every incoming data
@param aSelector the selector to call
@param the target of the message
*/
- (void)rawInputRegisterSelector:(SEL)aSelector ofObject:(id)anObject
{
_connection.xmlInput = function(elem) {
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
[anObject performSelector:aSelector withObject:[TNStropheStanza nodeWithXMLNode:elem]];
}
}
/*! remove incoming data listener
*/
- (void)removeRawInputSelector
{
_connection.xmlInput = function(elem){
return;
};
}
/*! register a selector to listen every outgoing data
@param aSelector the selector to call
@param the target of the message
*/
- (void)rawOutputRegisterSelector:(SEL)aSelector ofObject:(id)anObject
{
_connection.xmlOutput = function(elem) {
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
[anObject performSelector:aSelector withObject:[TNStropheStanza nodeWithXMLNode:elem]];
}
}
/*! remove outgoing data listener
*/
- (void)removeRawOutputSelector
{
_connection.xmlOutput = function(elem){
return;
};
}
@end
@implementation TNStropheConnection (CPCoding)
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super initWithCoder:aCoder];
if (self)
{
_delegate = [aCoder decodeObjectForKey:@"_delegate"];
_boshService = [aCoder decodeObjectForKey:@"_boshService"];
_connection = [aCoder decodeObjectForKey:@"_connection"];
_registeredHandlers = [aCoder decodeObjectForKey:@"_registeredHandlers"];
_registeredTimedHandlers = [aCoder decodeObjectForKey:@"_registeredTimedHandlers"];
}
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[aCoder encodeObject:_boshService forKey:@"_boshService"];
[aCoder encodeObject:_connection forKey:@"_connection"];
[aCoder encodeObject:_registeredHandlers forKey:@"_registeredHandlers"];
[aCoder encodeObject:_registeredTimedHandlers forKey:@"_registeredTimedHandlers"];
}
@end