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

Revision 3952, 1.4 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 
1package nu.fw.jeti.jabber.elements;
2
3import java.net.URL;
4import java.util.Iterator;
5
6
7
8import nu.fw.jeti.events.ErrorListener;
9import nu.fw.jeti.events.OOBListener;
10import nu.fw.jeti.jabber.Backend;
11
12/**
13 * Created on 1-mrt-2003
14 * @author E.S. de Boer
15 *
16 */
17public class IQXOOB extends Extension implements IQExtension
18{
19        String description;
20        URL url;
21
22        public IQXOOB(URL url,String description)
23        {
24                this.description = description;
25                this.url = url;
26        }
27
28        public URL getURL()
29        {
30                return url;
31        }
32
33        public String getDescription()
34        {
35                return description;
36        }
37       
38        public void execute(InfoQuery iq,Backend backend)
39        {
40                if (iq.getType().equals("set"))
41                {
42                        for (Iterator j = backend.getListeners(OOBListener.class); j.hasNext();)
43                        {
44                                ((OOBListener) j.next()).oob(iq.getFrom(),iq.getID(),this);
45                        }
46                       
47                }
48                else if (iq.getType().equals("error"))
49                {
50                        for (Iterator j = backend.getListeners(ErrorListener.class); j.hasNext();)
51                        {
52                                ((ErrorListener) j.next()).error(iq.getErrorCode(),iq.getErrorDescription());
53                        }
54                }
55        }
56
57        public void appendToXML(StringBuffer xml)
58        {
59                /** @todo x */
60                xml.append("<query xmlns=\"jabber:iq:oob\">");
61                if (url != null)
62                        xml.append("<url>" + url  + "</url>");
63                if (description != null)
64                        xml.append("<desc>" + description + "</desc>");
65                xml.append("</query>");
66        }
67
68}
69
70/*
71 * Overrides for emacs
72 * Local variables:
73 * tab-width: 4
74 * End:
75 */
Note: See TracBrowser for help on using the repository browser.