How to block anonymous user in XMPP
In order to implement chat functionality in my app, I have integrated XMPP framework in to it. There is no buddy request functionality hence users can send messages to other users without sending a buddy request. Due to this functionality I have not created any Roster or Privacy list in the app, and anonymous chat mode has been implemented.
Everything works fine except block user functionality, since this is an anonymous user chat hence there is no privacy list for the users, and XMPP extension XEP-016 only supports blocking through privacy list.
I have also tried to look for the alternatives and one of them is to implement XEP-0191 but unfortunately Open Fire does not supports this extension.
So techies please guide me to fix this problem. Following are my questions.
Do I need to create a privacy list/roster to block a user in anonymous user chat mode. This solution looks impractical since my app may have thousands of users.
Shall I Change the Jabber server from open fire to EJabber? Does Ejabber support XEP-0191
Apart from above please let me know if you guys know any other workaround to block/unblock a user in anonymous user chat mode in Jabber.
I have no experience with EJabber server, but XEP 0191 is definitely the protocol you need.
You may have a look here http://www.ejabberd.im/protocols and see, that EJabber supports your protocol.
My advice will be to change the server.
A block is moot anyway. If you block a person they could just create a new anonymous user and start contacting you again. Whilst this might seem like a lot of effort it could easily be scripted to send spam messages. Every 30mins you create a new account and spam everybody, get kicked and repeat.
At the very least you are going to have to implement XEP-0191 (server side block list) and figure out how to deal with anonymous new accounts.
Unfortunately I have to stick with Open fire server. In order to fix the block user problem I had to go through the documentation of XMPP and finally found the solution in XEP-0016, this extension indeed has the capability to support the anonymous user blocking. To accomplish this one has to create a privacy list on server using - (void)setListWithName:(NSString *)privacyListName items:(NSArray *)items fromUser:(NSString *)user;
method. Once done mark the created list as Active list by calling the method - (void)setActiveListName:(NSString *)privacyListName;
.
XEP-0016 has nothing to do with Roster and it can block anonymous user chat.
链接地址: http://www.djcxy.com/p/94150.html上一篇: 与Facebook xmpp的eJabberd连接
下一篇: 如何在XMPP中阻止匿名用户