Java 类org.jivesoftware.smackx.pubsub.Subscription 实例源码

项目:Smack    文件:SubscriptionProvider.java   
@Override
   public Subscription parse(XmlPullParser parser, int initialDepth)
                   throws XmlPullParserException, IOException {
    String jid = parser.getAttributeValue(null, "jid");
    String nodeId = parser.getAttributeValue(null, "node");
    String subId = parser.getAttributeValue(null, "subid");
    String state = parser.getAttributeValue(null, "subscription");
    boolean isRequired = false;

    int tag = parser.next();

    if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("subscribe-options"))
    {
        tag = parser.next();

        if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("required"))
            isRequired = true;

        while (tag != XmlPullParser.END_TAG && !parser.getName().equals("subscribe-options")) tag = parser.next();
    }
    while (parser.getEventType() != XmlPullParser.END_TAG) parser.next();
    return new Subscription(jid, nodeId, subId, (state == null ? null : Subscription.State.valueOf(state)), isRequired);
}
项目:EIM    文件:SubscriptionProvider.java   
public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
    String jid = parser.getAttributeValue(null, "jid");
    String nodeId = parser.getAttributeValue(null, "node");
    String subId = parser.getAttributeValue(null, "subid");
    String state = parser.getAttributeValue(null, "subscription");
    boolean isRequired = false;

    int tag = parser.next();

    if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("subscribe-options"))
    {
        tag = parser.next();

        if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("required"))
            isRequired = true;

        while (parser.next() != XmlPullParser.END_TAG && parser.getName() != "subscribe-options");
    }
    while (parser.getEventType() != XmlPullParser.END_TAG) parser.next();
    return new Subscription(jid, nodeId, subId, (state == null ? null : Subscription.State.valueOf(state)), isRequired);
}
项目:androidPN-client.    文件:SubscriptionProvider.java   
public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
    String jid = parser.getAttributeValue(null, "jid");
    String nodeId = parser.getAttributeValue(null, "node");
    String subId = parser.getAttributeValue(null, "subid");
    String state = parser.getAttributeValue(null, "subscription");
    boolean isRequired = false;

    int tag = parser.next();

    if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("subscribe-options"))
    {
        tag = parser.next();

        if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("required"))
            isRequired = true;

        while (parser.next() != XmlPullParser.END_TAG && parser.getName() != "subscribe-options");
    }
    while (parser.getEventType() != XmlPullParser.END_TAG) parser.next();
    return new Subscription(jid, nodeId, subId, (state == null ? null : Subscription.State.valueOf(state)), isRequired);
}
项目:java-bells    文件:SubscriptionProvider.java   
public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
    String jid = parser.getAttributeValue(null, "jid");
    String nodeId = parser.getAttributeValue(null, "node");
    String subId = parser.getAttributeValue(null, "subid");
    String state = parser.getAttributeValue(null, "subscription");
    boolean isRequired = false;

    int tag = parser.next();

    if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("subscribe-options"))
    {
        tag = parser.next();

        if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("required"))
            isRequired = true;

        while (parser.next() != XmlPullParser.END_TAG && parser.getName() != "subscribe-options");
    }
    while (parser.getEventType() != XmlPullParser.END_TAG) parser.next();
    return new Subscription(jid, nodeId, subId, (state == null ? null : Subscription.State.valueOf(state)), isRequired);
}
项目:telegraph    文件:SubscriptionProvider.java   
public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
    String jid = parser.getAttributeValue(null, "jid");
    String nodeId = parser.getAttributeValue(null, "node");
    String subId = parser.getAttributeValue(null, "subid");
    String state = parser.getAttributeValue(null, "subscription");
    boolean isRequired = false;

    int tag = parser.next();

    if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("subscribe-options"))
    {
        tag = parser.next();

        if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("required"))
            isRequired = true;

        while (parser.next() != XmlPullParser.END_TAG && parser.getName() != "subscribe-options");
    }
    while (parser.getEventType() != XmlPullParser.END_TAG) parser.next();
    return new Subscription(jid, nodeId, subId, (state == null ? null : Subscription.State.valueOf(state)), isRequired);
}
项目:NewCommunication-Android    文件:SubscriptionProvider.java   
public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
    String jid = parser.getAttributeValue(null, "jid");
    String nodeId = parser.getAttributeValue(null, "node");
    String subId = parser.getAttributeValue(null, "subid");
    String state = parser.getAttributeValue(null, "subscription");
    boolean isRequired = false;

    int tag = parser.next();

    if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("subscribe-options"))
    {
        tag = parser.next();

        if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("required"))
            isRequired = true;

        while (parser.next() != XmlPullParser.END_TAG && parser.getName() != "subscribe-options");
    }
    while (parser.getEventType() != XmlPullParser.END_TAG) parser.next();
    return new Subscription(jid, nodeId, subId, (state == null ? null : Subscription.State.valueOf(state)), isRequired);
}
项目:xmppsupport_v2    文件:SubscriptionsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement,
        String currentNamespace, Map<String, String> attributeMap,
        List<? extends PacketExtension> content) {
    return new SubscriptionsExtension(attributeMap.get("node"),
            (List<Subscription>) content);
}
项目:xmppsupport_v2    文件:SubscriptionProvider.java   
public PacketExtension parseExtension(XmlPullParser parser)
        throws Exception {
    String jid = parser.getAttributeValue(null, "jid");
    String nodeId = parser.getAttributeValue(null, "node");
    String subId = parser.getAttributeValue(null, "subid");
    String state = parser.getAttributeValue(null, "subscription");
    boolean isRequired = false;

    int tag = parser.next();

    if ((tag == XmlPullParser.START_TAG)
            && parser.getName().equals("subscribe-options")) {
        tag = parser.next();

        if ((tag == XmlPullParser.START_TAG)
                && parser.getName().equals("required"))
            isRequired = true;

        while (parser.next() != XmlPullParser.END_TAG
                && parser.getName() != "subscribe-options")
            ;
    }
    while (parser.getEventType() != XmlPullParser.END_TAG)
        parser.next();
    return new Subscription(jid, nodeId, subId, (state == null ? null
            : Subscription.State.valueOf(state)), isRequired);
}
项目:p2psafety    文件:XmppService.java   
private boolean isSubscribed(Node node, String user_jid) {
    boolean result = false;
    try {
        for (Subscription s: node.getSubscriptions()) {
            Log.i(TAG, "subscription: " + s.getJid());
            if (s.getJid().equalsIgnoreCase(user_jid) && s.getState().equals(Subscription.State.subscribed)) {
                result = true;
                break;
            }
        }
    } catch (Exception e) {}

    logs.info("checking if user subscribet to xmpp pubsub node: " + String.valueOf(result));
    return result;
}
项目:Smack    文件:SubscriptionsProvider.java   
@SuppressWarnings("unchecked")
@Override
protected SubscriptionsExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content)
{
    return new SubscriptionsExtension(attributeMap.get("node"), (List<Subscription>)content);
}
项目:EIM    文件:SubscriptionsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
    return new SubscriptionsExtension(attributeMap.get("node"), (List<Subscription>)content);
}
项目:androidPN-client.    文件:SubscriptionsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
    return new SubscriptionsExtension(attributeMap.get("node"), (List<Subscription>)content);
}
项目:java-bells    文件:SubscriptionsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
    return new SubscriptionsExtension(attributeMap.get("node"), (List<Subscription>)content);
}
项目:telegraph    文件:SubscriptionsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
    return new SubscriptionsExtension(attributeMap.get("node"), (List<Subscription>)content);
}
项目:NewCommunication-Android    文件:SubscriptionsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
    return new SubscriptionsExtension(attributeMap.get("node"), (List<Subscription>)content);
}