当前位置: 首页>>代码示例>>Java>>正文


Java MultiUserChat.sendConfigurationForm方法代码示例

本文整理汇总了Java中org.jivesoftware.smackx.muc.MultiUserChat.sendConfigurationForm方法的典型用法代码示例。如果您正苦于以下问题:Java MultiUserChat.sendConfigurationForm方法的具体用法?Java MultiUserChat.sendConfigurationForm怎么用?Java MultiUserChat.sendConfigurationForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.smackx.muc.MultiUserChat的用法示例。


在下文中一共展示了MultiUserChat.sendConfigurationForm方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
public void init() throws XMPPException {
  new TrackRooms().addTo(conn);
  new TrackStatus(getMonitorRoomJID().toLowerCase()).addTo(conn);
  new ListenForChat().addTo(conn);
  monitorRoom = new MultiUserChat(conn, getMonitorRoomJID());
  monitorRoom.addMessageListener(this);
  monitorRoom.addParticipantStatusListener(this);
  monitorRoom.join(StringUtils.parseName(conn.getUser()));
  try {
    // This is necessary to create the room if it doesn't already exist
    monitorRoom.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
  }
  catch (XMPPException ex) {
    // 403 code means the room already exists and user is not an owner
    if (ex.getXMPPError().getCode() != 403) {
      throw ex;
    }
  }
  sendStatus(me);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:21,代码来源:JabberClient.java

示例2: createConferenceRoom

import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
/**
 * Creates a new public Conference Room.
 *
 * @param roomName    the name of the room.
 * @param serviceName the service name to use (ex.conference.jivesoftware.com)
 * @return the new ChatRoom created. If an error occured, null will be returned.
 */
public ChatRoom createConferenceRoom(String roomName, String serviceName) {
    final MultiUserChat chatRoom = new MultiUserChat(SparkManager.getConnection(), roomName + "@" + serviceName);

    final GroupChatRoom room = UIComponentRegistry.createGroupChatRoom(chatRoom);

    try {
        LocalPreferences pref = SettingsManager.getLocalPreferences();
        chatRoom.create(pref.getNickname());

        // Send an empty room configuration form which indicates that we want
        // an instant room
        chatRoom.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
    }
    catch (XMPPException e1) {
        Log.error("Unable to send conference room chat configuration form.", e1);
        return null;
    }

    getChatContainer().addChatRoom(room);
    return room;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:29,代码来源:ChatManager.java

示例3: join

import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
public MultiUserChat join(JabberClient client, JabberPlayer me) throws XMPPException {
  MultiUserChat chat = new MultiUserChat(client.getConnection(), getJID());
  chat.join(StringUtils.parseName(me.getJid()));

  if (!chat.isJoined()) {
    return null;
  }

  try {
    // This is necessary to create the room if it doesn't already exist
    // Configure the options we needs explicitly, don't depend on the server supplied defaults
    final Form configForm = chat.getConfigurationForm().createAnswerForm();
    configForm.setAnswer(JABBER_MEMBERSONLY, isStartLocked());
    configForm.setAnswer(JABBER_ALLOW_INVITES, false);
    configForm.setAnswer(JABBER_CHANGE_SUBJECT, false);
    configForm.setAnswer(JABBER_MODERATED, false);
    configForm.setAnswer(JABBER_PASSWORD_PROTECTED, false);
    configForm.setAnswer(JABBER_PERSISTENT, false);
    configForm.setAnswer(JABBER_PUBLIC_ROOM, true);

    chat.sendConfigurationForm(configForm);
    ownedByMe = true;
    owners.clear();
    addOwner(jid);
  }
  catch (XMPPException e) {
    // 403 code means the room already exists and user is not an owner
    if (e.getXMPPError() != null && e.getXMPPError().getCode() != 403) {
      throw e;
    }
  }

  chat.addMessageListener(client);
  return chat;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:36,代码来源:JabberRoom.java

示例4: newMultiUserChat

import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
private void newMultiUserChat(MultiUserChat muc, String nickname, String password) throws XMPPException {
	muc.create(nickname != null ? nickname : getInternalService().getOnlineInfo().getProtocolUid());
	
	Form form = muc.getConfigurationForm();
	Form submitForm = form.createAnswerForm();
	for (Iterator<FormField> fields = form.getFields(); fields.hasNext();) {
		FormField field = fields.next();
		Logger.log("Chat "+ muc.getRoom() + " form field "+field.getVariable());
		if (!FormField.TYPE_HIDDEN.equals(field.getType()) && field.getVariable() != null) {
			submitForm.setDefaultAnswer(field.getVariable());
		}
	}
	try {
		List<String> owners = new ArrayList<String>();
		owners.add(getInternalService().getService().getProtocolUid());
		submitForm.setAnswer("muc#roomconfig_roomowners", owners);
	} catch (Exception e) {
		Logger.log("Could not set XMPP muc room owners for " + muc.getRoom());
	}

	if (password != null) {
		submitForm.setAnswer("muc#roomconfig_roomsecret", password);
		submitForm.setAnswer("muc#roomconfig_publicroom", false);
		submitForm.setAnswer("muc#roomconfig_passwordprotectedroom", true);
	}

	muc.sendConfigurationForm(submitForm);
}
 
开发者ID:snuk182,项目名称:aceim,代码行数:29,代码来源:XMPPChatListener.java

示例5: 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);
            }
        }
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:45,代码来源:UserInvitationPane.java

示例6: 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);
            }
        }
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:45,代码来源:InvitationPane.java

