use of org.xmpp.packet.Message in project Openfire by igniterealtime.
the class Chatbot method sendQuestion.
private void sendQuestion(Message message, ChatbotSession session, int position) {
FormElement field = getForm().getFormElementAt(position);
if (field == null) {
return;
}
if (field.getAnswerType() == WorkgroupForm.FormEnum.hidden) {
// Auto accept hidden fields
Message fakeMessage = message.createCopy();
StringBuilder builder = new StringBuilder();
for (Iterator<String> it = field.getAnswers().iterator(); it.hasNext(); ) {
builder.append(it.next());
if (it.hasNext()) {
builder.append("/");
}
}
fakeMessage.setBody(builder.toString());
// Set that we are currently waiting for a response to the next question
session.setCurrentSubstep(position);
// Simulate that the user sent this message (with the hidden field)
onMessage(session, fakeMessage);
}
String text = field.getLabel();
if (field.getAnswerType() == WorkgroupForm.FormEnum.radio_button || field.getAnswerType() == WorkgroupForm.FormEnum.dropdown_box || field.getAnswerType() == WorkgroupForm.FormEnum.checkbox) {
// Append the options to the message body
if (!field.getAnswers().isEmpty()) {
StringBuilder builder = new StringBuilder(text);
builder.append(" [");
builder.append(Request.encodeMetadataValue(field.getAnswers()));
builder.append("]");
text = builder.toString();
}
}
sendReply(message, text);
// Set that we are currently waiting for a response to the next question
session.setCurrentSubstep(position);
}
use of org.xmpp.packet.Message in project Openfire by igniterealtime.
the class GojaraAdminManager method testAdminConfiguration.
/**
* Sends a testmessage to specified gateway, when a response gets intercepted we consider gateway configured
*
*/
public void testAdminConfiguration(String gateway) {
unconfiguredGateways.add(gateway);
Message message = generateCommand(gateway, "config_check");
message.setBody("status");
router.route(message);
Log.info("Checking for admin configuration on " + gateway);
}
use of org.xmpp.packet.Message in project Openfire by igniterealtime.
the class GojaraAdminManager method usedMemoryOf.
private void usedMemoryOf(String transport) {
Message message = generateCommand(transport, "used_memory");
router.route(message);
}
use of org.xmpp.packet.Message in project Openfire by igniterealtime.
the class GojaraAdminManager method averageMemoryOfUser.
private void averageMemoryOfUser(String transport) {
Message message = generateCommand(transport, "average_memory_per_user");
router.route(message);
}
use of org.xmpp.packet.Message in project Openfire by igniterealtime.
the class GojaraAdminManager method messagesFrom.
private void messagesFrom(String transport) {
Message message = generateCommand(transport, "messages_from_xmpp");
router.route(message);
}
Aggregations