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

system.verbs.apps.Manila.windowTypes.types.manilaMessage.newMessage

on newMessage (siteUrl, title, inResponseTo=0, flPromoteToStory=true) {
	<<Create a new message in a window.
		<<Mon, Aug 21, 2000 at 3:35:46 PM by PBS
	
	local (adrinfo, username, password);
	on createInfoCallback (adrinfo) {
		if not (manila.windowTypes.getUsernameAndPassword (adrinfo, @username, @password)) {
			bundle { //don't leave stale data lying around
				local (adrtempinfo = @system.temp.manila.data.sites.[nameOf (adrinfo^)]);
				if defined (adrtempinfo^) {delete (adrtempinfo)};
				delete (adrinfo)};
			return (false)}};
	if not manila.windowTypes.findSiteInfo (siteUrl, @adrinfo, @createInfoCallback) {
		return (false)};
	
	local (windowTitle = adrinfo^.displaySiteName + ": " + title);
	local (adr = Frontier.tools.windowTypes.newWindow ("manilaMessage", title:windowTitle));
	window.attributes.setOne ("adrSiteInfo", adrinfo, adr);
	
	bundle { //set storyInfo attributes
		local (atts); new (tableType, @atts);
		atts.subject = title;
		atts.flAddToStoriesList = flPromoteToStory;
		atts.inResponseTo = inResponseTo;
		window.attributes.addGroup (@atts, adr)};
	
	return (true);
	}
	<<bundle //old code
		<<local (siteInfo, storyInfo)
		<<siteInfo = playlist.manila.buildSiteInfo (siteUrl)
		<<new (tableType, @storyInfo)
		<<storyInfo.subject = title
		<<storyInfo.flAddToStoriesList = flPromoteToStory
		<<if inResponseTo != nil
			<<storyInfo.inResponseTo = inResponseTo
		<<
		<<pike.init ()
		<<
		<<pike.checkSiteInfoTable (@siteInfo, "create story")
		<<
		<<local (adrStoryTable = pike.getNewStoryTableAddress (@siteInfo))
		<<adrStoryTable^.siteInfo = siteInfo
		<<adrStoryTable^.storyInfo = storyInfo
		<<
		<<thread.callScript (@pike.commands.newStory, {adrStoryTable})
		<<
		<<return (true)



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.