I am creating a chat based Application on QuickBlox
Framework, I want to have a block functionality in the App. I read out some of documents like XMPP and QuickBlox
. But did not got any help Out of that.
There is some logic of maintaining QBPrivacyList
for not to allow other user send message and block it but I didn't got succeed with it.
This is a code snippet how I am maintaining the Privacy List.
Get the privacy list with Name
@"public"
in method of chat did login[[QBChat instance] retrievePrivacyListWithName:@"public"];
so if there is already created privacy list named
"public"
will fetch it in delegate method- (void)chatDidReceivePrivacyList:(QBPrivacyList *)privacyList{ NSLog(@"chatDidReceivePrivacyList: %@", privacyList); _blockPrivacyList = privacyList; // Save its instance for further add more users in list }
// response is
[PrivacyList name: public]items:("type: USER_ID valueForType: 2075213 action: deny"
)This is how add another member in privacy list
- (void)blockUserWithQBId:(NSUInteger)qbID { QBPrivacyItem *item = [[QBPrivacyItem alloc] initWithType:USER_ID valueForType:qbID action:DENY]; if (_blockPrivacyList) { [_blockPrivacyList addObject:item]; // add new user if already privacy list is there }else _blockPrivacyList = [[QBPrivacyList alloc] initWithName:@"public" items:@[item]]; // create new privacy list if not before created [[QBChat instance] setPrivacyList:_blockPrivacyList]; }
And all the delegate methods works perfectly creates and adds member in privacy list.
- (void)chatDidSetPrivacyListWithName:(NSString *)name{ NSLog(@"chatDidSetPrivacyListWithName %@", name); [[QBChat instance] setDefaultPrivacyListWithName:name]; // set it as default privacy list }
I get this privacy list perfectly even i kill the app or Reinstall it for same user. so my privacy list code is working perfectly
But some how the other members in my DENY
privacy list can send me message.
According to the documents from this http://quickblox.com/developers/SimpleSample-chat_users-ios#Contact_list it should give the error like
"error:Error Domain=com.quickblox.chat Code=503 "Service not available."
So if all privacy list works perfectly then how can my blocked users could send me messages?
I had worked with XMPP
in iOS
the same issue exist there also if you can give XMPP
logic that will also work as QuickBlox
as QuickBlox
actually uses XMPP
itself.
Any suggestions for this?