source: 3thparty/jmessenger/src/nu/fw/jeti/jabber/elements/XMPPError.java @ 3952

Revision 3952, 2.1 KB checked in by alexandrecorreia, 13 years ago (diff)

Ticket #1710 - Adicao do codigo fonte java do componente jmessenger(jabberit_messenger)

  • Property svn:executable set to *
Line 
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 or Jabber at jeti@jabber.org
21 *
22 *      Created on 23-okt-2004
23 */
24 
25package nu.fw.jeti.jabber.elements;
26
27import java.util.Iterator;
28import java.util.LinkedList;
29import java.util.List;
30
31/**
32 * @author E.S. de Boer
33 *
34 */
35public class XMPPError extends Extension
36{
37        private int errorCode;
38        private String type;
39        private List errors = new LinkedList();
40       
41        public XMPPError(String type, int errorCode)
42        {
43                this.errorCode= errorCode;
44                this.type=type;
45        }
46       
47        public void addError(XMPPErrorTag error)
48        {
49                 errors.add(error);
50        }
51       
52        public String getType()
53        {
54                return type;
55        }
56       
57        public int code()
58        {
59                return errorCode;
60        }
61
62    public Iterator getXMPPErrors() {
63        return errors.iterator();
64    }
65   
66    public XMPPErrorTag getFirstXMPPError() {
67        return (XMPPErrorTag)errors.get(0);
68    }
69
70        public void appendToXML(StringBuffer xml)
71        {
72            xml.append("<error");
73                appendAttribute(xml,"code",String.valueOf(errorCode));
74                appendAttribute(xml,"type",type);
75                xml.append(">");
76                for(Iterator i = errors.iterator();i.hasNext();)
77                {
78                        ((XMPPErrorTag)i.next()).appendToXML(xml);
79                }
80                xml.append("</error>");
81        }
82}
83
84/*
85 * Overrides for emacs
86 * Local variables:
87 * tab-width: 4
88 * End:
89 */
Note: See TracBrowser for help on using the repository browser.