示例7: lock

import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
protected void lock(MultiUserChat muc) throws XMPPException {
  final Form form = muc.getConfigurationForm().createAnswerForm();
  form.setAnswer(JABBER_MEMBERSONLY, true);
  muc.sendConfigurationForm(form);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:6,代码来源:JabberRoom.java

示例8: unlock

import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
protected void unlock(MultiUserChat muc) throws XMPPException {
  final Form form = muc.getConfigurationForm().createAnswerForm();
  form.setAnswer(JABBER_MEMBERSONLY, false);
  muc.sendConfigurationForm(form);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:6,代码来源:JabberRoom.java

示例9: createRoom

import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
/**
 * ����������
 * 
 * @param roomName
 * @param roomPwd
 *            ����������
 */
public MultiUserChat createRoom(String roomName, String roomPwd, String subject) {
	MultiUserChat multiUserChat = new MultiUserChat(connection, roomName
			+ CONFERENCE + connection.getServiceName());
	try {
		multiUserChat.create(roomName);
		Form configForm = multiUserChat.getConfigurationForm();
		Form submitForm = configForm.createAnswerForm();
		for (Iterator<FormField> fields = configForm.getFields(); fields
				.hasNext();) {
			FormField formField = fields.next();
			if (!formField.getType().equals(FormField.TYPE_HIDDEN)
					&& formField.getVariable() != null) {
				submitForm.setDefaultAnswer(formField.getVariable());
			}
		}

		List<String> owners = new ArrayList<String>();
		owners.add(connection.getUser());
		//submitForm.setAnswer("muc#roomconfig_roomowners", owners);
		submitForm.setAnswer("muc#roomconfig_passwordprotectedroom", true);
		// �����������dz־������ң�����Ҫ����������
		submitForm.setAnswer("muc#roomconfig_persistentroom", true);
		// ������Գ�Ա����
		submitForm.setAnswer("muc#roomconfig_membersonly", false);
		// ����ռ��������������
		submitForm.setAnswer("muc#roomconfig_allowinvites", true);
		// �������ij�Ա��
		submitForm.setAnswer("muc#roomconfig_maxusers", Arrays.asList("30"));
		// �ܹ�����ռ������ʵ JID �Ľ�ɫ
		// submitForm.setAnswer("muc#roomconfig_whois", "anyone");
		// ��¼����Ի�
		submitForm.setAnswer("muc#roomconfig_enablelogging", true);
		// ������ע����dzƵ�¼
		submitForm.setAnswer("x-muc#roomconfig_reservednick", true);
		// ����ʹ�����޸��dz�
		submitForm.setAnswer("x-muc#roomconfig_canchangenick", false);
		// �����û�ע�᷿��
		submitForm.setAnswer("x-muc#roomconfig_registration", false);
		// ���ý�������
		submitForm.setAnswer("muc#roomconfig_roomsecret", roomPwd);
		submitForm.setAnswer("muc#roomconfig_roomdesc", subject);
		multiUserChat.sendConfigurationForm(submitForm);

	} catch (XMPPException e) {
		SLog.e(tag, "���������� ����");
		SLog.e(tag, Log.getStackTraceString(e));
		e.getStackTrace();
	}
	return multiUserChat;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:58,代码来源:XmppConnectionManager.java

示例10: createRoom

import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
/**
    * Create a new room based on room table selection.
    */
   private void createRoom() {
RoomCreationDialog mucRoomDialog = new RoomCreationDialog();
final MultiUserChat groupChat = mucRoomDialog.createGroupChat(
	SparkManager.getMainWindow(), serviceName);
LocalPreferences pref = SettingsManager.getLocalPreferences();

if (null != groupChat) {

    // Join Room
    try {
	GroupChatRoom room = UIComponentRegistry.createGroupChatRoom(groupChat);

	groupChat.create(pref.getNickname());
	chatManager.getChatContainer().addChatRoom(room);
	chatManager.getChatContainer().activateChatRoom(room);

	// Send Form
	Form form = groupChat.getConfigurationForm().createAnswerForm();
	if (mucRoomDialog.isPasswordProtected()) {
	    String password = mucRoomDialog.getPassword();
	    room.setPassword(password);
	    form.setAnswer("muc#roomconfig_passwordprotectedroom", true);
	    form.setAnswer("muc#roomconfig_roomsecret", password);
	}
	form.setAnswer("muc#roomconfig_roomname",
		mucRoomDialog.getRoomName());
	form.setAnswer("muc#roomconfig_roomdesc",
		mucRoomDialog.getRoomTopic());

	if (mucRoomDialog.isPermanent()) {
	    form.setAnswer("muc#roomconfig_persistentroom", true);
	}

	List<String> owners = new ArrayList<String>();
	owners.add(SparkManager.getSessionManager().getBareAddress());
	form.setAnswer("muc#roomconfig_roomowners", owners);

	// new DataFormDialog(groupChat, form);
	groupChat.sendConfigurationForm(form);
       addRoomToTable(groupChat.getRoom(), StringUtils.parseName(groupChat.getRoom()), 1);
    } catch (XMPPException e1) {
	Log.error("Error creating new room.", e1);
	JOptionPane
		.showMessageDialog(this,
			Res.getString("message.room.creation.error"),
			Res.getString("title.error"),
			JOptionPane.ERROR_MESSAGE);
    }
}
   }
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:54,代码来源:ConferenceRoomBrowser.java


注:本文中的org.jivesoftware.smackx.muc.MultiUserChat.sendConfigurationForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。