android - Issue in blocking user in chatlist using smack and open fire server -
i want block particular friend chat list xmpp
. code works fine. there no exception, not able block user. i'm using open fire server. changes should made on server?
can u guys have idea?
my code:
public void xmppaddnewprivacylist(connection connection, string username) { string listname = "newlist"; // create list of privacyitem allow or // deny privacy aspect list<privacyitem> privacyitems = new vector<privacyitem>(); privacyitem item = new privacyitem(privacyitem.type.jid.tostring(), false, 1); item.setvalue(username); privacyitems.add(item); // create new list. try { privacylistmanager privacymanager = new privacylistmanager(connection); privacymanager = privacylistmanager .getinstancefor(connection); privacymanager.createprivacylist(listname, privacyitems); } catch (xmppexception e) { system.out.println("privacy_error: " + e); } }
try ...
public boolean blockfriend(string friendname) { privacyitem item=new privacyitem(privacyitem.type.jid,friendname, false, 7); privacylistmanager privacymanager = privacylistmanager.getinstancefor(connection); list<privacyitem> list=new arraylist<privacyitem>(); list.add(item); try { privacymanager.updateprivacylist(newlist, list); privacymanager.setactivelistname(newlist); return true; } catch (smackexception.noresponseexception |xmppexception.xmpperrorexception | smackexception.notconnectedexception e) { e.printstacktrace(); return false; } }
and unblock replace false true in object of privacyitem `
Comments
Post a Comment