public String runMacro(ExternalHTTPRequests httpReq, String parm) { Hashtable parms = parseParms(parm); String journalName = httpReq.getRequestParameter("JOURNAL"); if (journalName == null) return " @break@"; if (CMLib.journals().isArchonJournalName(journalName)) { MOB M = Authenticate.getAuthenticatedMob(httpReq); if ((M == null) || (!CMSecurity.isASysOp(M))) return " @break@"; } String srch = httpReq.getRequestParameter("JOURNALMESSAGESEARCH"); if (srch != null) srch = srch.toLowerCase(); String last = httpReq.getRequestParameter("JOURNALMESSAGE"); int cardinal = CMath.s_int(httpReq.getRequestParameter("JOURNALCARDINAL")); if (parms.containsKey("RESET")) { if (last != null) { httpReq.removeRequestParameter("JOURNALMESSAGE"); httpReq.removeRequestParameter("JOURNALCARDINAL"); } return ""; } MOB M = Authenticate.getAuthenticatedMob(httpReq); cardinal++; JournalsLibrary.JournalEntry entry = null; List<JournalsLibrary.JournalEntry> msgs = JournalInfo.getMessages(httpReq, journalName); while ((entry == null) || (!CMLib.journals().canReadMessage(entry, srch, M, parms.contains("NOPRIV")))) { entry = JournalInfo.getNextEntry(msgs, last); if (entry == null) { httpReq.addRequestParameters("JOURNALMESSAGE", ""); if (parms.containsKey("EMPTYOK")) return "<!--EMPTY-->"; return " @break@"; } last = entry.key; } entry.cardinal = cardinal; httpReq.addRequestParameters("JOURNALCARDINAL", "" + cardinal); httpReq.addRequestParameters("JOURNALMESSAGE", last); return ""; }