Package de.uniol.informatik.vlba.purplebee

Examples of de.uniol.informatik.vlba.purplebee.Config


    /**
     * <p>Default constructor initializing the network.</p>
     */
    public PidginP2P() {
        Config config = Config.getInstance();
        // Connect to DBus and get object of PurpleInterface
        this.connect();
        try
        {
            // read in account
//            BufferedReader in =
//                new BufferedReader(
//                    new InputStreamReader(new FileInputStream("account.txt")));
            BufferedReader in =
                new BufferedReader(
                    new InputStreamReader(new FileInputStream(config.getAccount_file())));
            while (account == 0 && in.ready())
            {
                String line = in.readLine().trim();
                if (line.startsWith("#") || line.equals(""))
                    continue;

                account = po.PurpleAccountsFind(line, "");
                System.out.println("Found account " + account + " with screenname " + line);
            }
            in.close();

        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
       
        // Get all buddies of the used account
        List <Integer>buddies = po.PurpleFindBuddies(account, "");
       
        // TODO Do the neighbors have to be online?
//      // Remove all offline buddies from the list
//      for (Integer buddy : buddies) {
//          if (po.PurpleBuddyIsOnline(buddy.intValue()) == 0) {
//              buddies.remove(buddy);
//          }
//      }
        // copy from List to array
        nodes = new Node[buddies.size()];
        for (int i=0; i<nodes.length; i++) {
            nodes[i] = new PidginP2PNode(buddies.get(i).toString(), this);
        }
        try{
            // read in all nodes
//            BufferedReader in =
//                new BufferedReader(
//                        new InputStreamReader(new FileInputStream("hosts.txt")));
            BufferedReader in =
                new BufferedReader(
                        new InputStreamReader(new FileInputStream(config.getHosts_file())));
            Vector<PidginP2PNode> nodes = new Vector<PidginP2PNode>();
            while (in.ready())
            {
                String line = in.readLine().trim();
                if (line.startsWith("#") || line.equals(""))
View Full Code Here

TOP

Related Classes of de.uniol.informatik.vlba.purplebee.Config

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.