30
30
@interface XMPPBlockingQueryInfo : NSObject
31
31
{
32
32
XMPPBlockingQueryInfoType type;
33
- NSString *blockingJID ;
33
+ XMPPJID *blockingXMPPJID ;
34
34
NSArray *blockingListItems;
35
35
36
36
dispatch_source_t timer;
@@ -39,14 +39,14 @@ @interface XMPPBlockingQueryInfo : NSObject
39
39
@property (nonatomic , readonly ) XMPPBlockingQueryInfoType type;
40
40
@property (nonatomic , readonly ) NSArray *blockingListItems;
41
41
42
- @property (nonatomic , readwrite ) NSString *blockingJID ;
42
+ @property (nonatomic , readwrite ) XMPPJID *blockingXMPPJID ;
43
43
@property (nonatomic , readwrite ) dispatch_source_t timer;
44
44
45
45
- (void )cancel ;
46
46
47
47
+ (XMPPBlockingQueryInfo *)queryInfoWithType : (XMPPBlockingQueryInfoType)type ;
48
- + (XMPPBlockingQueryInfo *)queryInfoWithType : (XMPPBlockingQueryInfoType)type name : ( NSString *)name ;
49
- + (XMPPBlockingQueryInfo *)queryInfoWithType : (XMPPBlockingQueryInfoType)type name : ( NSString *)name items : (NSArray *)items ;
48
+ + (XMPPBlockingQueryInfo *)queryInfoWithType : (XMPPBlockingQueryInfoType)type jid : (XMPPJID *)jid ;
49
+ + (XMPPBlockingQueryInfo *)queryInfoWithType : (XMPPBlockingQueryInfoType)type jid : (XMPPJID *)jid items : (NSArray *)items ;
50
50
51
51
@end
52
52
@@ -232,14 +232,14 @@ - (NSArray*)blockingList
232
232
}
233
233
}
234
234
235
- - (void )blockJID : (NSString *) jid
235
+ - (void )blockJID : (XMPPJID*) xmppJID
236
236
{
237
237
XMPPLogTrace ();
238
238
239
- id value = [blockingDict objectForKey: jid ];
239
+ id value = [blockingDict objectForKey: [xmppJID full ] ];
240
240
if (value == nil )
241
241
{
242
- [blockingDict setObject: [NSNull null ] forKey: jid ];
242
+ [blockingDict setObject: [NSNull null ] forKey: [xmppJID full ] ];
243
243
}
244
244
245
245
// <iq from='juliet@capulet.com/chamber' type='set' id='block1'>
@@ -250,7 +250,7 @@ - (void)blockJID:(NSString*)jid
250
250
251
251
NSXMLElement *block = [NSXMLElement elementWithName: @" block" xmlns: @" urn:xmpp:blocking" ];
252
252
NSXMLElement *item = [NSXMLElement elementWithName: @" item" ];
253
- [item addAttributeWithName: @" jid" stringValue: jid ];
253
+ [item addAttributeWithName: @" jid" stringValue: [xmppJID full ] ];
254
254
[block addChild: item];
255
255
256
256
NSString *uuid = [xmppStream generateUUID ];
@@ -260,18 +260,18 @@ - (void)blockJID:(NSString*)jid
260
260
[xmppStream sendElement: iq];
261
261
262
262
XMPPBlockingQueryInfo *qi = [XMPPBlockingQueryInfo queryInfoWithType: BlockUser];
263
- qi.blockingJID = jid ;
263
+ qi.blockingXMPPJID = xmppJID ;
264
264
[self addQueryInfo: qi withKey: uuid];
265
265
}
266
266
267
- - (void )unblockJID : (NSString *) jid
267
+ - (void )unblockJID : (XMPPJID*) xmppJID
268
268
{
269
269
XMPPLogTrace ();
270
270
271
- id value = [blockingDict objectForKey: jid ];
271
+ id value = [blockingDict objectForKey: [xmppJID full ] ];
272
272
if (value != nil )
273
273
{
274
- [blockingDict removeObjectForKey: jid ];
274
+ [blockingDict removeObjectForKey: [xmppJID full ] ];
275
275
}
276
276
277
277
// <iq type='set' id='unblock1'>
@@ -282,7 +282,7 @@ - (void)unblockJID:(NSString*)jid
282
282
283
283
NSXMLElement *block = [NSXMLElement elementWithName: @" unblock" xmlns: @" urn:xmpp:blocking" ];
284
284
NSXMLElement *item = [NSXMLElement elementWithName: @" item" ];
285
- [item addAttributeWithName: @" jid" stringValue: jid ];
285
+ [item addAttributeWithName: @" jid" stringValue: [xmppJID full ] ];
286
286
[block addChild: item];
287
287
288
288
NSString *uuid = [xmppStream generateUUID ];
@@ -291,13 +291,13 @@ - (void)unblockJID:(NSString*)jid
291
291
[xmppStream sendElement: iq];
292
292
293
293
XMPPBlockingQueryInfo *qi = [XMPPBlockingQueryInfo queryInfoWithType: UnblockUser];
294
- qi.blockingJID = jid ;
294
+ qi.blockingXMPPJID = xmppJID ;
295
295
[self addQueryInfo: qi withKey: uuid];
296
296
}
297
297
298
- - (BOOL )containsJID : (NSString *) jid
298
+ - (BOOL )containsJID : (XMPPJID*) xmppJID
299
299
{
300
- if ([blockingDict objectForKey: jid ])
300
+ if ([blockingDict objectForKey: [xmppJID full ] ])
301
301
{
302
302
return true ;
303
303
}
@@ -371,11 +371,11 @@ - (void)processQuery:(XMPPBlockingQueryInfo *)queryInfo withFailureCode:(XMPPBlo
371
371
}
372
372
else if (queryInfo.type == BlockUser)
373
373
{
374
- [multicastDelegate xmppBlocking: self didNotBlockJID: queryInfo.blockingJID error: error];
374
+ [multicastDelegate xmppBlocking: self didNotBlockJID: queryInfo.blockingXMPPJID error: error];
375
375
}
376
376
else if (queryInfo.type == UnblockUser)
377
377
{
378
- [multicastDelegate xmppBlocking: self didNotUnblockJID: queryInfo.blockingJID error: error];
378
+ [multicastDelegate xmppBlocking: self didNotUnblockJID: queryInfo.blockingXMPPJID error: error];
379
379
}
380
380
else if (queryInfo.type == UnblockAll)
381
381
{
@@ -385,7 +385,7 @@ - (void)processQuery:(XMPPBlockingQueryInfo *)queryInfo withFailureCode:(XMPPBlo
385
385
386
386
- (void )queryTimeout : (NSString *)uuid
387
387
{
388
- XMPPBlockingQueryInfo *queryInfo = [blockingDict objectForKey: uuid];
388
+ XMPPBlockingQueryInfo *queryInfo = [pendingQueries objectForKey: uuid];
389
389
if (queryInfo)
390
390
{
391
391
[self processQuery: queryInfo withFailureCode: XMPPBlockingQueryTimeout];
@@ -440,12 +440,12 @@ - (void)processQueryResponse:(XMPPIQ *)iq withInfo:(XMPPBlockingQueryInfo *)quer
440
440
if ([[iq type ] isEqualToString: @" result" ])
441
441
{
442
442
[self removeQueryInfo: queryInfo withKey: [iq elementID ]];
443
- [multicastDelegate xmppBlocking: self didBlockJID: queryInfo.blockingJID ];
443
+ [multicastDelegate xmppBlocking: self didBlockJID: queryInfo.blockingXMPPJID ];
444
444
}
445
445
else
446
446
{
447
- [blockingDict removeObjectForKey: [iq elementID ]];
448
- [multicastDelegate xmppBlocking: self didNotBlockJID: queryInfo.blockingJID error: iq];
447
+ [blockingDict removeObjectForKey: [queryInfo.blockingXMPPJID full ]];
448
+ [multicastDelegate xmppBlocking: self didNotBlockJID: queryInfo.blockingXMPPJID error: iq];
449
449
}
450
450
}
451
451
else if (queryInfo.type == UnblockUser)
@@ -455,19 +455,19 @@ - (void)processQueryResponse:(XMPPIQ *)iq withInfo:(XMPPBlockingQueryInfo *)quer
455
455
if ([[iq type ] isEqualToString: @" result" ])
456
456
{
457
457
[self removeQueryInfo: queryInfo withKey: [iq elementID ]];
458
- [multicastDelegate xmppBlocking: self didUnblockJID: queryInfo.blockingJID ];
458
+ [multicastDelegate xmppBlocking: self didUnblockJID: queryInfo.blockingXMPPJID ];
459
459
}
460
460
else
461
461
{
462
462
XMPPBlockingQueryInfo *queryInfo = [pendingQueries objectForKey: [iq elementID ]];
463
463
464
- id value = [blockingDict objectForKey: queryInfo.blockingJID ];
464
+ id value = [blockingDict objectForKey: [ queryInfo.blockingXMPPJID full ] ];
465
465
if (value == nil )
466
466
{
467
- [blockingDict setObject: [NSNull null ] forKey: queryInfo.blockingJID ];
467
+ [blockingDict setObject: [NSNull null ] forKey: [ queryInfo.blockingXMPPJID full ] ];
468
468
}
469
469
470
- [multicastDelegate xmppBlocking: self didNotBlockJID: queryInfo.blockingJID error: iq];
470
+ [multicastDelegate xmppBlocking: self didNotBlockJID: queryInfo.blockingXMPPJID error: iq];
471
471
}
472
472
}
473
473
else if (queryInfo.type == UnblockAll)
@@ -483,10 +483,10 @@ - (void)processQueryResponse:(XMPPIQ *)iq withInfo:(XMPPBlockingQueryInfo *)quer
483
483
{
484
484
XMPPBlockingQueryInfo *queryInfo = [pendingQueries objectForKey: [iq elementID ]];
485
485
486
- id value = [blockingDict objectForKey: queryInfo.blockingJID ];
486
+ id value = [blockingDict objectForKey: [ queryInfo.blockingXMPPJID full ] ];
487
487
if (value == nil )
488
488
{
489
- [blockingDict setObject: [NSNull null ] forKey: queryInfo.blockingJID ];
489
+ [blockingDict setObject: [NSNull null ] forKey: queryInfo.blockingXMPPJID ];
490
490
}
491
491
492
492
[multicastDelegate xmppBlocking: self didNotUnblockAllDueToError: iq];
@@ -562,7 +562,7 @@ -(void)xmppStreamDidDisconnect:(XMPPStream *)sender withError:(NSError *)error
562
562
563
563
for (NSString *uuid in pendingQueries)
564
564
{
565
- XMPPBlockingQueryInfo *queryInfo = [blockingDict objectForKey: uuid];
565
+ XMPPBlockingQueryInfo *queryInfo = [pendingQueries objectForKey: uuid];
566
566
567
567
[self processQuery: queryInfo withFailureCode: XMPPBlockingDisconnect];
568
568
}
@@ -588,16 +588,16 @@ -(void)xmppStreamDidDisconnect:(XMPPStream *)sender withError:(NSError *)error
588
588
@implementation XMPPBlockingQueryInfo
589
589
590
590
@synthesize type;
591
- @synthesize blockingJID ;
591
+ @synthesize blockingXMPPJID ;
592
592
@synthesize blockingListItems;
593
593
@synthesize timer;
594
594
595
- - (id )initWithType : (XMPPBlockingQueryInfoType)aType name : ( NSString *)name items : (NSArray *)items
595
+ - (id )initWithType : (XMPPBlockingQueryInfoType)aType jid : (XMPPJID *)jid items : (NSArray *)items
596
596
{
597
597
if ((self = [super init ]))
598
598
{
599
599
type = aType;
600
- blockingJID = [name copy ];
600
+ blockingXMPPJID = [jid copy ];
601
601
blockingListItems = [items copy ];
602
602
}
603
603
return self;
@@ -622,17 +622,17 @@ - (void)dealloc
622
622
623
623
+ (XMPPBlockingQueryInfo *)queryInfoWithType : (XMPPBlockingQueryInfoType)type
624
624
{
625
- return [self queryInfoWithType: type name :nil items: nil ];
625
+ return [self queryInfoWithType: type jid :nil items: nil ];
626
626
}
627
627
628
- + (XMPPBlockingQueryInfo *)queryInfoWithType : (XMPPBlockingQueryInfoType)type name : ( NSString *)name
628
+ + (XMPPBlockingQueryInfo *)queryInfoWithType : (XMPPBlockingQueryInfoType)type jid : (XMPPJID *)jid
629
629
{
630
- return [self queryInfoWithType: type name: name items: nil ];
630
+ return [self queryInfoWithType: type jid: jid items: nil ];
631
631
}
632
632
633
- + (XMPPBlockingQueryInfo *)queryInfoWithType : (XMPPBlockingQueryInfoType)type name : ( NSString *)name items : (NSArray *)items
633
+ + (XMPPBlockingQueryInfo *)queryInfoWithType : (XMPPBlockingQueryInfoType)type jid : (XMPPJID *)jid items : (NSArray *)items
634
634
{
635
- return [[XMPPBlockingQueryInfo alloc ] initWithType: type name: name items: items];
635
+ return [[XMPPBlockingQueryInfo alloc ] initWithType: type jid: jid items: items];
636
636
}
637
637
638
638
@end
0 commit comments