/** * 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 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()); listModel.addElement(icon); } }
boolean amIOwner(MultiUserChat chat) throws XMPPException { for (Affiliate aff : chat.getOwners()) { if (getInternalService().getService().getEntityAdapter().normalizeJID(aff.getJid()).equals(getInternalService().getService().getProtocolUid())) { return true; } } return false; }
/** * 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 e1) { return; } if (owners == null) { return; } Iterator<Affiliate> iter = owners.iterator(); List<String> list = new ArrayList<String>(); while (iter.hasNext()) { Affiliate affilitate = iter.next(); String jid = affilitate.getJid(); if (!jid.equals(SparkManager.getSessionManager().getBareAddress())) { list.add(jid); } } if (list.size() > 0) { try { Form form = muc.getConfigurationForm().createAnswerForm(); form.setAnswer("muc#roomconfig_roomowners", list); // new DataFormDialog(groupChat, form); muc.sendConfigurationForm(form); } catch (XMPPException e) { Log.error(e); } } } }
/** * 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 e1) { return; } if (owners == null) { return; } Iterator iter = owners.iterator(); List list = new ArrayList(); while (iter.hasNext()) { Affiliate affilitate = (Affiliate)iter.next(); String jid = affilitate.getJid(); if (!jid.equals(SparkManager.getSessionManager().getBareAddress())) { list.add(jid); } } if (list.size() > 0) { try { Form form = muc.getConfigurationForm().createAnswerForm(); form.setAnswer("muc#roomconfig_roomowners", list); // new DataFormDialog(groupChat, form); muc.sendConfigurationForm(form); } catch (XMPPException e) { Log.error(e); } } } }
@Override public void onRoomMembersLoaded(final List<Affiliate> members) { super.onRoomMembersLoaded(members); }
public void onRoomMembersLoaded(List<Affiliate> members) { }