Examples of MUCBuddyStatus


Examples of com.valhalla.jbother.jabber.MUCBuddyStatus

     *            the BuddyStatus to get
     * @return the requested BuddyStatus
     */
    public MUCBuddyStatus getBuddyStatus(String user) {
        if (!buddyStatuses.containsKey(user)) {
            MUCBuddyStatus buddy = new MUCBuddyStatus(user);
            buddy.setMUC(chat);
            buddy.setName(user.substring(user.indexOf("/") + 1, user.length()));
            buddyStatuses.put(user, buddy);
        }

        return (MUCBuddyStatus) buddyStatuses.get(user);
    }
View Full Code Here

Examples of com.valhalla.jbother.jabber.MUCBuddyStatus

            public void run() {
                boolean redraw = false;
                //right now we find out if we have already received a packet
                // from them,
                //and if not, we set up an information "account" in the system
                MUCBuddyStatus buddy = window.getBuddyStatus(from);

                window.removeBuddy(buddy.getUser());

                // get the role and affiliation information
                MUCUser user = (MUCUser) presence.getExtension("x",
                        "http://jabber.org/protocol/muc#user");
                if (user != null) {
                    buddy.setMUCUser(user);
                    MUCUser.Item item = user.getItem();
                    if (item != null) {
                        if (item.getAffiliation() != null)
                            buddy.setAffiliation(item.getAffiliation());
                        if (item.getRole() != null)
                            buddy.setRole(item.getRole());

                        if(item.getAffiliation()!=null && item.getRole()!=null)
                        {
                            if(item.getAffiliation().equals("none") && item.getRole().equals("none"))
                            {
                                presence.setType(Presence.Type.UNAVAILABLE);
                            }
                        }
                    }
                }

                // update the relavent presence information
                if (presence.getType() == Presence.Type.UNAVAILABLE ) {
                    ConversationPanel conv = buddy.getConversation();
                    if ((conv != null) && (conv instanceof ChatPanel))
                        ((ChatPanel) conv).signedOff();

                } else {
                    buddy.addResource("_no resource_", 5, presence.getMode(),
                            presence.getStatus());
                }

                //if we need to, reload the nicklist.
                if (presence.getType() == Presence.Type.AVAILABLE) {
                    window.addBuddy(buddy.getUser());
                    String name = buddy.getName();
                    if (name == null)
                        return;
                    if (nickChange == null && !buddy.getIsInRoom()) {

                        String message = buddy.getName();
                        if( buddy.getJid() != null )
                        {
                            message += " (" + buddy.getJid() + ") ";
                        }

                        message += " has entered the room";

                        window.serverNoticeMessage(message);
                        PluginChain.fireEvent(new MUCEvent(buddy.getUser(),
                                MUCEvent.EVENT_PARTICIPANT_JOINED, "",
                                new Date()));
                    } else if (nickChange != null) {
                        nickChange.setIsInRoom(false);
                        window.serverNoticeMessage(nickChange.getName()
                                + " is now known as " + buddy.getName());
                        window.removeBuddy(nickChange.getUser());
                    }

                    buddy.setIsInRoom(true);

                    nickChange = null;
                } else if (presence.getType() == Presence.Type.UNAVAILABLE) {
                    buddy.setIsInRoom(false);
                    window.getBuddyStatuses().remove(buddy);
                    String leaveMessage = buddy.getName()
                            + " has left the room";
                    PluginChain.fireEvent(new MUCEvent(buddy.getUser(),
                            MUCEvent.EVENT_PARTICIPANT_PARTED, "", new Date()));

                    if (presence.getStatus() != null
                            && !presence.getStatus().equals("")) {
                        leaveMessage += ": " + presence.getStatus();
View Full Code Here

Examples of com.valhalla.jbother.jabber.MUCBuddyStatus

     */
    public Component getListCellRendererComponent(JList list, Object value,
            int index, boolean isSelected, boolean cellHasFocus) {

        String name = ((String)value).replaceAll( "^aa_aa\\d{4} ", "" );
        MUCBuddyStatus buddy = window.getBuddyStatus(name);

        String nick = "";
        String room = "";

        int a = buddy.getUser().indexOf("/");
        if (a > -1) {
            room = buddy.getUser().substring(0, a);
            nick = buddy.getUser().substring(a + 1);
        } else { //just in case
            nick = buddy.getUser();
            room = buddy.getUser();
        }

        if (Settings.getInstance().getProperty("statusTheme") == null)
            Settings.getInstance().setProperty("statusTheme", "default");
        ImageIcon icon = StatusIconCache.getStatusIcon(buddy.getPresence(buddy
                .getHighestResource()));
        if (icon != null)
            setIcon(icon);

        URL light = getClass().getClassLoader().getResource(
                "images/lightbulb.png");
        StringBuffer tooltip = new StringBuffer();
                tooltip.append( "<html><table border='0'><tr><td valign='top'><img src='" )
                .append( light.toString() )
                .append( "'></td><td>" )
                .append( "<b><font size='+1'>")
                .append( nick )
                .append( "</font></b>" )
                .append( "<table border='0' cellpadding='2' cellspacing='2'>" );

        // role and affiliation information
        String role = buddy.getRole();
        if (role == null || role.equals(""))
            role = "none";
        String affiliation = buddy.getAffiliation();
        if (affiliation == null || affiliation.equals(""))
            affiliation = "none";
        if (buddy.getJid() != null)
            tooltip.append( "<tr><td><b>JID:</b></td><td>" ).append( buddy.getJid() )
                    .append( "</td></tr>\n" );
        tooltip.append( "<tr><td><b>Role:</b></td><td>" ).append( role ).append( "</td></tr>\n" );
        tooltip.append( "<tr><td><b>Affiliation:</b></td><td>" ).append( affiliation )
                .append( "</td></tr>\n" );

        String statusMessage = buddy.getStatusMessage(buddy
                .getHighestResource());
        if (statusMessage != null && !statusMessage.equals("")) {
            tooltip.append( "<tr><td><b>" ).append( this.resources.getString("status") )
                    .append( ":</b></td><td>" ).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></html>" );

        setToolTipText(tooltip.toString());

        URL type = getClass().getClassLoader().getResource(
                "imagethemes/muc/default/" + buddy.getRole() + ".png");
        if (getClass().getClassLoader().getResource(
                "imagethemes/muc/default/" + buddy.getAffiliation() + ".png") != null) {
            type = getClass().getClassLoader().getResource(
                    "imagethemes/muc/default/" + buddy.getAffiliation()
                            + ".png");
        }

        if (type == null) {
            type = getClass().getClassLoader().getResource(
View Full Code Here

Examples of com.valhalla.jbother.jabber.MUCBuddyStatus

                public void run() {
                    nickListModel.clear();
                    Hashtable table = window.getBuddyStatuses();
                    ArrayList removers = new ArrayList();
                    for (Iterator i = table.keySet().iterator(); i.hasNext(); ) {
                        MUCBuddyStatus buddy = (MUCBuddyStatus) table.get(i.next());
                        if (buddy.size() <= 0 || !buddy.getIsInRoom()) {
                            removers.add(buddy);
                            continue;
                        }
                        addBuddy(buddy.getUser());
                    }
                    repaint();

                    for (int i = 0; i < removers.size(); i++) {
                        window.getBuddyStatuses().remove(removers.get(i));
View Full Code Here

Examples of com.valhalla.jbother.jabber.MUCBuddyStatus

         * @param  buddy  Description of the Parameter
         * @return        Description of the Return Value
         */
        public boolean contains(String buddy) {

            MUCBuddyStatus b = window.getBuddyStatus(buddy);
            String a = b.getAffiliation();
            if (a != null) {
                if (a.equals("owner")) {
                    buddy = "aa_aa1111 " + buddy;
                }
                if (a.equals("admin")) {
View Full Code Here

Examples of com.valhalla.jbother.jabber.MUCBuddyStatus

        /**
         * @param  buddy              the buddy to add
         */
        public void addBuddy(String buddy) {

            MUCBuddyStatus b = window.getBuddyStatus(buddy);
            String a = b.getAffiliation();
            boolean admin = false;
            if (a != null) {
                if (a.equals("owner")) {
                    buddy = "aa_aa1111 " + buddy;
                    admin = true;
View Full Code Here

Examples of com.valhalla.jbother.jabber.MUCBuddyStatus

         */
        public void removeBuddy(String buddy) {
            int row = 0;
            boolean found = false;

            MUCBuddyStatus b = window.getBuddyStatus(buddy);
            String a = b.getAffiliation();
            boolean admin = false;
            if (a != null) {
                if (a.equals("owner")) {
                    buddy = "aa_aa1111 " + buddy;
                    admin = true;
View Full Code Here

Examples of com.valhalla.jbother.jabber.MUCBuddyStatus

        public void mouseClicked(MouseEvent e) {
            checkPop(e);
            if (e.getClickCount() >= 2) {
                JList list = (JList) e.getComponent();

                MUCBuddyStatus buddy = window.getBuddyStatus(((String) list.getSelectedValue()).replaceAll("^aa_aa\\d{4} ", ""));
                BuddyList.getInstance().getBuddyListTree()
                        .initiateConversation(buddy);
            }
        }
View Full Code Here

Examples of com.valhalla.jbother.jabber.MUCBuddyStatus

    public UserStatusListener(ChatRoomPanel window) {
        this.window = window;
    }

    private void setRole(String role) {
        MUCBuddyStatus buddy = window.getBuddyStatus(window.getRoomName() + "/"
                + window.getChat().getNickname());
  window.removeMe();
        buddy.setRole(role);
    }
View Full Code Here

Examples of com.valhalla.jbother.jabber.MUCBuddyStatus

  window.removeMe();
        buddy.setRole(role);
    }

    private void setAffiliation(String aff) {
        MUCBuddyStatus buddy = window.getBuddyStatus(window.getRoomName() + "/"
                + window.getChat().getNickname());
  window.removeMe();
        buddy.setAffiliation(aff);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.