Package com.valhalla.jbother.jabber

Examples of com.valhalla.jbother.jabber.BuddyStatus


                manager.setVisible(true);
            } else if (e.getSource() == consoleItem) {
                String from = resources.getString("xmlConsole");;
                ParsedBuddyInfo info = new ParsedBuddyInfo(from);
                String userId = info.getUserId().toLowerCase();
                final BuddyStatus buddyStatus = BuddyList.getInstance()
                        .getBuddyStatus(userId);
                buddyStatus.setName ( resources.getString ( "xmlConsole"));
                if (buddyStatus.getConversation() == null) {
                    buddyStatus.setConversation(ConsolePanel.getInstance(buddyStatus));
                    MessageDelegator.getInstance().showPanel(
                            buddyStatus.getConversation());
                    MessageDelegator.getInstance().frontFrame(
                            buddyStatus.getConversation());
                }
            }
            else if(e.getSource() == memItem)
    {
      MemoryDialog.getInstance(BuddyList.getInstance().getContainerFrame());
View Full Code Here


       
        public void run()
        {
            for(int i = 0; i < items.length; i++)
            {
                final BuddyStatus buddy = BuddyList.getInstance().getBuddyStatus(items[i].getJID());
                buddy.setRemoved(true);
                final String gp = buddy.getGroup();
               
                try {
                    BuddyList.getInstance().getConnection().getRoster().removeEntry(buddy.getRosterEntry());
                }
                catch(XMPPException ex) { }
               
                javax.swing.SwingUtilities.invokeLater(new Runnable()
                {
View Full Code Here

        leaveItem.addActionListener(listener);
    }

    public void addFrameListener (BuddyStatus buddy)
    {
        final BuddyStatus buddy2=buddy;
        addWindowFocusListener ( new WindowFocusListener() {
            public void windowGainedFocus (WindowEvent e) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        buddy2.sendNotDisplayedID();
                    }
                });
            }
            public void windowLostFocus(WindowEvent e) {
            }
View Full Code Here

        }
        if( buddyStatuses == null )
        {
            buddyStatuses = new Hashtable();
        }
        BuddyStatus buddy = new BuddyStatus( userId );

        if( buddyStatuses.get( userId.toLowerCase() ) != null )
        {
            buddy = (BuddyStatus)buddyStatuses.get( userId.toLowerCase() );
        }
        else
        {
            buddy.newPubKey();
            buddyStatuses.put( userId.toLowerCase(), buddy );
        }

        return buddy;
    }
View Full Code Here

        if( Arguments.getInstance().getBoolean( "xmlconsole" ) )
        {

            ParsedBuddyInfo info = new ParsedBuddyInfo( resources.getString( "xmlConsole" ) );
            String userId = info.getUserId().toLowerCase();
            final BuddyStatus buddyStatus = BuddyList.getInstance()
                    .getBuddyStatus( userId );
            buddyStatus.setName( resources.getString( "xmlConsole" ) );
            if( buddyStatus.getConversation() == null )
            {
                buddyStatus.setConversation( ConsolePanel.getInstance( buddyStatus ) );
                MessageDelegator.getInstance().showPanel(
                        buddyStatus.getConversation() );
                MessageDelegator.getInstance().frontFrame(
                        buddyStatus.getConversation() );
            }
        }

        sound.setSelected(!Settings.getInstance().getBoolean("noSound"));
        showOffline.setSelected( Settings.getInstance().getBoolean(
View Full Code Here

        {
            Iterator iterator = buddyStatuses.keySet().iterator();
            while( iterator.hasNext() )
            {
                String user = (String)iterator.next();
                BuddyStatus buddy = (BuddyStatus)buddyStatuses.get( user );
                buddy.resetBuddy();
                if( buddy.getConversation() != null
                         && buddy.getConversation() instanceof ChatPanel )
                {
                    ( (ChatPanel)buddy.getConversation() ).disconnected();
                }
            }
        }

        if( tabFrame != null )
View Full Code Here

            {
                getTabFrame().setStatus( mode, result );
            }

            ParsedBuddyInfo info = new ParsedBuddyInfo( connection.getUser() );
            BuddyStatus buddy = BuddyList.getInstance().getBuddyStatus(
                    info.getUserId() );
            buddy.addResource( info.getResource(), priority, mode, result );
            statusMenu.loadSelfStatuses();

            updateIcons();
            sendStatusChangedEvent();
            statusMenu.setModeChecked( mode );
View Full Code Here

        UIDefaults ui = UIManager.getDefaults();

        if (node.getUserObject() instanceof BuddyStatus) {
            // sets up the buddy information
            BuddyStatus buddy = (BuddyStatus) node.getUserObject();

            value = buddy.getUser();
            if (buddy.getName() != null) {
                value = buddy.getName();
            }
            stringVal = value.toString();

            String user = buddy.getUser();
            String server = buddy.getUser();
            int index = user.indexOf("@");
            if (index > -1) {
                server = user.substring(index + 1);
                user = user.substring(0, index);
            }

            // check for connection error
            if (!BuddyList.getInstance().checkConnection()) {
                Exception ex = new Exception("Disconnected from server");
                ConnectorThread.getInstance().getConnectionListener()
                        .connectionClosedOnError(ex);
            }

            // gets all the resources
            int resourceCount = 0;
            StringBuffer resources = new StringBuffer();

            Iterator i = buddy.keySet().iterator();

            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.append("  ");
                    }

                    resources.append(key).append(" (").append(buddy.get(key))
                            .append(")");
                    if (add) {
                        resources.append(" <b>*</b>");
                    }
                    if (i.hasNext()) {
                        resources.append("<br>");
                    }
                    resourceCount++;
                }
            }

            // draw the tooltip
            StringBuffer tooltip = new StringBuffer();
            tooltip
                    .append(
                            "<html><table><tr><td valign='middle' width='2%'><img src='")
                    .append(light.toString())
                    .append("'></td><td valign='top'>")
                    .append(
                            "<table border='0'><tr><td colspan='2'><b><font size='+1'>")
                    .append(user.replaceAll("\\%", "@"))
                    .append(
                            "</font></b><table border='0' cellpadding='2' cellspacing='2'><tr><td nowrap><b>")
                    .append(this.resources.getString("server")).append(
                            ":</b></td><td nowrap>").append(server).append(
                            "</td></tr>");

            RosterEntry entry = buddy.getRosterEntry();
            if (entry != null) {
                RosterPacket.ItemType subType = entry.getType();
                if (subType != null) {
                    tooltip.append("<tr><td nowrap><b>").append(
                            this.resources.getString("subscription")).append(
                            ":</b></td><td nowrap>").append(subType.toString())
                            .append("</td></tr>");
                }
            }

            if (resourceCount > 0) {
                tooltip.append("<tr><td valign=\"top\" nowrap><b>").append(
                        this.resources.getString("pluralResources")).append(
                        ":</b></td><td nowrap>").append(resources).append(
                        "</td></tr>");
            }

            if (buddy.getPubKey() != null) {
                tooltip.append("<tr><td valign=\"top\" nowrap><b>").append(
                        this.resources.getString("gnupgKey")).append(
                        ":</b></td><td nowrap>").append(buddy.getPubKey())
                        .append("</td></tr>");
            }

            String statusMessage = buddy.getStatusMessage(buddy
                    .getHighestResource());
            if (statusMessage != null && !statusMessage.equals("")) {
                statusMessage = statusMessage.replaceAll("\n", "<br>");
                tooltip.append("<tr><td nowrap><b>").append(
                        this.resources.getString("status")).append(
                        ":</b></td><td nowrap>").append(statusMessage).append(
                        "</td></tr>");
            }

            String using = buddy.getVersionInfo();
            if (using != null) {
                tooltip.append("<tr><td nowrap><b>").append(
                        this.resources.getString("using")).append(
                        ":</b></td><td nowrap>").append(using).append(
                        "</td></tr>");
            }

            tooltip
                    .append("</table></td></tr></table></td></tr></table></html>");
            setToolTipText(tooltip.toString());
            setFont((Font) ui.get("Label.font"));

            super.getTreeCellRendererComponent(tree, stringVal, isSelected,
                    expanded, leaf, row, hasFocus);

            // setting up status icon
            Presence.Mode mode = null;
            if (buddy.size() == 0) {
                setForeground(Color.GRAY);
            } else {
                mode = buddy.getPresence(buddy.getHighestResource());
            }

            ImageIcon statusIcon = null;

            // name based guess
            if (buddy.getUser().indexOf("@") == -1) {
                Pattern p = Pattern
                        .compile("^(aim|msn|yahoo|icq|gadu-gadu)[-_.].*");
                Matcher m = p.matcher(buddy.getUser());
                if (m.matches() && m.groupCount() >= 1) {
                    String type = m.group(1);
                    if (type != null) {
                        statusIcon = Standard
                                .getIcon("imagethemes/statusicons/"
                                        + type
                                        + "/"
                                        + SelfStatuses.getInstance().getStatus(
                                                mode).getShortcut() + ".png");
                    }
                }
            }

            // discovery information based guess
            Properties cache = JBotherLoader.getDiscoveryCache();
            String discoInfo = cache.getProperty(buddy.getUser().replaceAll(
                    "/.*", ""));
            if (discoInfo != null) {
                String items[] = discoInfo.split(" ");
                if (items.length == 2) {
                    String type = items[1];
View Full Code Here

                    .getBuddyStatuses();
            if (buddyStatuses != null) {
                Iterator iterator = buddyStatuses.keySet().iterator();
                while (iterator.hasNext()) {
                    String user = (String) iterator.next();
                    BuddyStatus buddy = (BuddyStatus) buddyStatuses.get(user);
                    if (buddy.getConversation() != null
                            && buddy.getConversation() instanceof ChatPanel) {
                        ((ChatPanel) buddy.getConversation()).enableEncrypt();
                    }
                }
            }
            if (gnupgSignPresenceCheck.isSelected()) {
                settings.setBoolean("gnupgSignPresence", true);
View Full Code Here

            MessageEventManager messageEventManager) {
        super.composingNotificationRequested(from, packetID,
                messageEventManager);
        final ParsedBuddyInfo info = new ParsedBuddyInfo(from);
        final String userId = info.getUserId().toLowerCase();
        final BuddyStatus buddy = BuddyList.getInstance()
                .getBuddyStatus(userId);
        buddy.setComposingID(packetID);
    }
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.