[jdev] blocking and unblocking

Bruno Bechler Machado brunoasdfgh at gmail.com
Thu May 10 13:33:13 CDT 2007


Hy..
sorry for post this subject again, but my problem isn't solved..

I need to block and unblock users using Java smack api 2.2.1.. someone can
help me?
please???????????????

i've been trying to do:

    public void blockingContactGateway(XMPPConnection connection, String
contact, String gatewayName)
    {
        Roster roster = connection.getRoster();

        String aux = "";
        aux = contact.substring(0, contact.indexOf("@")) + "\\40<file://40/>"
+
              contact.substring(contact.indexOf("@") + 1, contact.length());
        contact = aux;

        IMTools.printList(roster);

        Presence unavailable = new Presence(Presence.Type.UNSUBSCRIBE);

        String setTo = contact + "@" + gatewayName + "." +
connection.getServiceName();
        unavailable.setTo(setTo);

        String sendFrom = connection.getUser();
        unavailable.setFrom(sendFrom);

        connection.sendPacket(unavailable);

        System.out.println("Mandou pacote: ");
        System.out.println(unavailable.toXML());

    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.jabber.org/jdev/attachments/20070510/43ebb079/attachment-0002.htm>


More information about the JDev mailing list