Skip to content

Commit

Permalink
Media Server component should advertise right identity
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermesgb committed Mar 4, 2015
1 parent eeab851 commit a0e3dfe
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ protected IQ handleDiscoInfo(IQ iq) {
IQ disco = super.handleDiscoInfo(iq);
String endPoint = configuration.getProperty(MediaServerConfiguration.HTTP_ENDPOINT);
if (endPoint != null) {

Element queryEl = disco.getElement().element("query");
addIdentity(queryEl, "component", getName(), "generic");

addFeature(queryEl, NAMESPACE_DISCO_INFO);
addFeature(queryEl, NAMESPACE_XMPP_PING);
addFeature(queryEl, NAMESPACE_LAST_ACTIVITY);
addFeature(queryEl, NAMESPACE_ENTITY_TIME);

Element xEl = queryEl.addElement("x", "jabber:x:data");
xEl.addAttribute("type", "result");

Expand All @@ -117,6 +125,18 @@ protected IQ handleDiscoInfo(IQ iq) {
return disco;
}

private void addIdentity(Element e, String category, String name, String type) {
Element identity = e.addElement("identity");
identity.addAttribute("category", category);
identity.addAttribute("name", name);
identity.addAttribute("type", type);
}

private void addFeature(Element e, String var) {
Element feature = e.addElement("feature");
feature.addAttribute("var", var);
}

private void addField(Element xEl, String var, String type,
String value) {
Element fieldEl = xEl.addElement("field");
Expand Down

0 comments on commit a0e3dfe

Please sign in to comment.