[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.elements.Extension; |
---|
| 27 | import nu.fw.jeti.jabber.elements.XExtension; |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | * @author E.S. de Boer |
---|
| 31 | * |
---|
| 32 | */ |
---|
| 33 | public class XSiFileTransfer extends Extension implements XExtension |
---|
| 34 | { |
---|
| 35 | private String name; |
---|
| 36 | private String hash; |
---|
| 37 | private String date; |
---|
| 38 | private String description; |
---|
| 39 | private long size; |
---|
| 40 | private int length; |
---|
| 41 | private long offset; |
---|
| 42 | |
---|
| 43 | public XSiFileTransfer(String name, String hash, String date, long size,String description,int length,long offset) |
---|
| 44 | { |
---|
| 45 | this.name = name; |
---|
| 46 | this.hash = hash; |
---|
| 47 | this.date = date; |
---|
| 48 | this.size = size; |
---|
| 49 | this.description=description; |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | public String getHash() |
---|
| 53 | { |
---|
| 54 | return hash; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | public int getLength() |
---|
| 58 | { |
---|
| 59 | return length; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | public String getName() |
---|
| 63 | { |
---|
| 64 | return name; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | public String getDescription() |
---|
| 68 | { |
---|
| 69 | return description; |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | public long getOffset() |
---|
| 73 | { |
---|
| 74 | return offset; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | public long getSize() |
---|
| 78 | { |
---|
| 79 | return size; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | public void appendToXML(StringBuffer xml) |
---|
| 83 | { |
---|
| 84 | xml.append("<file xmlns='http://jabber.org/protocol/si/profile/file-transfer'"); |
---|
| 85 | appendAttribute(xml,"name",name); |
---|
| 86 | appendAttribute(xml,"hash",hash); |
---|
| 87 | appendAttribute(xml,"date",date); |
---|
| 88 | appendAttribute(xml,"size",String.valueOf(size)); |
---|
| 89 | xml.append(">"); |
---|
| 90 | appendElement(xml,"desc",description); |
---|
| 91 | if(length>0) |
---|
| 92 | { |
---|
| 93 | xml.append("<range"); |
---|
| 94 | appendAttribute(xml,"lengt",String.valueOf(length)); |
---|
| 95 | appendAttribute(xml,"offset",String.valueOf(offset)); |
---|
| 96 | xml.append("/>"); |
---|
| 97 | } |
---|
| 98 | xml.append("</file>"); |
---|
| 99 | } |
---|
| 100 | } |
---|
| 101 | /* |
---|
| 102 | * Overrides for emacs |
---|
| 103 | * Local variables: |
---|
| 104 | * tab-width: 4 |
---|
| 105 | * End: |
---|
| 106 | */ |
---|