Package de.fu_berlin.inf.dpp.net

Examples of de.fu_berlin.inf.dpp.net.JID


            public boolean accept(Packet packet) {
                ISarosSession sarosSession = sessionManager.getSarosSession();

                return sarosSession != null
                    && sarosSession.getHost().getJID()
                        .equals(new JID(packet.getFrom()));
            }
        };
    }
View Full Code Here


                    byte[] data = ito.accept(SubMonitor
                        .convert(new NullProgressMonitor()));

                    result.dataHash = Arrays.hashCode(data);

                    log.info(Utils.prefix(new JID(packet.getFrom()))
                        + "Connection Test Data received: " + data.length
                        + " bytes, hashCode==" + result.dataHash);
                } catch (SarosCancellationException e) {
                    log.error(
                        "Connection Test failed because of an CancelationException",
                        e);
                    result.errorMessage = "SarosCancellationException: "
                        + Utils.getMessage(e);
                } catch (IOException e) {
                    log.error(
                        "Connection Test failed because of an IOException", e);
                    result.errorMessage = "IOException: " + Utils.getMessage(e);
                }

                try {
                    IQ iqResponse = responseProvider.createIQ(result);
                    iqResponse.setTo(packet.getFrom());
                    iqResponse.setPacketID(ito.getTransferDescription().testID);

                    sarosNet.getConnection().sendPacket(iqResponse);
                } catch (Exception e) {
                    log.error(
                        "Could not send test results to "
                            + Utils.prefix(new JID(packet.getFrom())), e);
                }
            }
        }, new PacketFilter() {

            public boolean accept(Packet packet) {
View Full Code Here

            progress.worked(1);

            String id = Packet.nextID();

            progress.subTask("Checking if buddy is using Saros");
            JID user = discoManager.getSupportingPresence(plainJID,
                Saros.NAMESPACE);
            if (user == null)
                throw new XMPPException("Buddy " + plainJID
                    + " is not using Saros");
            progress.worked(1);
View Full Code Here

        List<UserListEntry> users = new LinkedList<UserListEntry>();

        int n = Integer.parseInt(userlistExtension.getValue(COUNT_KEY));

        for (int i = 0; i < n; i++) {
            JID jid = new JID(userlistExtension.getValue(USER_KEY + i));
            int colorID = Integer.parseInt(userlistExtension
                .getValue(USER_COLOR_KEY + i));
            Permission permission = Permission.valueOf(userlistExtension
                .getValue(USER_PERMISSION_KEY + i));
View Full Code Here

         */
        int userNumber = 1;

        // iterate through the map and write written char count to session data
        for (Map.Entry<JID, Integer> entry : remoteCharCount.entrySet()) {
            JID currentId = entry.getKey();
            // get character count for this buddy
            Integer charCount = entry.getValue();
            // write the count to the session data
            data.setRemoteUserCharCount(userNumber, charCount);

View Full Code Here

        if (connection == null) {
            log.warn("could not process presence, not connected to a server");
            return;
        }

        String userName = Utils.prefix(new JID(presence.getFrom()));
        switch (presence.getType()) {
        case error:
            String message = MessageFormat.format("Received error "
                + "presence package from {0}, condition: {1}, message: {2}",
                presence.getFrom(), presence.getError().getCondition(),
                presence.getError().getMessage());
            log.warn(message);
            return;

        case subscribed:
            log.info("Buddy subscribed to us: " + userName);
            break;

        case unsubscribed:
            log.info("Buddy unsubscribed from us: " + userName);
            break;

        case subscribe:
            log.info("Buddy requests to subscribe to us: " + userName);

            /*
             * Notify listeners; if at least one set the autoSubscribe flag to
             * true, do not ask the user for confirmation
             */
            boolean autoSubscribe = notifySubscriptionReceived(new JID(
                presence.getFrom()));

            // ask user for confirmation of subscription
            if (autoSubscribe
                || askUserForSubscriptionConfirmation(presence.getFrom())) {
View Full Code Here

            public void connectionStateChanged(Connection connection,
                ConnectionState newState) {

                if (newState == ConnectionState.CONNECTED) {
                    setJID(new JID(connection.getUser()));
                }
            }
        });

        // If already connected use the current JID.
View Full Code Here

        int numSarosSupportedBuddies = 0;

        for (final RosterEntry rosterEntry : this.getSortedRosterEntries()) {
            boolean sarosSupport;
            try {
                sarosSupport = discoveryManager.isSupportedNonBlock(new JID(
                    rosterEntry.getUser()), Saros.NAMESPACE);
            } catch (CacheMissException e) {
                sarosSupport = true;
            }
View Full Code Here

        /*
         * The model knows how to display roster entries best.
         */
        RosterEntryElement rosterEntryElement = new RosterEntryElement(saros
            .getSarosNet().getRoster(), new JID(rosterEntry.getUser()));

        MenuItem menuItem = new MenuItem(parentMenu, SWT.NONE, index);
        menuItem.setText(rosterEntryElement.getStyledText().toString());
        menuItem.setImage(rosterEntryElement.getImage());

        menuItem.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                List<JID> buddies = new ArrayList<JID>();
                buddies.add(new JID(rosterEntry));
                CollaborationUtils.shareResourcesWith(sarosSessionManager,
                    resources, buddies);
            }
        });

View Full Code Here

     * @param jid
     * @return
     */
    public boolean isOwnJID(JID jid) {
        if (mucManager.getMUCSession() != null) {
            JID localJID = mucManager.getMUCSession().getJID();
            boolean isOwnJID = localJID.equals(jid);
            return isOwnJID;
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of de.fu_berlin.inf.dpp.net.JID

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.