XEP-0016: Privacy Lists #90

Closed
elpatxificador opened this Issue Jul 31, 2012 · 5 comments

Comments

Projects
None yet
6 participants
@elpatxificador

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:@"charlie@chat.com" 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.

https://github.com/robbiehanson/XMPPFramework/blob/master/Extensions/XEP-0016/XMPPPrivacy.m

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

Thank you very much. Sorry for my English.

@elpatxificador

This comment has been minimized.

Show comment Hide comment
@elpatxificador

elpatxificador Aug 1, 2012

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

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

@jonasman

This comment has been minimized.

Show comment Hide comment
@jonasman

jonasman Apr 24, 2013

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

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

@Ricardo1980

This comment has been minimized.

Show comment Hide comment
@Ricardo1980

Ricardo1980 Dec 17, 2013

Hello!
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?
http://stackoverflow.com/questions/17693490/how-to-block-friend-with-xmpp-in-ios
Thanks in advance.

Hello!
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?
http://stackoverflow.com/questions/17693490/how-to-block-friend-with-xmpp-in-ios
Thanks in advance.

@arshadkc

This comment has been minimized.

Show comment Hide comment
@arshadkc

arshadkc Nov 6, 2014

You need to set the active list. In your case

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

arshadkc commented Nov 6, 2014

You need to set the active list. In your case

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

@vishaldeshai

This comment has been minimized.

Show comment Hide comment
@vishaldeshai

vishaldeshai Dec 9, 2016

@arshadkc As per your comment, i have implemented in iOS and it is working fine but after i reconnect server, privacy setting will be reset.

is there any reason??

thanks in advance.

vishaldeshai commented Dec 9, 2016

@arshadkc As per your comment, i have implemented in iOS and it is working fine but after i reconnect server, privacy setting will be reset.

is there any reason??

thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment