📄 getnumberusersessions.java
字号:
package org.jivesoftware.wildfire.commands.admin;import org.dom4j.Element;import org.jivesoftware.wildfire.SessionManager;import org.jivesoftware.wildfire.commands.AdHocCommand;import org.jivesoftware.wildfire.commands.SessionData;import org.xmpp.forms.DataForm;import org.xmpp.forms.FormField;import java.util.List;/** * Command that allows to retrieve the number of user sessions at any one moment. That means * that the result will include all connected resources of all users. * * @author Gaston Dombiak */public class GetNumberUserSessions extends AdHocCommand { protected void addStageInformation(SessionData data, Element command) { //Do nothing since there are no stages } public void execute(SessionData data, Element command) { DataForm form = new DataForm(DataForm.Type.result); FormField field = form.addField(); field.setType(FormField.Type.hidden); field.setVariable("FORM_TYPE"); field.addValue("http://jabber.org/protocol/admin"); field = form.addField(); field.setLabel(getLabel()); field.setVariable("onlineuserssessionsnum"); field.addValue(SessionManager.getInstance().getSessionCount()); command.add(form.getElement()); } protected List<Action> getActions(SessionData data) { //Do nothing since there are no stages return null; } public String getCode() { return "http://jabber.org/protocol/admin#get-sessions-num"; } public String getDefaultLabel() { // TODO Use i18n return "Number of Connected User Sessions"; } protected Action getExecuteAction(SessionData data) { //Do nothing since there are no stages return null; } public int getMaxStages(SessionData data) { return 0; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -