2014-10-22 16:38:44 +00:00
|
|
|
package eu.siacs.conversations.xmpp.stanzas;
|
|
|
|
|
|
|
|
import eu.siacs.conversations.xml.Element;
|
2014-11-06 19:10:03 +00:00
|
|
|
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
2014-11-05 20:55:47 +00:00
|
|
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
2014-10-22 16:38:44 +00:00
|
|
|
|
|
|
|
public class AbstractStanza extends Element {
|
|
|
|
|
|
|
|
protected AbstractStanza(String name) {
|
|
|
|
super(name);
|
|
|
|
}
|
|
|
|
|
2014-11-06 19:10:03 +00:00
|
|
|
public Jid getTo() {
|
|
|
|
try {
|
|
|
|
return Jid.fromString(getAttribute("to"));
|
|
|
|
} catch (final InvalidJidException e) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Jid getFrom() {
|
|
|
|
try {
|
|
|
|
return Jid.fromString(getAttribute("from"));
|
|
|
|
} catch (final InvalidJidException e) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2014-10-22 16:38:44 +00:00
|
|
|
|
|
|
|
public String getId() {
|
|
|
|
return this.getAttribute("id");
|
|
|
|
}
|
|
|
|
|
2014-11-05 20:55:47 +00:00
|
|
|
public void setTo(final Jid to) {
|
|
|
|
setAttribute("to", to.toString());
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
|
|
|
|
2014-11-05 20:55:47 +00:00
|
|
|
public void setFrom(final Jid from) {
|
|
|
|
setAttribute("from", from.toString());
|
2014-10-22 16:38:44 +00:00
|
|
|
}
|
|
|
|
|
2014-11-05 20:55:47 +00:00
|
|
|
public void setId(final String id) {
|
2014-10-22 16:38:44 +00:00
|
|
|
setAttribute("id", id);
|
|
|
|
}
|
|
|
|
}
|