本文整理汇总了Java中org.jivesoftware.smackx.muc.MultiUserChat.getOwners方法的典型用法代码示例。如果您正苦于以下问题:Java MultiUserChat.getOwners方法的具体用法?Java MultiUserChat.getOwners怎么用?Java MultiUserChat.getOwners使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.muc.MultiUserChat
的用法示例。
在下文中一共展示了MultiUserChat.getOwners方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: amIOwner
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
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;
}
示例2: removeOwner
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
/**
* 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);
}
}
}
}
示例3: removeOwner
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
/**
* 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);
}
}
}
}