public boolean execCommand(Protocol protocol, String msg) { final String cmd; final String param; int endCmd = msg.indexOf(' '); if (-1 != endCmd) { cmd = msg.substring(1, endCmd); param = msg.substring(endCmd + 1); } else { cmd = msg.substring(1); param = ""; } String resource = param; String newMessage = ""; int endNick = param.indexOf('\n'); if (-1 != endNick) { resource = param.substring(0, endNick); newMessage = param.substring(endNick + 1); } String xml = null; final String on = "o" + "n"; final String off = "o" + "f" + "f"; if (on.equals(param) || off.equals(param)) { xml = Config.getConfigValue(cmd + ' ' + param, "/jabber-commands.txt"); } if (null == xml) { xml = Config.getConfigValue(cmd, "/jabber-commands.txt"); } if (null == xml) { return false; } XmppConnection xmppXml = ((Xmpp) protocol).getConnection(); String jid = Jid.jimmJidToRealJid(getUserId()); String fullJid = jid; if (isConference()) { String nick = ((XmppServiceContact) this).getMyName(); fullJid = Jid.jimmJidToRealJid(getUserId() + '/' + nick); } xml = Util.replace(xml, "${jimm.caps}", xmppXml.getCaps()); xml = Util.replace(xml, "${c.jid}", Util.xmlEscape(jid)); xml = Util.replace(xml, "${c.fulljid}", Util.xmlEscape(fullJid)); xml = Util.replace(xml, "${param.full}", Util.xmlEscape(param)); xml = Util.replace(xml, "${param.res}", Util.xmlEscape(resource)); xml = Util.replace(xml, "${param.msg}", Util.xmlEscape(newMessage)); xml = Util.replace(xml, "${param.res.realjid}", Util.xmlEscape(getSubContactRealJid(resource))); xml = Util.replace(xml, "${param.full.realjid}", Util.xmlEscape(getSubContactRealJid(param))); xmppXml.requestRawXml(xml); return true; }