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


Java Form.getFormFrom方法代码示例

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


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

示例1: getItemsToSearch

import org.jivesoftware.smackx.xdata.Form; //导入方法依赖的package包/类
private String getItemsToSearch() {
    StringBuilder buf = new StringBuilder();

    if (form == null) {
        form = Form.getFormFrom(this);
    }

    if (form == null) {
        return "";
    }

    for (FormField field : form.getFields()) {
        String name = field.getVariable();
        String value = getSingleValue(field);
        if (value.trim().length() > 0) {
            buf.append("<").append(name).append(">").append(value).append("</").append(name).append(">");
        }
    }

    return buf.toString();
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:22,代码来源:SimpleUserSearch.java

示例2: getMessageCount

import org.jivesoftware.smackx.xdata.Form; //导入方法依赖的package包/类
/**
 * Returns the number of offline messages for the user of the connection.
 *
 * @return the number of offline messages for the user of the connection.
 * @throws XMPPErrorException If the user is not allowed to make this request or the server does
 *                       not support offline message retrieval.
 * @throws NoResponseException if there was no response from the server.
 * @throws NotConnectedException 
 */
public int getMessageCount() throws NoResponseException, XMPPErrorException, NotConnectedException {
    DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(null,
            namespace);
    Form extendedInfo = Form.getFormFrom(info);
    if (extendedInfo != null) {
        String value = extendedInfo.getField("number_of_messages").getValues().get(0);
        return Integer.parseInt(value);
    }
    return 0;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:20,代码来源:OfflineMessageManager.java

示例3: getSearchForm

import org.jivesoftware.smackx.xdata.Form; //导入方法依赖的package包/类
/**
 * Returns the Form to use for searching transcripts. It is unlikely that the server
 * will change the form (without a restart) so it is safe to keep the returned form
 * for future submissions.
 *
 * @param serviceJID the address of the workgroup service.
 * @return the Form to use for searching transcripts.
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public Form getSearchForm(String serviceJID) throws NoResponseException, XMPPErrorException, NotConnectedException  {
    TranscriptSearch search = new TranscriptSearch();
    search.setType(IQ.Type.get);
    search.setTo(serviceJID);

    TranscriptSearch response = (TranscriptSearch) connection.createPacketCollectorAndSend(
                    search).nextResultOrThrow();
    return Form.getFormFrom(response);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:21,代码来源:TranscriptSearchManager.java

示例4: getWorkgroupForm

import org.jivesoftware.smackx.xdata.Form; //导入方法依赖的package包/类
/**
 * Returns the Form to use for all clients of a workgroup. It is unlikely that the server
 * will change the form (without a restart) so it is safe to keep the returned form
 * for future submissions.
 *
 * @return the Form to use for searching transcripts.
 * @throws XMPPErrorException
 * @throws NoResponseException
 * @throws NotConnectedException 
 */
public Form getWorkgroupForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
    WorkgroupForm workgroupForm = new WorkgroupForm();
    workgroupForm.setType(IQ.Type.get);
    workgroupForm.setTo(workgroupJID);

    WorkgroupForm response = (WorkgroupForm) connection.createPacketCollectorAndSend(
                    workgroupForm).nextResultOrThrow();
    return Form.getFormFrom(response);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:20,代码来源:Workgroup.java

示例5: getConfigurationForm

import org.jivesoftware.smackx.xdata.Form; //导入方法依赖的package包/类
/**
 * Returns the room's configuration form that the room's owner can use or <tt>null</tt> if
 * no configuration is possible. The configuration form allows to set the room's language,
 * enable logging, specify room's type, etc..
 *
 * @return the Form that contains the fields to complete together with the instrucions or
 * <tt>null</tt> if no configuration is possible.
 * @throws XMPPErrorException if an error occurs asking the configuration form for the room.
 * @throws NoResponseException if there was no response from the server.
 * @throws NotConnectedException 
 */
public Form getConfigurationForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
    MUCOwner iq = new MUCOwner();
    iq.setTo(room);
    iq.setType(IQ.Type.get);

    IQ answer = connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
    return Form.getFormFrom(answer);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:20,代码来源:MultiUserChat.java

示例6: getRegistrationForm

import org.jivesoftware.smackx.xdata.Form; //导入方法依赖的package包/类
/**
 * Returns the room's registration form that an unaffiliated user, can use to become a member
 * of the room or <tt>null</tt> if no registration is possible. Some rooms may restrict the
 * privilege to register members and allow only room admins to add new members.<p>
 *
 * If the user requesting registration requirements is not allowed to register with the room
 * (e.g. because that privilege has been restricted), the room will return a "Not Allowed"
 * error to the user (error code 405).
 *
 * @return the registration Form that contains the fields to complete together with the
 * instrucions or <tt>null</tt> if no registration is possible.
 * @throws XMPPErrorException if an error occurs asking the registration form for the room or a
 * 405 error if the user is not allowed to register with the room.
 * @throws NoResponseException if there was no response from the server.
 * @throws NotConnectedException 
 */
public Form getRegistrationForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
    Registration reg = new Registration();
    reg.setType(IQ.Type.get);
    reg.setTo(room);

    IQ result = connection.createPacketCollectorAndSend(reg).nextResultOrThrow();
    return Form.getFormFrom(result);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:25,代码来源:MultiUserChat.java

示例7: getSearchForm

import org.jivesoftware.smackx.xdata.Form; //导入方法依赖的package包/类
/**
 * Returns the form for all search fields supported by the search service.
 *
 * @param con           the current XMPPConnection.
 * @param searchService the search service to use. (ex. search.jivesoftware.com)
 * @return the search form received by the server.
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public Form getSearchForm(XMPPConnection con, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
    UserSearch search = new UserSearch();
    search.setType(IQ.Type.get);
    search.setTo(searchService);

    IQ response = (IQ) con.createPacketCollectorAndSend(search).nextResultOrThrow();
    return Form.getFormFrom(response);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:19,代码来源:UserSearch.java


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