MucOptions.java

  1package eu.siacs.conversations.entities;
  2
  3import android.annotation.SuppressLint;
  4import android.support.annotation.NonNull;
  5import android.util.Log;
  6
  7import java.util.ArrayList;
  8import java.util.Collections;
  9import java.util.HashSet;
 10import java.util.List;
 11import java.util.Set;
 12
 13import eu.siacs.conversations.Config;
 14import eu.siacs.conversations.R;
 15import eu.siacs.conversations.utils.JidHelper;
 16import eu.siacs.conversations.utils.UIHelper;
 17import eu.siacs.conversations.xml.Namespace;
 18import eu.siacs.conversations.xmpp.chatstate.ChatState;
 19import eu.siacs.conversations.xmpp.forms.Data;
 20import eu.siacs.conversations.xmpp.forms.Field;
 21import eu.siacs.conversations.xmpp.pep.Avatar;
 22import rocks.xmpp.addr.Jid;
 23
 24@SuppressLint("DefaultLocale")
 25public class MucOptions {
 26
 27	private boolean mAutoPushConfiguration = true;
 28
 29	public Account getAccount() {
 30		return this.conversation.getAccount();
 31	}
 32
 33	public void setSelf(User user) {
 34		this.self = user;
 35	}
 36
 37	public void changeAffiliation(Jid jid, Affiliation affiliation) {
 38		User user = findUserByRealJid(jid);
 39		synchronized (users) {
 40			if (user != null && user.getRole() == Role.NONE) {
 41				users.remove(user);
 42				if (affiliation.ranks(Affiliation.MEMBER)) {
 43					user.affiliation = affiliation;
 44					users.add(user);
 45				}
 46			}
 47		}
 48	}
 49
 50	public void flagNoAutoPushConfiguration() {
 51		mAutoPushConfiguration = false;
 52	}
 53
 54	public boolean autoPushConfiguration() {
 55		return mAutoPushConfiguration;
 56	}
 57
 58	public boolean isSelf(Jid counterpart) {
 59		return counterpart.equals(self.getFullJid());
 60	}
 61
 62	public void resetChatState() {
 63		synchronized (users) {
 64			for (User user : users) {
 65				user.chatState = Config.DEFAULT_CHATSTATE;
 66			}
 67		}
 68	}
 69
 70	public enum Affiliation {
 71		OWNER("owner", 4, R.string.owner),
 72		ADMIN("admin", 3, R.string.admin),
 73		MEMBER("member", 2, R.string.member),
 74		OUTCAST("outcast", 0, R.string.outcast),
 75		NONE("none", 1, R.string.no_affiliation);
 76
 77		Affiliation(String string, int rank, int resId) {
 78			this.string = string;
 79			this.resId = resId;
 80			this.rank = rank;
 81		}
 82
 83		private String string;
 84		private int resId;
 85		private int rank;
 86
 87		public int getResId() {
 88			return resId;
 89		}
 90
 91		@Override
 92		public String toString() {
 93			return this.string;
 94		}
 95
 96		public boolean outranks(Affiliation affiliation) {
 97			return rank > affiliation.rank;
 98		}
 99
100		public boolean ranks(Affiliation affiliation) {
101			return rank >= affiliation.rank;
102		}
103	}
104
105	public enum Role {
106		MODERATOR("moderator", R.string.moderator, 3),
107		VISITOR("visitor", R.string.visitor, 1),
108		PARTICIPANT("participant", R.string.participant, 2),
109		NONE("none", R.string.no_role, 0);
110
111		Role(String string, int resId, int rank) {
112			this.string = string;
113			this.resId = resId;
114			this.rank = rank;
115		}
116
117		private String string;
118		private int resId;
119		private int rank;
120
121		public int getResId() {
122			return resId;
123		}
124
125		@Override
126		public String toString() {
127			return this.string;
128		}
129
130		public boolean ranks(Role role) {
131			return rank >= role.rank;
132		}
133	}
134
135	public enum Error {
136		NO_RESPONSE,
137		SERVER_NOT_FOUND,
138		NONE,
139		NICK_IN_USE,
140		PASSWORD_REQUIRED,
141		BANNED,
142		MEMBERS_ONLY,
143		KICKED,
144		SHUTDOWN,
145		INVALID_NICK,
146		UNKNOWN
147	}
148
149	public static final String STATUS_CODE_SELF_PRESENCE = "110";
150	public static final String STATUS_CODE_ROOM_CREATED = "201";
151	public static final String STATUS_CODE_BANNED = "301";
152	public static final String STATUS_CODE_CHANGED_NICK = "303";
153	public static final String STATUS_CODE_KICKED = "307";
154	public static final String STATUS_CODE_AFFILIATION_CHANGE = "321";
155	public static final String STATUS_CODE_LOST_MEMBERSHIP = "322";
156	public static final String STATUS_CODE_SHUTDOWN = "332";
157
158	private interface OnEventListener {
159		void onSuccess();
160
161		void onFailure();
162	}
163
164	public interface OnRenameListener extends OnEventListener {
165
166	}
167
168	public static class User implements Comparable<User> {
169		private Role role = Role.NONE;
170		private Affiliation affiliation = Affiliation.NONE;
171		private Jid realJid;
172		private Jid fullJid;
173		private long pgpKeyId = 0;
174		private Avatar avatar;
175		private MucOptions options;
176		private ChatState chatState = Config.DEFAULT_CHATSTATE;
177
178		public User(MucOptions options, Jid from) {
179			this.options = options;
180			this.fullJid = from;
181		}
182
183		public String getName() {
184			return fullJid == null ? null : fullJid.getResource();
185		}
186
187		public void setRealJid(Jid jid) {
188			this.realJid = jid != null ? jid.asBareJid() : null;
189		}
190
191		public Role getRole() {
192			return this.role;
193		}
194
195		public void setRole(String role) {
196			if (role == null) {
197				this.role = Role.NONE;
198				return;
199			}
200			role = role.toLowerCase();
201			switch (role) {
202				case "moderator":
203					this.role = Role.MODERATOR;
204					break;
205				case "participant":
206					this.role = Role.PARTICIPANT;
207					break;
208				case "visitor":
209					this.role = Role.VISITOR;
210					break;
211				default:
212					this.role = Role.NONE;
213					break;
214			}
215		}
216
217		public Affiliation getAffiliation() {
218			return this.affiliation;
219		}
220
221		public void setAffiliation(String affiliation) {
222			if (affiliation == null) {
223				this.affiliation = Affiliation.NONE;
224				return;
225			}
226			affiliation = affiliation.toLowerCase();
227			switch (affiliation) {
228				case "admin":
229					this.affiliation = Affiliation.ADMIN;
230					break;
231				case "owner":
232					this.affiliation = Affiliation.OWNER;
233					break;
234				case "member":
235					this.affiliation = Affiliation.MEMBER;
236					break;
237				case "outcast":
238					this.affiliation = Affiliation.OUTCAST;
239					break;
240				default:
241					this.affiliation = Affiliation.NONE;
242			}
243		}
244
245		public void setPgpKeyId(long id) {
246			this.pgpKeyId = id;
247		}
248
249		public long getPgpKeyId() {
250			if (this.pgpKeyId != 0) {
251				return this.pgpKeyId;
252			} else if (realJid != null) {
253				return getAccount().getRoster().getContact(realJid).getPgpKeyId();
254			} else {
255				return 0;
256			}
257		}
258
259		public Contact getContact() {
260			if (fullJid != null) {
261				return getAccount().getRoster().getContactFromRoster(realJid);
262			} else if (realJid != null) {
263				return getAccount().getRoster().getContact(realJid);
264			} else {
265				return null;
266			}
267		}
268
269		public boolean setAvatar(Avatar avatar) {
270			if (this.avatar != null && this.avatar.equals(avatar)) {
271				return false;
272			} else {
273				this.avatar = avatar;
274				return true;
275			}
276		}
277
278		public String getAvatar() {
279			return avatar == null ? null : avatar.getFilename();
280		}
281
282		public Account getAccount() {
283			return options.getAccount();
284		}
285
286		public Conversation getConversation() {
287			return options.getConversation();
288		}
289
290		public Jid getFullJid() {
291			return fullJid;
292		}
293
294		@Override
295		public boolean equals(Object o) {
296			if (this == o) return true;
297			if (o == null || getClass() != o.getClass()) return false;
298
299			User user = (User) o;
300
301			if (role != user.role) return false;
302			if (affiliation != user.affiliation) return false;
303			if (realJid != null ? !realJid.equals(user.realJid) : user.realJid != null)
304				return false;
305			return fullJid != null ? fullJid.equals(user.fullJid) : user.fullJid == null;
306
307		}
308
309		public boolean isDomain() {
310			return realJid != null && realJid.getLocal() == null && role == Role.NONE;
311		}
312
313		@Override
314		public int hashCode() {
315			int result = role != null ? role.hashCode() : 0;
316			result = 31 * result + (affiliation != null ? affiliation.hashCode() : 0);
317			result = 31 * result + (realJid != null ? realJid.hashCode() : 0);
318			result = 31 * result + (fullJid != null ? fullJid.hashCode() : 0);
319			return result;
320		}
321
322		@Override
323		public String toString() {
324			return "[fulljid:" + String.valueOf(fullJid) + ",realjid:" + String.valueOf(realJid) + ",affiliation" + affiliation.toString() + "]";
325		}
326
327		public boolean realJidMatchesAccount() {
328			return realJid != null && realJid.equals(options.account.getJid().asBareJid());
329		}
330
331		@Override
332		public int compareTo(@NonNull User another) {
333			if (another.getAffiliation().outranks(getAffiliation())) {
334				return 1;
335			} else if (getAffiliation().outranks(another.getAffiliation())) {
336				return -1;
337			} else {
338				return getComparableName().compareToIgnoreCase(another.getComparableName());
339			}
340		}
341
342
343		private String getComparableName() {
344			Contact contact = getContact();
345			if (contact != null) {
346				return contact.getDisplayName();
347			} else {
348				String name = getName();
349				return name == null ? "" : name;
350			}
351		}
352
353		public Jid getRealJid() {
354			return realJid;
355		}
356
357		public boolean setChatState(ChatState chatState) {
358			if (this.chatState == chatState) {
359				return false;
360			}
361			this.chatState = chatState;
362			return true;
363		}
364	}
365
366	private Account account;
367	private final Set<User> users = new HashSet<>();
368	private ServiceDiscoveryResult serviceDiscoveryResult;
369	private final Conversation conversation;
370	private boolean isOnline = false;
371	private Error error = Error.NONE;
372	public OnRenameListener onRenameListener = null;
373	private User self;
374	private String password = null;
375
376	public MucOptions(Conversation conversation) {
377		this.account = conversation.getAccount();
378		this.conversation = conversation;
379		this.self = new User(this, createJoinJid(getProposedNick()));
380	}
381
382	public boolean updateConfiguration(ServiceDiscoveryResult serviceDiscoveryResult) {
383		this.serviceDiscoveryResult = serviceDiscoveryResult;
384		String name;
385		Field roomConfigName = getRoomInfoForm().getFieldByName("muc#roomconfig_roomname");
386		if (roomConfigName != null) {
387			Log.d(Config.LOGTAG,"value of room config name "+roomConfigName.getValue());
388			name = roomConfigName.getValue();
389		} else {
390			List<ServiceDiscoveryResult.Identity> identities = serviceDiscoveryResult.getIdentities();
391			String identityName = identities.size() > 0 ? identities.get(0).getName() : null;
392			if (!conversation.getJid().getEscapedLocal().equals(identityName)) {
393				name = identityName;
394			} else {
395				name = null;
396			}
397		}
398		boolean changed = conversation.setAttribute("muc_name", name);
399		changed |= conversation.setAttribute(Conversation.ATTRIBUTE_MEMBERS_ONLY, this.hasFeature("muc_membersonly"));
400		changed |= conversation.setAttribute(Conversation.ATTRIBUTE_MODERATED, this.hasFeature("muc_moderated"));
401		changed |= conversation.setAttribute(Conversation.ATTRIBUTE_NON_ANONYMOUS, this.hasFeature("muc_nonanonymous"));
402		return changed;
403	}
404
405
406	private Data getRoomInfoForm() {
407		final List<Data> forms = serviceDiscoveryResult == null ? Collections.emptyList() : serviceDiscoveryResult.forms;
408		return forms.size() == 0 ? new Data() : forms.get(0);
409	}
410
411	public String getAvatar() {
412		return account.getRoster().getContact(conversation.getJid()).getAvatar();
413	}
414
415	public boolean hasFeature(String feature) {
416		return this.serviceDiscoveryResult != null && this.serviceDiscoveryResult.features.contains(feature);
417	}
418
419	public boolean hasVCards() {
420	    return hasFeature("vcard-temp");
421    }
422
423	public boolean canInvite() {
424		Field field = getRoomInfoForm().getFieldByName("muc#roomconfig_allowinvites");
425		return !membersOnly() || self.getRole().ranks(Role.MODERATOR) || (field != null && "1".equals(field.getValue()));
426	}
427
428	public boolean canChangeSubject() {
429		Field field = getRoomInfoForm().getFieldByName("muc#roominfo_changesubject");
430		return self.getRole().ranks(Role.MODERATOR) || (field != null && "1".equals(field.getValue()));
431	}
432
433	public boolean allowPm() {
434		final Field field = getRoomInfoForm().getFieldByName("muc#roomconfig_allowpm");
435		if (field == null) {
436			return true; //fall back if field does not exists
437		}
438		if ("anyone".equals(field.getValue())) {
439			return true;
440		} else if ("participants".equals(field.getValue())) {
441			return self.getRole().ranks(Role.PARTICIPANT);
442		} else if ("moderators".equals(field.getValue())) {
443			return self.getRole().ranks(Role.MODERATOR);
444		} else {
445			return false;
446		}
447	}
448
449	public boolean participating() {
450		return !online()
451				|| self.getRole().ranks(Role.PARTICIPANT)
452				|| hasFeature("muc_unmoderated");
453	}
454
455	public boolean membersOnly() {
456		return conversation.getBooleanAttribute(Conversation.ATTRIBUTE_MEMBERS_ONLY, false);
457	}
458
459	public boolean mamSupport() {
460		return hasFeature(Namespace.MAM) || hasFeature(Namespace.MAM_LEGACY);
461	}
462
463	public boolean mamLegacy() {
464		return hasFeature(Namespace.MAM_LEGACY) && !hasFeature(Namespace.MAM);
465	}
466
467	public boolean nonanonymous() {
468		return conversation.getBooleanAttribute(Conversation.ATTRIBUTE_NON_ANONYMOUS, false);
469	}
470
471	public boolean isPrivateAndNonAnonymous() {
472		return membersOnly() && nonanonymous();
473	}
474
475	public boolean moderated() {
476		return conversation.getBooleanAttribute(Conversation.ATTRIBUTE_MODERATED, false);
477	}
478
479	public User deleteUser(Jid jid) {
480		User user = findUserByFullJid(jid);
481		if (user != null) {
482			synchronized (users) {
483				users.remove(user);
484				boolean realJidInMuc = false;
485				for (User u : users) {
486					if (user.realJid != null && user.realJid.equals(u.realJid)) {
487						realJidInMuc = true;
488						break;
489					}
490				}
491				boolean self = user.realJid != null && user.realJid.equals(account.getJid().asBareJid());
492				if (membersOnly()
493						&& nonanonymous()
494						&& user.affiliation.ranks(Affiliation.MEMBER)
495						&& user.realJid != null
496						&& !realJidInMuc
497						&& !self) {
498					user.role = Role.NONE;
499					user.avatar = null;
500					user.fullJid = null;
501					users.add(user);
502				}
503			}
504		}
505		return user;
506	}
507
508	//returns true if real jid was new;
509	public boolean updateUser(User user) {
510		User old;
511		boolean realJidFound = false;
512		if (user.fullJid == null && user.realJid != null) {
513			old = findUserByRealJid(user.realJid);
514			realJidFound = old != null;
515			if (old != null) {
516				if (old.fullJid != null) {
517					return false; //don't add. user already exists
518				} else {
519					synchronized (users) {
520						users.remove(old);
521					}
522				}
523			}
524		} else if (user.realJid != null) {
525			old = findUserByRealJid(user.realJid);
526			realJidFound = old != null;
527			synchronized (users) {
528				if (old != null && old.fullJid == null) {
529					users.remove(old);
530				}
531			}
532		}
533		old = findUserByFullJid(user.getFullJid());
534		synchronized (this.users) {
535			if (old != null) {
536				users.remove(old);
537			}
538			boolean fullJidIsSelf = isOnline && user.getFullJid() != null && user.getFullJid().equals(self.getFullJid());
539			if ((!membersOnly() || user.getAffiliation().ranks(Affiliation.MEMBER))
540					&& user.getAffiliation().outranks(Affiliation.OUTCAST)
541					&& !fullJidIsSelf) {
542				this.users.add(user);
543				return !realJidFound && user.realJid != null;
544			}
545		}
546		return false;
547	}
548
549	public User findUserByFullJid(Jid jid) {
550		if (jid == null) {
551			return null;
552		}
553		synchronized (users) {
554			for (User user : users) {
555				if (jid.equals(user.getFullJid())) {
556					return user;
557				}
558			}
559		}
560		return null;
561	}
562
563	public User findUserByRealJid(Jid jid) {
564		if (jid == null) {
565			return null;
566		}
567		synchronized (users) {
568			for (User user : users) {
569				if (jid.equals(user.realJid)) {
570					return user;
571				}
572			}
573		}
574		return null;
575	}
576
577	public User findUser(ReadByMarker readByMarker) {
578		if (readByMarker.getRealJid() != null) {
579			User user = findUserByRealJid(readByMarker.getRealJid().asBareJid());
580			if (user == null) {
581				user = new User(this, readByMarker.getFullJid());
582				user.setRealJid(readByMarker.getRealJid());
583			}
584			return user;
585		} else if (readByMarker.getFullJid() != null) {
586			return findUserByFullJid(readByMarker.getFullJid());
587		} else {
588			return null;
589		}
590	}
591
592	public boolean isContactInRoom(Contact contact) {
593		return findUserByRealJid(contact.getJid().asBareJid()) != null;
594	}
595
596	public boolean isUserInRoom(Jid jid) {
597		return findUserByFullJid(jid) != null;
598	}
599
600	public void setError(Error error) {
601		this.isOnline = isOnline && error == Error.NONE;
602		this.error = error;
603	}
604
605	public boolean setOnline() {
606		boolean before = this.isOnline;
607		this.isOnline = true;
608		return !before;
609	}
610
611	public ArrayList<User> getUsers() {
612		return getUsers(true);
613	}
614
615	public ArrayList<User> getUsers(boolean includeOffline) {
616		synchronized (users) {
617				ArrayList<User> users = new ArrayList<>();
618				for (User user : this.users) {
619					if (!user.isDomain() && (includeOffline || user.getRole().ranks(Role.PARTICIPANT))) {
620						users.add(user);
621					}
622				}
623				return users;
624		}
625	}
626
627	public ArrayList<User> getUsersWithChatState(ChatState state, int max) {
628		synchronized (users) {
629			ArrayList<User> list = new ArrayList<>();
630			for (User user : users) {
631				if (user.chatState == state) {
632					list.add(user);
633					if (list.size() >= max) {
634						break;
635					}
636				}
637			}
638			return list;
639		}
640	}
641
642	public List<User> getUsers(int max) {
643		ArrayList<User> subset = new ArrayList<>();
644		HashSet<Jid> jids = new HashSet<>();
645		jids.add(account.getJid().asBareJid());
646		synchronized (users) {
647			for (User user : users) {
648				if (user.getRealJid() == null || (user.getRealJid().getLocal() != null && jids.add(user.getRealJid()))) {
649					subset.add(user);
650				}
651				if (subset.size() >= max) {
652					break;
653				}
654			}
655		}
656		return subset;
657	}
658
659	public int getUserCount() {
660		synchronized (users) {
661			return users.size();
662		}
663	}
664
665	private String getProposedNick() {
666		if (conversation.getBookmark() != null
667				&& conversation.getBookmark().getNick() != null
668				&& !conversation.getBookmark().getNick().trim().isEmpty()) {
669			return conversation.getBookmark().getNick().trim();
670		} else if (!conversation.getJid().isBareJid()) {
671			return conversation.getJid().getResource();
672		} else {
673			return JidHelper.localPartOrFallback(account.getJid());
674		}
675	}
676
677	public String getActualNick() {
678		if (this.self.getName() != null) {
679			return this.self.getName();
680		} else {
681			return this.getProposedNick();
682		}
683	}
684
685	public boolean online() {
686		return this.isOnline;
687	}
688
689	public Error getError() {
690		return this.error;
691	}
692
693	public void setOnRenameListener(OnRenameListener listener) {
694		this.onRenameListener = listener;
695	}
696
697	public void setOffline() {
698		synchronized (users) {
699			this.users.clear();
700		}
701		this.error = Error.NO_RESPONSE;
702		this.isOnline = false;
703	}
704
705	public User getSelf() {
706		return self;
707	}
708
709	public boolean setSubject(String subject) {
710		return this.conversation.setAttribute("subject", subject);
711	}
712
713	public String getSubject() {
714		return this.conversation.getAttribute("subject");
715	}
716
717	public String getName() {
718		String mucName = this.conversation.getAttribute("muc_name");
719		return conversation.getJid().getEscapedLocal().equals(mucName) ? null : mucName;
720	}
721
722	private List<User> getFallbackUsersFromCryptoTargets() {
723		List<User> users = new ArrayList<>();
724		for (Jid jid : conversation.getAcceptedCryptoTargets()) {
725			User user = new User(this, null);
726			user.setRealJid(jid);
727			users.add(user);
728		}
729		return users;
730	}
731
732	public List<User> getUsersRelevantForNameAndAvatar() {
733		final List<User> users;
734		if (isOnline) {
735			users = getUsers(5);
736		} else {
737			users = getFallbackUsersFromCryptoTargets();
738		}
739		return users;
740	}
741
742	public String createNameFromParticipants() {
743		List<User> users = getUsersRelevantForNameAndAvatar();
744		if (users.size() >= 2) {
745			StringBuilder builder = new StringBuilder();
746			for (User user : users) {
747				if (builder.length() != 0) {
748					builder.append(", ");
749				}
750				String name = UIHelper.getDisplayName(user);
751				if (name != null) {
752					builder.append(name.split("\\s+")[0]);
753				}
754			}
755			return builder.toString();
756		} else {
757			return null;
758		}
759	}
760
761	public long[] getPgpKeyIds() {
762		List<Long> ids = new ArrayList<>();
763		for (User user : this.users) {
764			if (user.getPgpKeyId() != 0) {
765				ids.add(user.getPgpKeyId());
766			}
767		}
768		ids.add(account.getPgpId());
769		long[] primitiveLongArray = new long[ids.size()];
770		for (int i = 0; i < ids.size(); ++i) {
771			primitiveLongArray[i] = ids.get(i);
772		}
773		return primitiveLongArray;
774	}
775
776	public boolean pgpKeysInUse() {
777		synchronized (users) {
778			for (User user : users) {
779				if (user.getPgpKeyId() != 0) {
780					return true;
781				}
782			}
783		}
784		return false;
785	}
786
787	public boolean everybodyHasKeys() {
788		synchronized (users) {
789			for (User user : users) {
790				if (user.getPgpKeyId() == 0) {
791					return false;
792				}
793			}
794		}
795		return true;
796	}
797
798	public Jid createJoinJid(String nick) {
799		try {
800			return Jid.of(this.conversation.getJid().asBareJid().toString() + "/" + nick);
801		} catch (final IllegalArgumentException e) {
802			return null;
803		}
804	}
805
806	public Jid getTrueCounterpart(Jid jid) {
807		if (jid.equals(getSelf().getFullJid())) {
808			return account.getJid().asBareJid();
809		}
810		User user = findUserByFullJid(jid);
811		return user == null ? null : user.realJid;
812	}
813
814	public String getPassword() {
815		this.password = conversation.getAttribute(Conversation.ATTRIBUTE_MUC_PASSWORD);
816		if (this.password == null && conversation.getBookmark() != null
817				&& conversation.getBookmark().getPassword() != null) {
818			return conversation.getBookmark().getPassword();
819		} else {
820			return this.password;
821		}
822	}
823
824	public void setPassword(String password) {
825		if (conversation.getBookmark() != null) {
826			conversation.getBookmark().setPassword(password);
827		} else {
828			this.password = password;
829		}
830		conversation.setAttribute(Conversation.ATTRIBUTE_MUC_PASSWORD, password);
831	}
832
833	public Conversation getConversation() {
834		return this.conversation;
835	}
836
837	public List<Jid> getMembers(final boolean includeDomains) {
838		ArrayList<Jid> members = new ArrayList<>();
839		synchronized (users) {
840			for (User user : users) {
841				if (user.affiliation.ranks(Affiliation.MEMBER) && user.realJid != null && (!user.isDomain() || includeDomains)) {
842					members.add(user.realJid);
843				}
844			}
845		}
846		return members;
847	}
848}