Monday, November 08, 2010 at 12:04 AM.


on editMessage (dgname, username, password, msgnum) {
	<<8/20/99; 12:24:47 PM by DW, XML-RPC call to get the contents of a message
			<<10/5/99; 1:49:52 PM by PBS
				<<Added support for addresses and strings that can be coerced to addresses in discuss.root.
	local (adrlog = log.addtoguestdatabase ("discussXmlRpcInterface"));
	bundle { //logging code
		adrlog^.operation = "editMessage";
		adrlog^.dgname = dgname;
		adrlog^.username = username;
		adrlog^.msgnum = msgnum};
	local (adrroot = @[system.temp.mainResponder.discussRootFile].[dgname]);
	if not defined (adrroot^) {
		scriptError ("Can't edit the story because there is no discussion group named \"" + dgname + "\".")};
	if typeOf (adrroot^) == addressType or typeOf (adrroot^) == stringType { //PBS 10/5/99: support for addresses and strings in discuss.root
		if defined (adrroot^^) {
			adrroot = adrroot^} //de-reference to get the address of the discussion group
		else {
			scriptError ("Can't edit the story because there is no discussion group named \"" + dgname + "\".")}};
	local (groupname = adrroot^.editorialPrefs.membershipGroup);
	local (adruser = mainResponder.members.getMemberTableWithPassword (groupname, username, password));
	local (adrmsg = @adrroot^.messages.[string.padwithzeros (msgnum, 7)]);
	if string.lower (adrmsg^.member) != string.lower (username) {
		scriptError ("Can't edit this message because you do not have editorial permission.")};
	local (returnedtable);
	new (tabletype, @returnedtable);
	returnedtable.url = adrroot^.prefs.msgReaderUrl + msgnum;
	returnedtable.title = adrmsg^.subject;
	returnedtable.body = string (adrmsg^.body);
	returnedtable.msgnum = msgnum;
	adrlog^.returnedtable = returnedtable;
	return (returnedtable)} //caller is expected to copy any attributes we return into local storage

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.