Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


XEP-0016: Privacy Lists #90

elpatxificador opened this Issue · 4 comments

5 participants


Hello, I want to create a list of blocked users and refuse to communicate with them. I use the XMPP extension XEP-0016 and initialize:

- (void)setupXMPPPrivacy
    NSLog((@"%s [Line %d] "), __PRETTY_FUNCTION__, __LINE__);
    //Init XMPPPrivacy List
    //xmppPrivacy = [[XMPPPrivacy alloc] init];
    xmppPrivacy = [[XMPPPrivacy alloc] initWithDispatchQueue:dispatch_get_main_queue()];
    //Activate xmpp modules
    [xmppPrivacy activate:xmppStream];
    //Delegate XMPPPrivacy
    [xmppPrivacy addDelegate:self delegateQueue:dispatch_get_main_queue()];

Then attempt to block a user as follows:

- (void)privacyBlock
    XMPPPrivacy *privacy = [[XMPPPrivacy alloc] init];
    NSXMLElement *privacyElement = [XMPPPrivacy privacyItemWithType:@"jid" value:@"" action:@"deny" order:0];
    [XMPPPrivacy blockIQs:privacyElement];
    [XMPPPrivacy blockMessages:privacyElement];
    [XMPPPrivacy blockPresenceIn:privacyElement];
    [XMPPPrivacy blockPresenceOut:privacyElement]; 
    NSLog(@"-------> PRIVACY ELEMENT: %@", privacyElement);
    NSArray *arrayPrivacy = [[NSArray alloc] initWithObjects:privacyElement, nil];
    [privacy setListWithName:@"test" items:arrayPrivacy];

Do not get it to work the method setListWithName, when I run this code the application crash. I tried to use the methods: setDefaultListName and setActiveListName but it is the same, although no difference between these methods.

Not if I have to configure anything else about XMPPPrivacy. I am missing.

Thank you very much. Sorry for my English.


The problem was that the UUID was Null. This line of code generates the UUID as null, but I found the solution.

NSString *uuid = [xmppStream generateUUID];

Now the problem is that the Open-Fire server does not return anything when I try to block a user.

Any help?

Thank you very much. Sorry for my english


you cannot use XMPPPrivacy *privacy = [[XMPPPrivacy alloc] init]; in your block code
You have to use the privacy from the pre initialized module.


I'm trying to understand the logic involved in the privacy module.
Can anyone tell me a link or the definition of ListName and privacyListItems?
I only want to block users (jid), unblock them and retrieve who is blocked.
When blocking a user, do I have to block several elements like in this sample code?
Thanks in advance.


You need to set the active list. In your case

[privacy setListWithName:@"test" items:arrayPrivacy];
[privacy setActiveListName:@"test"];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.