org.jivesoftware.smackx.muc.Affiliate Java Examples

The following examples show how to use org.jivesoftware.smackx.muc.Affiliate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BannedUsers.java    From Spark with Apache License 2.0 6 votes vote down vote up
/**
 * Loads all banned users in a ChatRoom.
 */
public void loadAllBannedUsers() {
    // Clear all elements from model
    listModel.clear();

    Iterator<Affiliate> bannedUsers = null;
    try {
        bannedUsers = chat.getOutcasts().iterator();
    }
    catch (XMPPException | SmackException | InterruptedException e) {
        Log.error("Error loading all banned users", e);
    }

    while (bannedUsers != null && bannedUsers.hasNext()) {
        Affiliate bannedUser = bannedUsers.next();
        ImageIcon icon = SparkRes.getImageIcon(SparkRes.STAR_RED_IMAGE);
        icon.setDescription(bannedUser.getJid().toString());
        listModel.addElement(icon);
    }
}
 
Example #2
Source File: ChatActivity.java    From mangosta-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onRoomMembersLoaded(final List<Affiliate> members) {
    super.onRoomMembersLoaded(members);
}
 
Example #3
Source File: UserInvitationPane.java    From Spark with Apache License 2.0 4 votes vote down vote up
/**
 * Removes oneself as an owner of the room.
 *
 * @param muc the <code>MultiUserChat</code> of the chat room.
 */
private void removeOwner(MultiUserChat muc) {
    if (muc.isJoined()) {
        // Try and remove myself as an owner if I am one.
        Collection<Affiliate> owners = null;
        try {
            owners = muc.getOwners();
        }
        catch (XMPPException | SmackException | InterruptedException e1) {
            return;
        }

        if (owners == null) {
            return;
        }

        Iterator<Affiliate> iter = owners.iterator();

        List<Jid> list = new ArrayList<>();
        while (iter.hasNext()) {
            Affiliate affilitate = iter.next();
            Jid jid = affilitate.getJid();
            if (!jid.equals(SparkManager.getSessionManager().getBareUserAddress())) {
                list.add(jid);
            }
        }
        if (list.size() > 0) {
            try {
                Form form = muc.getConfigurationForm().createAnswerForm();
                List<String> jidStrings = JidUtil.toStringList(list);
                form.setAnswer("muc#roomconfig_roomowners", jidStrings);

                // new DataFormDialog(groupChat, form);
                muc.sendConfigurationForm(form);
            }
            catch (XMPPException | SmackException | InterruptedException e) {
                Log.error(e);
            }
        }
    }
}
 
Example #4
Source File: InvitationPane.java    From Spark with Apache License 2.0 4 votes vote down vote up
/**
 * Removes oneself as an owner of the room.
 *
 * @param muc the <code>MultiUserChat</code> of the chat room.
 */
private void removeOwner(MultiUserChat muc) {
    if (muc.isJoined()) {
        // Try and remove myself as an owner if I am one.
        Collection owners = null;
        try {
            owners = muc.getOwners();
        }
        catch (XMPPException | SmackException | InterruptedException e1) {
            return;
        }

        if (owners == null) {
            return;
        }

        Iterator iter = owners.iterator();

        List<Jid> list = new ArrayList<>();
        while (iter.hasNext()) {
            Affiliate affilitate = (Affiliate)iter.next();
            Jid jid = affilitate.getJid();
            if (!jid.equals(SparkManager.getSessionManager().getBareUserAddress())) {
                list.add(jid);
            }
        }
        if (list.size() > 0) {
            try {
                Form form = muc.getConfigurationForm().createAnswerForm();
                List<String> jidStrings = new ArrayList<>(list.size());
                JidUtil.toStrings(list, jidStrings);
                form.setAnswer("muc#roomconfig_roomowners", jidStrings);

                // new DataFormDialog(groupChat, form);
                muc.sendConfigurationForm(form);
            }
            catch (XMPPException | SmackException | InterruptedException e) {
                Log.error(e);
            }
        }
    }
}
 
Example #5
Source File: RoomManagerListener.java    From mangosta-android with Apache License 2.0 2 votes vote down vote up
public void onRoomMembersLoaded(List<Affiliate> members) {

    }