Examples of BuddyStatus


Examples of com.valhalla.jbother.jabber.BuddyStatus

            MessageEventManager messageEventManager) {
        super.displayedNotificationRequested(from, packetID,
                messageEventManager);
        final ParsedBuddyInfo info = new ParsedBuddyInfo(from);
        final String userId = info.getUserId().toLowerCase();
        final BuddyStatus buddy = BuddyList.getInstance()
                .getBuddyStatus(userId);
          buddy.addNotDisplayedID(packetID, buddy.getUser ());
    }
View Full Code Here

Examples of com.valhalla.jbother.jabber.BuddyStatus

    }

    public void composingNotification(String from, String packetID) {
        final ParsedBuddyInfo info = new ParsedBuddyInfo(from);
        final String userId = info.getUserId().toLowerCase();
        final BuddyStatus buddy = BuddyList.getInstance()
                .getBuddyStatus(userId);
        if (buddy.getConversation() != null
                && buddy.getConversation() instanceof ChatPanel) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    ((ChatPanel) buddy.getConversation()).setIsTyping(true);
                }
            });
        }
    }
View Full Code Here

Examples of com.valhalla.jbother.jabber.BuddyStatus

    }

    public void cancelledNotification(String from, String packetID) {
        final ParsedBuddyInfo info = new ParsedBuddyInfo(from);
        final String userId = info.getUserId().toLowerCase();
        final BuddyStatus buddy = BuddyList.getInstance()
                .getBuddyStatus(userId);
        if (buddy.getConversation() != null
                && buddy.getConversation() instanceof ChatPanel) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    ((ChatPanel) buddy.getConversation()).setIsTyping(false);
                }
            });
        }
    }
View Full Code Here

