Package de.fu_berlin.inf.dpp.net

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


    }

    public boolean test(Object receiver, String property, Object[] args,
        Object expectedValue) {
        if (receiver instanceof JID) {
            JID jid = (JID) receiver;
            if ("isInSarosSession".equals(property)) {
                ISarosSession sarosSession = sarosSessionManager
                    .getSarosSession();
                if (sarosSession != null) {
                    Collection<User> users = sarosSession.getParticipants();
View Full Code Here


        final InvitationExtensionProvider invExtProv) {
        this.sessionIDObservable = sessionIDObservablePar;
        receiver.addPacketListener(new PacketListener() {

            public void processPacket(Packet packet) {
                JID fromJID = new JID(packet.getFrom());
                InvitationInfo invInfo = invExtProv.getPayload(packet);

                if (invInfo == null) {
                    log.warn("Inv" + Utils.prefix(fromJID)
                        + ": The received invitation packet's"
                        + " payload is null.");
                    return;
                }

                log.debug("Inv" + Utils.prefix(fromJID)
                    + ": Received invitation (invitationID: "
                    + invInfo.invitationID + ", sessionID: "
                    + invInfo.sessionID + ", colorID: " + invInfo.colorID
                    + ", sarosVersion: " + invInfo.versionInfo.version
                    + ", sarosComp: " + invInfo.versionInfo.compatibility + ")");

                String sessionID = invInfo.sessionID;
                String invitationID = invInfo.invitationID;

                if (sessionIDObservable.getValue().equals(
                    SessionIDObservable.NOT_IN_SESSION)) {
                    sessionManager.invitationReceived(
                        new JID(packet.getFrom()), sessionID, invInfo.colorID,
                        invInfo.versionInfo, invInfo.sessionStart, sarosUI,
                        invitationID, invInfo.comPrefs, invInfo.description);
                } else {
                    transmitter.sendMessageToUser(new JID(packet.getFrom()),
                        cancelInviteExtension.create(sessionID,
                            "I am already in a Saros session and so"
                                + "cannot accept your invitation."));
                }
            }
View Full Code Here

        Collection<String> addresses) {
        List<RosterEntryElement> rosterEntryElements = new ArrayList<RosterEntryElement>();
        for (Iterator<String> iterator = addresses.iterator(); iterator
            .hasNext();) {
            String address = iterator.next();
            rosterEntryElements.add(new RosterEntryElement(roster, new JID(
                address)));
        }
        return rosterEntryElements.toArray(new RosterEntryElement[0]);
    }
View Full Code Here

     * Returns the entered {@link JID}.
     *
     * @return
     */
    public JID getJID() {
        return new JID(this.jidCombo.getText().trim());
    }
View Full Code Here

    @Override
    public Object[] getChildren() {
        Collection<RosterEntry> rosterEntries = rosterGroup.getEntries();
        List<RosterEntryElement> children = new ArrayList<RosterEntryElement>();
        for (RosterEntry rosterEntry : rosterEntries) {
            children.add(new RosterEntryElement(roster, new JID(rosterEntry
                .getUser())));
        }
        return children.toArray();
    }
View Full Code Here

        this.addPage(addBuddyWizardPage);
    }

    @Override
    public boolean performFinish() {
        final JID jid = this.addBuddyWizardPage.getBuddy();
        final String nickname = this.addBuddyWizardPage.getNickname();

        if (this.addBuddyWizardPage.isBuddyAlreadyAdded()) {
            log.debug("Buddy " + jid.toString() + " already added."); //$NON-NLS-1$ //$NON-NLS-2$
            return true;
        }

        /*
         * Listeners that sets the autoSubscribe flag to true and removes itself
         * from the subscriptionManager.
         */
        final SubscriptionManagerListener subscriptionManagerListener = new SubscriptionManagerListener() {
            public void subscriptionReceived(IncomingSubscriptionEvent event) {
                if (jid.equals(event.getBuddy()))
                    event.autoSubscribe = true;
                subscriptionManager.removeSubscriptionManagerListener(this);
            }
        };
        try {
            getContainer().run(true, true, new IRunnableWithProgress() {
                public void run(IProgressMonitor monitor)
                    throws InvocationTargetException, InterruptedException {
                    try {
                        /*
                         * Register for incoming subscription request from
                         * subscription response.
                         */
                        subscriptionManager
                            .addSubscriptionManagerListener(subscriptionManagerListener);

                        RosterUtils.addToRoster(saros.getSarosNet()
                            .getConnection(), jid, nickname, SubMonitor
                            .convert(monitor));
                        cachedBuddy = jid;
                    } catch (CancellationException e) {
                        throw new InterruptedException();
                    }
                }
            });
        } catch (InvocationTargetException e) {
            log.warn(e.getCause().getMessage(), e.getCause());

            subscriptionManager
                .removeSubscriptionManagerListener(subscriptionManagerListener);

            this.addBuddyWizardPage.setErrorMessage(e.getMessage());

            // Leave the wizard open
            return false;
        } catch (InterruptedException e) {
            log.debug("Adding buddy " + jid.toString() //$NON-NLS-1$
                + " was canceled by the user."); //$NON-NLS-1$

            subscriptionManager
                .removeSubscriptionManagerListener(subscriptionManagerListener);
        }
View Full Code Here

        this.sessionIDObservable = sessionIDObservablePar;
        // TODO SessionID-Filter
        receiver.addPacketListener(new PacketListener() {

            public void processPacket(Packet packet) {
                JID fromJID = new JID(packet.getFrom());

                log.debug("Inv" + Utils.prefix(fromJID) + ": Received userList");
                UserListInfo userListInfo = userListExtProv.getPayload(packet);

                if (userListInfo == null) {
View Full Code Here

            for (RosterGroup rosterGroup : roster.getGroups())
                elements.add(new RosterGroupElement(roster, rosterGroup));

            for (RosterEntry rosterEntry : roster.getUnfiledEntries())
                elements.add(new RosterEntryElement(roster, new JID(rosterEntry
                    .getUser())));

            return elements.toArray();
        }
View Full Code Here

        return type.equals(JID.class);
    }

    @Override
    public Object fromString(String str) {
        return new JID(Utils.urlUnescape(str));
    }
View Full Code Here

     */
    public void processPacket(Packet packet) {
        if (!getFilter().accept(packet))
            return;

        processMessage(new JID(packet.getFrom()), (Message) packet);
    }
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.