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


Java Form.TYPE_SUBMIT属性代码示例

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


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

示例1: createRegistrationForm

private Packet createRegistrationForm() {
    Registration iq = new Registration();
    iq.setType(IQ.Type.SET);
    iq.setTo(mConnector.getConnection().getServiceName());
    Form form = new Form(Form.TYPE_SUBMIT);

    FormField type = new FormField("FORM_TYPE");
    type.setType(FormField.TYPE_HIDDEN);
    type.addValue("jabber:iq:register");
    form.addField(type);

    FormField phone = new FormField("phone");
    phone.setLabel("Phone number");
    phone.setType(FormField.TYPE_TEXT_SINGLE);
    phone.addValue(mPhone);
    form.addField(phone);

    iq.addExtension(form.getDataFormToSend());
    return iq;
}
 
开发者ID:ShadiNachat,项目名称:Chatting-App-,代码行数:20,代码来源:NumberValidator.java

示例2: prepareKeyPacket

private Packet prepareKeyPacket() {
    if (mKeyRing != null) {
        try {
            String publicKey = Base64.encodeToString(mKeyRing.publicKey.getEncoded(), Base64.NO_WRAP);

            Registration iq = new Registration();
            iq.setType(IQ.Type.SET);
            iq.setTo(getConnection().getServiceName());
            Form form = new Form(Form.TYPE_SUBMIT);

            // form type: register#key
            FormField type = new FormField("FORM_TYPE");
            type.setType(FormField.TYPE_HIDDEN);
            type.addValue("http://kontalk.org/protocol/register#key");
            form.addField(type);

            // new (to-be-signed) public key
            FormField fieldKey = new FormField("publickey");
            fieldKey.setLabel("Public key");
            fieldKey.setType(FormField.TYPE_TEXT_SINGLE);
            fieldKey.addValue(publicKey);
            form.addField(fieldKey);

            // old (revoked) public key
            if (mRevoked != null) {
                String revokedKey = Base64.encodeToString(mRevoked.getEncoded(), Base64.NO_WRAP);

                FormField fieldRevoked = new FormField("revoked");
                fieldRevoked.setLabel("Revoked public key");
                fieldRevoked.setType(FormField.TYPE_TEXT_SINGLE);
                fieldRevoked.addValue(revokedKey);
                form.addField(fieldRevoked);
            }

            iq.addExtension(form.getDataFormToSend());
            return iq;
        }
        catch (IOException e) {
            Log.v(MessageCenterService.TAG, "error encoding key", e);
        }
    }

    return null;
}
 
开发者ID:ShadiNachat,项目名称:Chatting-App-,代码行数:44,代码来源:RegisterKeyPairListener.java

示例3: createValidationForm

private Packet createValidationForm() {
    Registration iq = new Registration();
    iq.setType(IQ.Type.SET);
    iq.setTo(mConnector.getConnection().getServiceName());
    Form form = new Form(Form.TYPE_SUBMIT);

    FormField type = new FormField("FORM_TYPE");
    type.setType(FormField.TYPE_HIDDEN);
    type.addValue("http://kontalk.org/protocol/register#code");
    form.addField(type);

    FormField code = new FormField("code");
    code.setLabel("Validation code");
    code.setType(FormField.TYPE_TEXT_SINGLE);
    code.addValue(mValidationCode.toString());
    form.addField(code);

    if (mKey != null || (mImportedPrivateKey != null && mImportedPublicKey != null)) {
        String publicKey;
        try {
            if (mKey != null) {
                String userId = MessageUtils.sha1(mPhone);
                // TODO what in name and comment fields here?
                mKeyRing = mKey.storeNetwork(userId, mServer.getNetwork(),
                    mName, mPassphrase);
            }
            else {
                mKeyRing = PGPKeyPairRing.load(mImportedPrivateKey, mImportedPublicKey);
            }

            publicKey = Base64.encodeToString(mKeyRing.publicKey.getEncoded(), Base64.NO_WRAP);
        }
        catch (Exception e) {
            // TODO
            Log.v(TAG, "error saving key", e);
            publicKey = null;
        }

        if (publicKey != null) {
            FormField key = new FormField("publickey");
            key.setLabel("Public key");
            key.setType(FormField.TYPE_TEXT_SINGLE);
            key.addValue(publicKey);
            form.addField(key);
        }
    }

    iq.addExtension(form.getDataFormToSend());
    return iq;
}
 
开发者ID:ShadiNachat,项目名称:Chatting-App-,代码行数:50,代码来源:NumberValidator.java


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