001/** 002 * 003 * Copyright © 2016 Fernando Ramirez 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.push_notifications.element; 018 019import org.jivesoftware.smack.packet.IQ; 020import org.jxmpp.jid.Jid; 021 022/** 023 * Disable Push Notifications IQ. 024 * 025 * @see <a href="http://xmpp.org/extensions/xep-0357.html">XEP-0357: Push 026 * Notifications</a> 027 * @author Fernando Ramirez 028 * 029 */ 030public class DisablePushNotificationsIQ extends IQ { 031 032 /** 033 * disable element. 034 */ 035 public static final String ELEMENT = "disable"; 036 037 /** 038 * the IQ NAMESPACE. 039 */ 040 public static final String NAMESPACE = PushNotificationsElements.NAMESPACE; 041 042 private final Jid jid; 043 private final String node; 044 045 public DisablePushNotificationsIQ(Jid jid, String node) { 046 super(ELEMENT, NAMESPACE); 047 this.jid = jid; 048 this.node = node; 049 this.setType(Type.set); 050 } 051 052 public DisablePushNotificationsIQ(Jid jid) { 053 this(jid, null); 054 } 055 056 /** 057 * Get the JID. 058 * 059 * @return the JID 060 */ 061 public Jid getJid() { 062 return jid; 063 } 064 065 /** 066 * Get the node. 067 * 068 * @return the node 069 */ 070 public String getNode() { 071 return node; 072 } 073 074 @Override 075 protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { 076 xml.attribute("jid", jid); 077 xml.optAttribute("node", node); 078 xml.rightAngleBracket(); 079 return xml; 080 } 081 082}