Examples of RosterEntry


Examples of org.jivesoftware.smack.RosterEntry

        Roster roster = connection.getRoster();
        if (roster == null)
            return null;

        RosterEntry entry = roster.getEntry(jid.getBase());
        if (entry == null)
            return null;

        String nickName = entry.getName();
        if (nickName != null && nickName.trim().length() > 0) {
            return nickName;
        }
        return null;
    }
View Full Code Here

Examples of org.jivesoftware.smack.RosterEntry

                // subscription
                sendPresence(Presence.Type.subscribed, presence.getFrom());

                // if no appropriate entry for request exists
                // create one
                RosterEntry e = connection.getRoster().getEntry(
                    presence.getFrom());
                if (e == null) {
                    try {
                        connection.getRoster().createEntry(presence.getFrom(),
                            presence.getFrom(), null);
                    } catch (XMPPException e1) {
                        log.error(e1);
                    }
                }
            } else {
                // user has rejected request
                sendPresence(Presence.Type.unsubscribe, presence.getFrom());
            }
            break;

        case unsubscribe:
            log.info("Buddy requests to unsubscribe from us: " + userName);
            // if appropriate entry exists remove that
            RosterEntry e = connection.getRoster().getEntry(presence.getFrom());
            if (e != null) {
                try {
                    connection.getRoster().removeEntry(e);
                } catch (XMPPException e1) {
                    log.error(e1);
View Full Code Here

Examples of org.jivesoftware.smack.RosterEntry

            // there is no image for the columns
            return null;
        }

        public String getColumnText(Object element, int columnIndex) {
            RosterEntry rosterEntry = (RosterEntry) element;
            final JID jid = new JID(rosterEntry.getUser());
            switch (columnIndex) {
            case 0:
                return rosterEntry.getUser();
            case 1:
                boolean supported;
                try {
                    supported = discoveryManager.isSupportedNonBlock(jid,
                        Saros.NAMESPACE);
View Full Code Here

Examples of org.jivesoftware.smack.RosterEntry

    protected class PresenceFilter extends ViewerFilter {
        @Override
        public boolean select(Viewer viewer, Object parentElement,
            Object element) {

            RosterEntry rosterEntry = (RosterEntry) element;
            Presence presence = roster.getPresence(rosterEntry.getUser());

            if (presence.isAvailable())
                return true;
            return false;
        }
View Full Code Here

Examples of org.jivesoftware.smack.RosterEntry

    protected class SarosSupportFilter extends ViewerFilter {
        @Override
        public boolean select(Viewer viewer, Object parentElement,
            Object element) {

            RosterEntry rosterEntry = (RosterEntry) element;
            JID jid = new JID(rosterEntry.getUser());
            boolean sarosSupport;
            try {
                sarosSupport = discoveryManager.isSupportedNonBlock(jid,
                    Saros.NAMESPACE);
            } catch (CacheMissException e) {
View Full Code Here

Examples of org.jivesoftware.smack.RosterEntry

    protected class SessionFilter extends ViewerFilter {
        @Override
        public boolean select(Viewer viewer, Object parentElement,
            Object element) {

            RosterEntry rosterEntry = (RosterEntry) element;
            JID jid = new JID(rosterEntry.getUser());
            if (sarosSession.getResourceQualifiedJID(jid) != null)
                return false;
            if (invitationProcesses.getInvitationProcess(jid) != null)
                return false;
            return true;
View Full Code Here

Examples of org.jivesoftware.smack.RosterEntry

            }
        });
    }

    public void runDeleteAction() {
        RosterEntry rosterEntry = null;
        List<RosterEntry> selectedRosterEntries = SelectionRetrieverFactory
            .getSelectionRetriever(RosterEntry.class).getSelection();
        if (selectedRosterEntries.size() == 1) {
            rosterEntry = selectedRosterEntries.get(0);
        }

        if (rosterEntry == null) {
            log.error("RosterEntry should not be null at this point!"); //$NON-NLS-1$
            return;
        }

        if (sessionManager != null) {
            // Is the chosen user currently in the session?
            ISarosSession sarosSession = sessionManager.getSarosSession();
            String entryJid = rosterEntry.getUser();

            if (sarosSession != null) {
                for (User p : sarosSession.getParticipants()) {
                    String pJid = p.getJID().getBase();
View Full Code Here

Examples of org.jivesoftware.smack.RosterEntry

    @Override
    public void run() {
        Utils.runSafeSync(log, new Runnable() {
            public void run() {
                RosterEntry rosterEntry = null;
                List<RosterEntry> selectedRosterEntries = SelectionRetrieverFactory
                    .getSelectionRetriever(RosterEntry.class).getSelection();
                if (selectedRosterEntries.size() == 1) {
                    /*
                     * TODO Why forbid renaming self? Is the own entry displayed
                     * at all?
                     */
                    // Compare the plain-JID portion of the XMPP address
                    if (!new JID(selectedRosterEntries.get(0).getUser())
                        .equals(saros.getSarosNet().getMyJID())) {
                        rosterEntry = selectedRosterEntries.get(0);
                    }
                }

                if (rosterEntry == null) {
                    log.error("RosterEntry should not be null at this point!"); //$NON-NLS-1$
                    return;
                }

                Shell shell = EditorAPI.getShell();

                assert shell != null : "Action should not be run if the display is disposed"; //$NON-NLS-1$

                String message = MessageFormat.format(
                    Messages.RenameContactAction_rename_message,
                    rosterEntry.getUser());

                if (rosterEntry.getName() != null) {
                    message += MessageFormat.format(
                        Messages.RenameContactAction_rename_current_nickname_message, rosterEntry.getName());
                }
                message += ":"; //$NON-NLS-1$

                InputDialog dialog = new InputDialog(shell, Messages.RenameContactAction_new_nickname_dialog_title,
                    message, rosterEntry.getName(), null);

                if (dialog.open() == Window.OK) {
                    String newName = dialog.getValue();
                    rosterEntry.setName(newName.length() == 0 ? null : newName);
                }
            }
        });
    }
View Full Code Here

Examples of org.jivesoftware.smack.RosterEntry

     * @review runSafe OK
     */
    @Override
    public void run() {

        RosterEntry rosterEntry = null;
        List<RosterEntry> selectedRosterEntries = SelectionRetrieverFactory
            .getSelectionRetriever(RosterEntry.class).getSelection();
        if (selectedRosterEntries.size() == 1) {
            rosterEntry = selectedRosterEntries.get(0);
        }

        if (rosterEntry == null) {
            log.error("RosterEntry should not be null at this point!"); //$NON-NLS-1$
            return;
        }

        final JID recipient = new JID(rosterEntry.getUser());

        final TestResult[] testResult = new TestResult[1];
        try {
            new ProgressMonitorDialog(null).run(true, true,
                new IRunnableWithProgress() {
View Full Code Here

Examples of org.jivesoftware.smack.RosterEntry

  public void refreshFriends() {
    this.filteredEntries.clear();
    Roster roster = XMPPWrapper.getConnection().getRoster();
    Iterator<RosterEntry> it = roster.getEntries().iterator();
    while (it.hasNext()) {
      RosterEntry friend = it.next();
      Presence p = roster.getPresence(friend.getUser());
      if ((this.displayMode == ShowMode.ONLINE) && (p.isAvailable())) {
        this.filteredEntries.add(friend);
      }
      if ((this.displayMode == ShowMode.OFFLINE) && (!p.isAvailable())) {
        this.filteredEntries.add(friend);
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.