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; 020 021import org.jxmpp.jid.Jid; 022 023/** 024 * Disable Push Notifications IQ. 025 * 026 * @see <a href="http://xmpp.org/extensions/xep-0357.html">XEP-0357: Push 027 * Notifications</a> 028 * @author Fernando Ramirez 029 * 030 */ 031public class DisablePushNotificationsIQ extends IQ { 032 033 /** 034 * disable element. 035 */ 036 public static final String ELEMENT = "disable"; 037 038 /** 039 * the IQ NAMESPACE. 040 */ 041 public static final String NAMESPACE = PushNotificationsElements.NAMESPACE; 042 043 private final Jid jid; 044 private final String node; 045 046 @SuppressWarnings("this-escape") 047 public DisablePushNotificationsIQ(Jid jid, String node) { 048 super(ELEMENT, NAMESPACE); 049 this.jid = jid; 050 this.node = node; 051 this.setType(Type.set); 052 } 053 054 public DisablePushNotificationsIQ(Jid jid) { 055 this(jid, null); 056 } 057 058 /** 059 * Get the JID. 060 * 061 * @return the JID 062 */ 063 public Jid getJid() { 064 return jid; 065 } 066 067 /** 068 * Get the node. 069 * 070 * @return the node 071 */ 072 public String getNode() { 073 return node; 074 } 075 076 @Override 077 protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { 078 xml.attribute("jid", jid); 079 xml.optAttribute("node", node); 080 xml.rightAngleBracket(); 081 return xml; 082 } 083 084}