1 | package nu.fw.jeti.jabber.handlers; |
---|
2 | |
---|
3 | import nu.fw.jeti.jabber.elements.Extension; |
---|
4 | import nu.fw.jeti.jabber.elements.IQVersion; |
---|
5 | import org.xml.sax.Attributes; |
---|
6 | |
---|
7 | /* |
---|
8 | * Jeti, a Java Jabber client, Copyright (C) 2002 E.S. de Boer |
---|
9 | * |
---|
10 | * This program is free software; you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU General Public License as published by |
---|
12 | * the Free Software Foundation; either version 2 of the License, or |
---|
13 | * (at your option) any later version. |
---|
14 | * |
---|
15 | * This program is distributed in the hope that it will be useful, |
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | * GNU General Public License for more details. |
---|
19 | * |
---|
20 | * You should have received a copy of the GNU General Public License |
---|
21 | * along with this program; if not, write to the Free Software |
---|
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
23 | * |
---|
24 | * For questions, comments etc, |
---|
25 | * use the website at http://jeti.jabberstudio.org |
---|
26 | * or mail/IM me at jeti@jabber.org |
---|
27 | */ |
---|
28 | |
---|
29 | public class IQVersionHandler extends ExtensionHandler |
---|
30 | { |
---|
31 | private String os; |
---|
32 | private String name; |
---|
33 | private String version; |
---|
34 | |
---|
35 | public void startHandling(Attributes attr) |
---|
36 | { |
---|
37 | reset(); |
---|
38 | } |
---|
39 | |
---|
40 | private void reset() |
---|
41 | { |
---|
42 | os=name=version=null; |
---|
43 | |
---|
44 | } |
---|
45 | |
---|
46 | public void endElement(String name) |
---|
47 | { |
---|
48 | if("os".equals(name)) os = getText(); |
---|
49 | else if("name".equals(name)) this.name = getText(); |
---|
50 | else if("version".equals(name)) version = getText(); |
---|
51 | else nu.fw.jeti.util.Log.notParsedXML("iq:auth " + name + getText()); |
---|
52 | clearCurrentChars(); |
---|
53 | } |
---|
54 | |
---|
55 | public Extension build() |
---|
56 | { |
---|
57 | Extension e = new IQVersion(name,version ,os); |
---|
58 | reset(); |
---|
59 | return e; |
---|
60 | } |
---|
61 | } |
---|
62 | /* |
---|
63 | * Overrides for emacs |
---|
64 | * Local variables: |
---|
65 | * tab-width: 4 |
---|
66 | * End: |
---|
67 | */ |
---|