Examples of com.valhalla.jbother.jabber.BuddyStatus

    private void receiveNotificationHandler (String from,  final String [] doneMessage, final String eventType )
    {

        from=resources.getString("eventConsole");
               final BuddyStatus buddy =  BuddyList.getInstance().getBuddyStatus(new ParsedBuddyInfo(from).getUserId().toLowerCase());
        buddy.setName ( resources.getString("eventConsole"));

        if (buddy.getConversation() == null) {
                    buddy.setConversation( new EventPanel(buddy));
                }


        if ( doneMessage !=null &&
                buddy.getConversation() != null &&
                buddy.getConversation() instanceof EventPanel) {
                final String[] statusMessage = doneMessage;
                SwingUtilities.invokeLater(new Runnable()
                {
                    public void run() {
                        ((EventPanel) buddy.getConversation()).messageEvent( "<font color='red'>Message sent to " + BuddyList.getInstance().getBuddyStatus(new ParsedBuddyInfo(statusMessage[0]).getUserId().toLowerCase()).getName () + " at " +  statusMessage[1" was " + eventType + ".");
                    }
                });

            }
    }
View Full Code Here

Examples of com.valhalla.jbother.jabber.BuddyStatus

        if (presence.getType() != Presence.Type.AVAILABLE
                 && presence.getType() != Presence.Type.UNAVAILABLE) {
            return;
        }

        final BuddyStatus buddy = BuddyList.getInstance()
                .getBuddyStatus(userId);

        SwingUtilities.invokeLater(
            new Runnable() {
                public void run() {
                    boolean isSelf = false;
                    if (buddy.getUser().equals(
                            BuddyList.getInstance().getConnection().getUser()
                            .replaceAll("/.*", ""))) {
                        isSelf = true;
                    }

                    // if it's unavailable, check to see if they have any resources
                    // still online
                    // if they do, set the packet to available, and minus one
                    // resource
                    if (presence.getType() == Presence.Type.UNAVAILABLE) {
                        buddy.removeResource(resource);
                        if (buddy.size() > 0) {
                            presence.setType(Presence.Type.AVAILABLE);
                        }
                    } else {
                        int priority = presence.getPriority();
                        if (priority < 0) {
                            priority = 0;
                        }

                        buddy.addResource(resource, priority, presence.getMode(),
                                presence.getStatus());
                    }

                    performPresenceTasks(buddy, presence.getType());

                    if (!BuddyList.getInstance().checkConnection()) {
                        return;
                    }

                    if (isSelf) {
                        BuddyList.getInstance().getStatusMenu()
                                .loadSelfStatuses();
                    }

                    BuddyList.getInstance().getBuddyListTree().removeBuddy(buddy,
                            buddy.getGroup(), false);

                    Roster roster = ConnectorThread.getInstance().getRoster();
                    if (roster == null) {
                        return;
                    }
                    if (!isSelf
                             && (roster.getEntry(userId) != null || roster.getEntry(userId + "/" + resource) != null)) {
                        if (presence.getType() == Presence.Type.AVAILABLE
                                 || Settings.getInstance().getBoolean(
                                "showOfflineBuddies")) {
                            BuddyList.getInstance().getBuddyListTree().addBuddy(
                                    buddy);
                        }
                    }

                    ConversationPanel conv = buddy.getConversation();
                    if ((conv != null) && (conv instanceof ChatPanel)) {
                        ((ChatPanel) conv).updateResources();
                    }
                }
            });
View Full Code Here

Examples of com.valhalla.jbother.jabber.BuddyStatus

                                            Presence.Type.SUBSCRIBED);
                                    packet.setTo(userId);

                                    BuddyList.getInstance().getConnection().sendPacket(
                                            packet);
                                    BuddyStatus buddy = BuddyList.getInstance()
                                            .getBuddyStatus(userId);
                                    buddy.setRemoved(false);
                                }

                                boolean add = true;
                                // find out if they are already in the roster
                                if (ConnectorThread.getInstance().getRoster()
View Full Code Here

Examples of com.valhalla.jbother.jabber.BuddyStatus

                    String userId = info.getUserId().toLowerCase();
                    String resource = info.getResource();
                    String server = info.getServer();
                    from = info.getBareAddress();

                    BuddyStatus buddy = BuddyList.getInstance().getBuddyStatus(
                            userId);

                    if (BuddyList.getInstance().getBlockedUsers().containsKey(
                            userId)) {
                        com.valhalla.Logger.debug("Blocking user: " + userId);
                        return;
                    }

                    String messageSbj = packet.getSubject();
                    String messageBody = packet.getBody();
                    GnuPG gnupg = new GnuPG();
                    decryptedFlag = false;
                    verifiedFlag = false;
                    final SecureExtension xEncryptedExtension = (SecureExtension) packet
                            .getExtension("x", "jabber:x:encrypted");
                    if (xEncryptedExtension != null
                            && Settings.getInstance().getProperty(
                                    "gnupgSecretKeyID") != null) {
                        String decryptedMessageBody = gnupg
                                .decryptExtension(xEncryptedExtension.getData());
                        if (decryptedMessageBody != null) {
                            messageBody = decryptedMessageBody;
                            decryptedFlag = true;
                        } else {
                            messageBody = "[ "
                                    + resources
                                            .getString("gnupgErrorDecrypting")
                                    + ". "
                                    + resources.getString("reason")
                                    + ":\n "
                                    + gnupg.getErrorString().replaceAll("\n",
                                            " ") + " ]";
                        }
                    }

                    final SecureExtension xSignedExtension = (SecureExtension) packet
                            .getExtension("x", "jabber:x:signed");
                    if (xSignedExtension != null) {
                        String verifiedMessageId = gnupg.verifyExtension(
                                xSignedExtension.getData(), messageBody);

                        if (verifiedMessageId != null) {
                            verifiedMessageId = verifiedMessageId.replaceAll(
                                    "\n$", "");
                        }
                        if ((verifiedMessageId != null)
                                && (buddy.getPubKey() != null)
                                && (buddy.getPubKey()
                                        .endsWith(verifiedMessageId))) {
                            verifiedFlag = true;
                        }
                    }

                    if (!BuddyList.getInstance().checkConnection())
                        return;

                    // we don't want null messages to be displayed.
                    if ((messageBody == null))
                        return;

                    if (!Settings.getInstance().getBoolean("showAgentMessages")
                            && userId.indexOf("@") == -1)
                        return;

                    RosterEntry entry = ConnectorThread.getInstance()
                            .getRoster().getEntry(from);
                    if (entry != null)
                        userId = entry.getName();

                    if (buddy.getName() != null)
                        userId = buddy.getName();

                    if (buddy.getConversation() == null) {
                        if (packet.getType() == Message.Type.HEADLINE) {
                            buddy.setConversation(new HeadlinesPanel(buddy));
                        } else {
                            buddy.setConversation(new ChatPanel(buddy));
                        }
                    }

                    Date date = null;
                    String append = "";
                    DelayInformation inf = (DelayInformation) packet
                            .getExtension("x", "jabber:x:delay");
                    if (inf != null
                            && buddy.getConversation() instanceof ChatPanel) {

                            append = " (" + resources.getString( "offline" ).toLowerCase();
                            if( inf.getReason() != null && !inf.getReason().equals( "" )) append += ": " + inf.getReason();

                            append += ")";

                         if (inf.getStamp() != null)
                            date = inf.getStamp();
                    }

                    buddy.getConversation().receiveMessage(messageSbj,
                            append, messageBody, resource, date, decryptedFlag,
                            verifiedFlag);
                    if (buddy.getConversation() instanceof ChatPanel) {
                        ((ChatPanel) buddy.getConversation())
                                .setLastReceivedMessage(packet);
                    }

                    /*if (Settings.getInstance().getBoolean("useTabbedWindow")
                            && BuddyList.getInstance().getTabFrame() != null) {
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.