Package com.valhalla.jbother.jabber

Examples of com.valhalla.jbother.jabber.BuddyStatus


                // added to the
                // BuddyList tree
                Iterator it = roster.getEntries();
                while (it.hasNext()) {
                    RosterEntry entry = (RosterEntry) it.next();
                    BuddyStatus buddy = BuddyList.getInstance().getBuddyStatus(
                            entry.getUser());

                    checkAddEntry(buddy);

                }
View Full Code Here


                while (leafs.hasMoreElements()) {
                    AutomatedTreeNode leaf = (AutomatedTreeNode) leafs
                            .nextElement();
                    Object check = leaf.getUserObject();
                    if (check instanceof BuddyStatus) {
                        BuddyStatus temp = (BuddyStatus) check;

                        if (temp.getUser().equals(buddy.getUser())) {
                            // once we find the buddy, remove it
                            removeBuddyNode(node, leaf);
                            if (removeFromGroup) {
                                BuddyGroup g = getGroupObject(group);
                                g.removeBuddy(buddy);
View Full Code Here

            group = "zzz Contacts";
        } else if (group.equals(resources.getString("transportsGroup"))) {
            group = "zzzz Agents/Transports";
        }

        BuddyStatus buddy = (BuddyStatus) leaf.getUserObject();

        String name = buddy.getName();
        if (name == null) {
            name = buddy.getUser();
        }
        String jid = buddy.getUser();

       // synchronized (buddyGroups) {
            TreeMap buddies = ((TreeMap) buddyGroups.get(group));
            Iterator i = buddies.keySet().iterator();
            while (i.hasNext()) {
View Full Code Here

         *
         * @param e
         *            Description of the Parameter
         */
        public void checkPop(MouseEvent e) {
            BuddyStatus buddy = null;

            if (e.isPopupTrigger()) {
                try {

                    JTree tree = (JTree) e.getComponent();

                    TreePath path = tree.getPathForLocation(e.getX(), e.getY());
                    if (path == null) {
                        throw new ClassCastException();
                    }

                    tree.setSelectionPath(path);

                    AutomatedTreeNode node = (AutomatedTreeNode) path
                            .getLastPathComponent();
                    Object selectedUserObject = node.getUserObject();
                    if (selectedUserObject.getClass().equals(BuddyStatus.class)) {
                        buddy = (BuddyStatus) node.getUserObject();
                        buddyPopupMenu.showMenu(e.getComponent(), e.getX(), e
                                .getY(), buddy);
                    } else if (selectedUserObject.getClass().equals(
                            BuddyGroup.class)) {
                        // buddies that are not in any group are put in
                        // "Contacts" group by JBother
                        // if we need to send a message to them, we need to
                        // extract them from the tree
                        // because there is no way to do it from the roster
                        Enumeration iChildren = node.children();
                        String usersList = new String();
                        while (iChildren.hasMoreElements())
                        {
                            AutomatedTreeNode o = (AutomatedTreeNode) iChildren
                                    .nextElement();
                            BuddyStatus buddyStatus = (BuddyStatus) o
                                    .getUserObject();
                            usersList += buddyStatus.getUser() + MessagePanel.RECIPIENTS_DELIMITER + " ";
                        }
                        // get rid of 'unneeded delimiter + space' string at the end
                        usersList = usersList.substring(0, usersList.length() -
                          (MessagePanel.RECIPIENTS_DELIMITER.length() + 1));
                        groupPopupMenu.showMenu(e.getComponent(), e.getX(), e
View Full Code Here

            java.util.List keys = new ArrayList(buddyStatuses.keySet());
            Iterator iterator = keys.iterator();

            while (iterator.hasNext()) {
                BuddyStatus buddy = (BuddyStatus) buddyStatuses.get(iterator
                        .next());
                if (!nickList.contains(buddy))
                    continue;
                try {
                    String nick = buddy.getUser().substring(
                            buddy.getUser().lastIndexOf("/") + 1);
                    if (nick.toLowerCase().startsWith(nickPart.toLowerCase())) {
                        matches.add(nick);
                    }
                } catch (java.lang.NullPointerException e) {
                }
View Full Code Here

         *  Called by the enclosing Thread - will attempt to add the buddy to
         *  the Roster, and will display an error if it wasn't successfull
         */
        public void run() {
            final Roster roster = BuddyList.getInstance().getConnection().getRoster();
            final BuddyStatus buddy = BuddyList.getInstance().getBuddyStatus(
                    buddyId);
            if (modify) {
                SwingUtilities.invokeLater(
                    new Runnable() {
                        public void run() {
                            BuddyList.getInstance().getBuddyListTree().removeBuddy(
                                    buddy, buddy.getGroup(), true);
                        }
                    });
            }

            try {


                if (modify) {
                    com.valhalla.Logger.debug("modifying roster item");
                    RosterEntry entry = buddy.getRosterEntry();
                    entry.setName(buddyAlias);
                    int c = 0;
                    Iterator groups = entry.getGroups();
                    while (groups.hasNext()) {
                        RosterGroup g = (RosterGroup) groups.next();
                        if(!g.contains(entry)) continue;
                        g.removeEntry(entry);
                        c++;
                    }

                    buddy.setTempGroup(groupName);
                    SwingUtilities.invokeLater(new Runnable()
                    {
                        public void run()
                        {
                            dialog.setVisible(false);
                            buddy.setRemoved(false);

                            NMOptionDialog.createMessageDialog(null, resources.getString("addBuddyDialogTitle"), resources.getString("buddyAdded"));

                            BuddyList.getInstance().getBuddyListTree().addBuddy(
                                    buddy);
                        }
                    });

                    if (groupName != null && !groupName.equals("")) {
                        RosterGroup newGroup = null;
                        newGroup = roster.getGroup(groupName);
                        if (newGroup == null) {
                            com.valhalla.Logger.debug("had to create new group" + groupName);
                            newGroup = roster.createGroup(groupName);
                        } else {
                            com.valhalla.Logger.debug("found group " + newGroup.getName());
                        }

                        if (c != 0) {
                            com.valhalla.Logger.debug("Moving buddy to " + newGroup.getName());
                            newGroup.addEntry(entry);
                        } else {
                            roster.createEntry(buddyId, buddyAlias,
                                    new String[]{groupName});

                        }
                    }
                }
                /*
                 *  if it's a new entry
                 */else {

                    if (groupName == null) {
                        roster.createEntry(buddyId, buddyAlias, null);
                    } else {
                        roster.createEntry(buddyId, buddyAlias,
                                new String[]{groupName});
                        buddy.setTempGroup(groupName);
                    }

                    SwingUtilities.invokeLater(new Runnable()
                    {
                        public void run()
                        {
                            dialog.setVisible(false);
                            buddy.setRemoved(false);

                            NMOptionDialog.createMessageDialog(null, resources.getString("addBuddyDialogTitle"), resources.getString("buddyAdded"));

                            BuddyList.getInstance().getBuddyListTree().addBuddy(
                                    buddy);
View Full Code Here

        Hashtable buddyStatuses = BuddyList.getInstance().getBuddyStatuses();
        if (buddyStatuses != null) {
            Iterator i = buddyStatuses.keySet().iterator();

            while (i.hasNext()) {
                BuddyStatus buddy = BuddyList.getInstance().getBuddyStatus(
                        (String) i.next());
                if (buddy.getConversation() != null) {
                    buddy.getConversation().updateStyle(
                            messageFontButton.getFont());
                }
            }
        }
View Full Code Here

                            .getBuddyStatuses();
                    if (buddyStatuses != null) {
                        Iterator iterator = buddyStatuses.keySet().iterator();
                        while (iterator.hasNext()) {
                            String user2 = (String) iterator.next();
                            BuddyStatus buddy2 = (BuddyStatus) buddyStatuses.get(user2);
                            if (buddy2.equals(buddy) == false
                                     && buddy2.getConversation() != null
                                     && buddy2.getConversation() instanceof ChatPanel) {
                                ((ChatPanel) buddy2.getConversation())
                                        .sendHandler(areaTextComplete);
                            }
                        }
                    }
                }
View Full Code Here

//        JFrame f = frame;

        //      if (frame !=null)
//        {
//
        final BuddyStatus buddy2 = buddy;
        frame.addWindowFocusListener(
            new WindowFocusListener() {
                public void windowGainedFocus(WindowEvent e) {
//                SwingUtilities.invokeLater(new Runnable() {
//                    public void run() {
                    buddy2.sendNotDisplayedID();
//                    }
//                });
                }

View Full Code Here

          .getCurrentPresenceMode()));
    }

    String me = blist.getConnection().getUser().replaceAll("/.*", "");

    BuddyStatus buddy = blist.getBuddyStatus(me);
    String user = buddy.getUser();
    String server = buddy.getUser();
    if (user.indexOf('@') > -1) {
      String parts[] = new String[2];
      parts = buddy.getUser().split("@");
      user = parts[0];
      server = parts[0];
      if (parts[1] != null) {
        server = parts[1];
      }
    }

    String resources = "";
    Iterator i = buddy.keySet().iterator();
    int resourceCount = 0;

    while (i.hasNext()) {
      String key = (String) i.next();

      if (!key.equals("N/A")) {
        boolean add = false;

        if (key.equals(buddy.getHighestResource())) {
          add = true;
        } else {
          resources += "  ";
        }

        resources += key + " (" + buddy.get(key) + ")";
        if (add) {
          resources += " <b>*</b>";
        }
        if (i.hasNext()) {
          resources += "<br>";
View Full Code Here

TOP

Related Classes of com.valhalla.jbother.jabber.BuddyStatus

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.