use of org.xmpp.packet.Message in project Openfire by igniterealtime.
the class GojaraAdminProcessor method process.
/**
* Here we process the response of the remote command sent to Spectrum. We have to identify what kind of response it
* is, as no tag for the command being responded is being sent. Currently these commands are used in Gojara
* TransportSessionManager: online_users ( Chatmsg of online users for specific transport), usernames seperated by
* newlines
*/
@Override
public void process(Packet packet, String subdomain, String to, String from) throws PacketRejectedException {
Message message = (Message) packet;
// handle different commands
Log.debug("Intercepted spectrum message: " + message.toString());
String command = packet.getID();
if (command.equals("online_users")) {
handleOnlineUsers(message, subdomain);
} else if (command.equals("unregister")) {
handleUnregister(message, subdomain);
} else if (command.equals("config_check")) {
handleConfigCheck(subdomain);
} else if (command.equals("uptime")) {
handleStatistic(message, subdomain, "uptime");
} else if (command.equals("messages_from_xmpp")) {
handleStatistic(message, subdomain, "messages_from_xmpp");
} else if (command.equals("messages_to_xmpp")) {
handleStatistic(message, subdomain, "messages_to_xmpp");
} else if (command.equals("used_memory")) {
handleStatistic(message, subdomain, "used_memory");
} else if (command.equals("average_memory_per_user")) {
handleStatistic(message, subdomain, "average_memory_per_user");
}
}
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);
}
Aggregations