params.clear(); params.add(n); params.add("autoregister"); String s = (String) execute("core.accountGet", params); if (s.equalsIgnoreCase("1")) { params.clear(); params.add(n); execute("core.register", params); r++; }
    public Gui() {        initComponents();        try {            accfile = System.getProperty("user.home", ".") + "/phonebook.xml";            client = new XmlRpcClientLite(InetAddress.getByName(Utils.COREHOST)                    .getHostName(), Utils.COREPORT);            //XmlRpc.setDebug(true);            server = new WebServer(Utils.GUIPORT, InetAddress                    .getByName(Utils.GUIHOST));            GuiStub guiStub = new GuiStub(this);            server.start();            server.addHandler("gui", guiStub);            // call REGISTER_GUI immediately after GUI has been opened            params.clear();            params.addElement(Utils.GUIHOST);            params.addElement(new Integer(Utils.GUIPORT));            Object o = execute("core.registerGui", params, 3000);            if (o == null) {                // --- something            } else if (((String) o).equalsIgnoreCase("OK")) {                print("GUI registered.");                params.clear();                o = execute("core.accountGetAll", params);                int a = 0;                int r = 0;                if (o != null && o instanceof Vector) {                    Vector v = (Vector) o;                    Enumeration e = v.elements();                    while (e.hasMoreElements()) {                        Integer n = (Integer) e.nextElement();                        ImageIcon img = new ImageIcon(cl                                .getResource("gui/resources/red.gif"));                        img.setDescription(n.toString());                        list1.addElement(img);                        //     list1.addElement("#" + n.toString()                        //             + ": not registered");                        Account acc = new Account(n.intValue(), false);                        accounts.add(acc);                        a++;                        params.clear();                        params.add(n);                        params.add("autoregister");                        String s = (String) execute("core.accountGet", params);                        if (s.equalsIgnoreCase("1")) {                            params.clear();                            params.add(n);                            execute("core.register", params);                            r++;                        }                    }                    print("Got " + a + " accounts (" + r                            + " automatically registered).");                }            } else {                print("ERROR: GUI not registered.");            }            readPhonebook();            Enumeration e = phonebook.elements();            while (e.hasMoreElements()) {                Contact con = (Contact) e.nextElement();                list3.addElement(con.name);            }        } catch (MalformedURLException e1) {            e1.printStackTrace();        } catch (UnknownHostException e1) {            e1.printStackTrace();        }    }