[3952] | 1 | /* |
---|
| 2 | * Jeti, a Java Jabber client, Copyright (C) 2004 E.S. de Boer |
---|
| 3 | * |
---|
| 4 | * This program is free software; you can redistribute it and/or modify |
---|
| 5 | * it under the terms of the GNU General Public License as published by |
---|
| 6 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | * (at your option) any later version. |
---|
| 8 | * |
---|
| 9 | * This program is distributed in the hope that it will be useful, |
---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | * GNU General Public License for more details. |
---|
| 13 | * |
---|
| 14 | * You should have received a copy of the GNU General Public License |
---|
| 15 | * along with this program; if not, write to the Free Software |
---|
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | * |
---|
| 18 | * For questions, comments etc, |
---|
| 19 | * use the website at http://jeti.jabberstudio.org |
---|
| 20 | * or mail me at eric@jeti.tk |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | // Created on 20-okt-2004 |
---|
| 24 | package nu.fw.jeti.plugins.filetransfer; |
---|
| 25 | |
---|
| 26 | import nu.fw.jeti.jabber.Backend; |
---|
| 27 | import nu.fw.jeti.jabber.elements.Extension; |
---|
| 28 | import nu.fw.jeti.jabber.elements.IQExtension; |
---|
| 29 | import nu.fw.jeti.jabber.elements.InfoQuery; |
---|
| 30 | import nu.fw.jeti.jabber.elements.XData; |
---|
| 31 | |
---|
| 32 | /** |
---|
| 33 | * @author E.S. de Boer |
---|
| 34 | * |
---|
| 35 | */ |
---|
| 36 | public class IQSi extends Extension implements IQExtension |
---|
| 37 | { |
---|
| 38 | private String mimeType; |
---|
| 39 | private String id; |
---|
| 40 | private String profile; |
---|
| 41 | private XData form; |
---|
| 42 | private XSiFileTransfer siprofile; |
---|
| 43 | |
---|
| 44 | public IQSi(XData form, XSiFileTransfer siprofile) |
---|
| 45 | { |
---|
| 46 | this.form = form; |
---|
| 47 | this.siprofile = siprofile; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | public IQSi(String id, String profile,String mimeType, XData form, XSiFileTransfer siprofile) |
---|
| 51 | { |
---|
| 52 | this.mimeType = mimeType; |
---|
| 53 | this.id = id; |
---|
| 54 | this.profile = profile; |
---|
| 55 | this.form = form; |
---|
| 56 | this.siprofile = siprofile; |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | public XData getXDataForm() |
---|
| 60 | { |
---|
| 61 | return form; |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | public String getId() |
---|
| 65 | { |
---|
| 66 | return id; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | public String getMimeType() |
---|
| 70 | { |
---|
| 71 | return mimeType; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | public String getProfile() |
---|
| 75 | { |
---|
| 76 | return profile; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | public XSiFileTransfer getSiprofile() |
---|
| 80 | { |
---|
| 81 | return siprofile; |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | public void execute(InfoQuery iq, Backend backend) |
---|
| 86 | { |
---|
| 87 | if(iq.getType().equals("set")) |
---|
| 88 | { |
---|
| 89 | new GetFileWindow(backend,iq); |
---|
| 90 | } |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | public void appendToXML(StringBuffer xml) |
---|
| 94 | { |
---|
| 95 | xml.append("<si xmlns='http://jabber.org/protocol/si'"); |
---|
| 96 | appendAttribute(xml,"id",id); |
---|
| 97 | appendAttribute(xml,"mime-type",mimeType); |
---|
| 98 | appendAttribute(xml,"profile",profile); |
---|
| 99 | xml.append(">"); |
---|
| 100 | if(siprofile!=null) |
---|
| 101 | { |
---|
| 102 | siprofile.appendToXML(xml); |
---|
| 103 | } |
---|
| 104 | if(form!=null) |
---|
| 105 | { |
---|
| 106 | xml.append("<feature xmlns='http://jabber.org/protocol/feature-neg'>"); |
---|
| 107 | form.appendToXML(xml); |
---|
| 108 | xml.append("</feature>"); |
---|
| 109 | } |
---|
| 110 | xml.append("</si>"); |
---|
| 111 | } |
---|
| 112 | } |
---|
| 113 | /* |
---|
| 114 | * Overrides for emacs |
---|
| 115 | * Local variables: |
---|
| 116 | * tab-width: 4 |
---|
| 117 | * End: |
---|
| 118 | */ |
---|