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


Java XMPPError.Condition方法代码示例

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


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

示例1: failed

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
public static Failed failed(XmlPullParser parser) throws XmlPullParserException, IOException {
    ParserUtils.assertAtStartTag(parser);
    String name;
    XMPPError.Condition condition = null;
    outerloop:
    while(true) {
        int event = parser.next();
        switch (event) {
        case XmlPullParser.START_TAG:
            name = parser.getName();
            String namespace = parser.getNamespace();
            if (XMPPError.NAMESPACE.equals(namespace)) {
                condition = XMPPError.Condition.fromString(name);
            }
            break;
        case XmlPullParser.END_TAG:
            name = parser.getName();
            if (Failed.ELEMENT.equals(name)) {
                break outerloop;
            }
            break;
        }
    }
    ParserUtils.assertAtEndTag(parser);
    return new Failed(condition);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:27,代码来源:ParseStreamManagement.java

示例2: testParseFailedError

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
@Test
public void testParseFailedError() throws Exception {
    XMPPError.Condition errorCondition = XMPPError.Condition.unexpected_request;

    String failedStanza = XMLBuilder.create("failed")
            .a("xmlns", "urn:xmpp:sm:3")
            .element(errorCondition.toString(), XMPPError.NAMESPACE)
            .asString(outputProperties);

    System.err.println(failedStanza);

    StreamManagement.Failed failedPacket = ParseStreamManagement.failed(
            PacketParserUtils.getParserFor(failedStanza));

    assertThat(failedPacket, is(notNullValue()));
    assertTrue(failedPacket.getXMPPErrorCondition() == errorCondition);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:18,代码来源:ParseStreamManagementTest.java

示例3: resolveRoom

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
public String resolveRoom(XMPPConnection connection) throws XMPPException, SmackException {
    ObjectHelper.notEmpty(room, "room");

    if (room.indexOf('@', 0) != -1) {
        return room;
    }

    Iterator<String> iterator = MultiUserChat.getServiceNames(connection).iterator();
    if (!iterator.hasNext()) {
        throw new XMPPErrorException("Cannot find Multi User Chat service",
                                     new XMPPError(new XMPPError.Condition("Cannot find Multi User Chat service on connection: " + getConnectionMessage(connection))));
    }

    String chatServer = iterator.next();
    LOG.debug("Detected chat server: {}", chatServer);

    return room + "@" + chatServer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:XmppEndpoint.java

示例4: testUserDefinedErrorWithCommentCreation

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
/**
 * Check the creation of a new xmppError locally where there is not a default defined.
*/
public void testUserDefinedErrorWithCommentCreation() {
    String message = "Error Message";
    XMPPError error = new XMPPError(new XMPPError.Condition("my_own_error"), message);
    error.toXML();

    assertEquals(error.getCondition(), "my_own_error");
    assertEquals(error.getCode(), 0);
    assertNull(error.getType());
    assertEquals(error.getMessage(), message);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:14,代码来源:XMPPErrorTest.java

示例5: respondError

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
/**
 * Responds an error with an specific condition.
 * 
 * @param response the response to send.
 * @param condition the condition of the error.
 * @param specificCondition the adhoc command error condition.
 */
private void respondError(AdHocCommandData response, XMPPError.Condition condition,
        AdHocCommand.SpecificErrorCondition specificCondition)
{
    XMPPError error = new XMPPError(condition);
    error.addExtension(new AdHocCommandData.SpecificError(specificCondition));
    respondError(response, error);
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:15,代码来源:AdHocCommandManager.java

示例6: finish

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
private void finish(String token, String from, XMPPError.Condition errorCondition) {
    Intent i = new Intent(ACTION_UPLOAD_PRIVATEKEY);
    if (token != null) {
        i.putExtra(MessageCenterService.EXTRA_TOKEN, token);
        i.putExtra(MessageCenterService.EXTRA_FROM, from);
    }
    if (errorCondition != null)
        i.putExtra(MessageCenterService.EXTRA_ERROR_CONDITION, errorCondition.toString());
    sendBroadcast(i);

    unconfigure();
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:13,代码来源:PrivateKeyUploadListener.java

示例7: onPresenceError

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
public void onPresenceError(JID jid, XMPPError.Type type, XMPPError.Condition condition) {
    if (type != XMPPError.Type.CANCEL)
        // it can't be that bad)
        return;

    Error error = null;
    switch (condition) {
        case remote_server_not_found:
            error = Error.SERVER_NOT_FOUND;
    }
    if (error == null) {
        LOGGER.warning("unhandled error condition: "+condition);
        return;
    }

    Contact contact = mModel.contacts().get(jid).orElse(null);
    if (contact == null) {
        LOGGER.info("can't find contact with jid: "+jid);
        return;
    }

    if (contact.getOnline() == Contact.Online.ERROR)
        // we already know this
        return;

    contact.setOnlineStatus(Contact.Online.ERROR);

    mControl.getViewControl().changed(new ViewEvent.PresenceError(contact, error));
}
 
开发者ID:kontalk,项目名称:desktopclient-java,代码行数:30,代码来源:RosterHandler.java

示例8: Failed

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
public Failed(XMPPError.Condition condition) {
    this.condition = condition;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:4,代码来源:StreamManagement.java

示例9: getXMPPErrorCondition

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
public XMPPError.Condition getXMPPErrorCondition() {
    return condition;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:4,代码来源:StreamManagement.java

示例10: parseError

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
/**
 * Parses error sub-packets.
 *
 * @param parser the XML parser.
 * @return an error sub-packet.
 * @throws IOException 
 * @throws XmlPullParserException 
 * @throws SmackException 
 */
public static XMPPError parseError(XmlPullParser parser)
                throws XmlPullParserException, IOException, SmackException {
    final int initialDepth = parser.getDepth();
    Map<String, String> descriptiveTexts = null;
    XMPPError.Condition condition = null;
    String conditionText = null;
    List<ExtensionElement> extensions = new ArrayList<ExtensionElement>();

    // Parse the error header
    XMPPError.Type errorType = XMPPError.Type.fromString(parser.getAttributeValue("", "type"));
    String errorGenerator = parser.getAttributeValue("", "by");

    outerloop: while (true) {
        int eventType = parser.next();
        switch (eventType) {
        case XmlPullParser.START_TAG:
            String name = parser.getName();
            String namespace = parser.getNamespace();
            switch (namespace) {
            case XMPPError.NAMESPACE:
                switch (name) {
                case Stanza.TEXT:
                    descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
                    break;
                default:
                    condition = XMPPError.Condition.fromString(name);
                    if (!parser.isEmptyElementTag()) {
                        conditionText = parser.nextText();
                    }
                    break;
                }
                break;
            default:
                PacketParserUtils.addExtensionElement(extensions, parser, name, namespace);
            }
            break;
        case XmlPullParser.END_TAG:
            if (parser.getDepth() == initialDepth) {
                break outerloop;
            }
        }
    }
    return new XMPPError(condition, conditionText, errorGenerator, errorType, descriptiveTexts, extensions);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:54,代码来源:PacketParserUtils.java

示例11: getErrorCondition

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
public static XMPPError.Condition getErrorCondition(Stanza packet) {
    return packet.getError() != null ? packet.getError().getCondition() : null;
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:4,代码来源:XMPPUtils.java

示例12: checkError

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
public static boolean checkError(Stanza packet, XMPPError.Condition condition) {
    return packet.getError() != null && packet.getError().getCondition() == condition;
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:4,代码来源:XMPPUtils.java

示例13: respondError

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
/**
 * Responds an error with an specific condition.
 * 
 * @param response the response to send.
 * @param condition the condition of the error.
 * @param specificCondition the adhoc command error condition.
 * @throws NotConnectedException 
 */
private static IQ respondError(AdHocCommandData response, XMPPError.Condition condition,
        AdHocCommand.SpecificErrorCondition specificCondition)
{
    XMPPError error = new XMPPError(condition, new AdHocCommandData.SpecificError(specificCondition));
    return respondError(response, error);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:15,代码来源:AdHocCommandManager.java

示例14: respondError

import org.jivesoftware.smack.packet.XMPPError; //导入方法依赖的package包/类
/**
 * Responds an error with an specific condition.
 * 
 * @param response
 *            the response to send.
 * @param condition
 *            the condition of the error.
 * @param specificCondition
 *            the adhoc command error condition.
 */
private void respondError(AdHocCommandData response,
		XMPPError.Condition condition,
		AdHocCommand.SpecificErrorCondition specificCondition) {
	XMPPError error = new XMPPError(condition);
	error.addExtension(new AdHocCommandData.SpecificError(specificCondition));
	respondError(response, error);
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:18,代码来源:AdHocCommandManager.java


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