/* * (non-Javadoc) * * @see * com.buddycloud.pusher.handler.AbstractQueryHandler#handleQuery(org.xmpp * .packet.IQ) */ @Override protected IQ handleQuery(IQ iq) { String userJid = iq.getFrom().toBareJID(); Element queryElement = iq.getElement().element("query"); Element typeEl = queryElement.element("type"); NotificationSettings notificationSettings = NotificationUtils.getNotificationSettingsByType(userJid, typeEl.getText(), getDataSource()); return createResponse(iq, userJid, notificationSettings); }
/** * @param iq * @param userJid * @param notificationSettings * @return */ private IQ createResponse(IQ iq, String userJid, NotificationSettings notificationSettings) { IQ result = IQ.createResultIQ(iq); Element queryElement = result.getElement().addElement("query", getNamespace()); NotificationUtils.appendXML(queryElement, notificationSettings); return result; }