[ENH] Celeste - load only the last 100 messages in category

Daniel Vainsencher danielv at netvision.net.il
Sat Apr 8 21:28:26 UTC 2000


I like Celeste, but it's slow at reading 10,000 message categories (not slower 
than any other mailer I know of, but still not fast enough).

This changeset makes it read only the latest 100, adding a menu option to read 
the rest.

Should at some point give an indication if not showing all messages.

If anyone finds this useful, or has whatever comments, I'd be happy to hear.

Daniel
-------------- next part --------------
'From Squeak2.8alpha of 12 February 2000 [latest update: #1974] on 9 April 2000 at 12:04:29 am'!

!Celeste methodsFor: 'categories pane' stamp: 'dvf 4/8/2000 23:56'!
categoryMenu: aMenu 
	"Answer the menu for the categories pane."
	| labels lineSeparations selectors lines |
	labels _ 'save\fetch mail\send queued mail\add category' withCRs.
	lineSeparations _ #(1 2 ).
	selectors _ #(save fetchMail sendQueuedMail addCategory ).
	"add commands if any category is selected."
	currentCategory notNil
		ifTrue: 
			[labels _ labels , '\view all messages' withCRs.
			selectors _ selectors , #(viewAllMessages)].
	"add extra commands if a normal category is selected"
	(currentCategory notNil and: [currentCategory ~= '.all.' & (currentCategory ~= '.unclassified.')])
		ifTrue: 
			[labels _ labels , '\rename category\remove category\import into category\export category (Celeste)\export category (Unix/Eudora)' withCRs.
			lineSeparations _ lineSeparations , #(3 3 ).
			selectors _ selectors , #(renameCategory removeCategory importIntoCategory exportCategory exportCategoryUnix )]
		ifFalse: [lineSeparations _ lineSeparations , #(1 )].
	labels _ labels , '\empty trash\compact\find duplicates\toggle headers\set user name\set cc: list\set POP server\set POP username\set SMTP server' withCRs.
	lineSeparations _ lineSeparations , #(3 1 5 ).
	selectors _ selectors , #(emptyTrash compact findDuplicates toggleSuppressHeaders setUserName setCCList setPopServer setPopUserName setSmtpServer ).
	"add toggle for whether to delete messages on download"
	DeleteInboxAfterFetching
		ifTrue: 
			[labels _ labels , '\leave messages on server' withCRs.
			selectors _ selectors , #(keepMessagesOnServer )]
		ifFalse: 
			[labels _ labels , '\don''t leave messages on server' withCRs.
			selectors _ selectors , #(deleteMessagesAfterFetching )].
	lineSeparations _ lineSeparations , #(1 ).
	"convert lineSeperations into absolute line positions"
	lines _ lineSeparations copyFrom: 1 to: lineSeparations size - 1.
	(2 to: lines size)
		do: [:i | lines at: i put: (lines at: i)
					+ (lines at: i - 1)].
	^ aMenu
		labels: labels
		lines: lines
		selections: selectors! !

!Celeste methodsFor: 'categories pane' stamp: 'dvf 4/8/2000 23:46'!
setCategory: newCategory 
	"Change the currently selected category. We must also compute the table  
	 of contents and message list for the new category."
	| |
	currentCategory _ newCategory.
	newCategory isNil
		ifTrue: [currentMessages _ currentTOC _ currentMsgID _ nil]
		ifFalse: 
			[currentMessages _ self filteredMessagesIn: newCategory.
			currentMessages size > 100 ifTrue: [currentMessages _ currentMessages copyLast: 100].
			self updateToc].
	self changed: #category.
	self changed: #tocEntryList.
	self changed: #tocEntry.
	self changed: #messageText! !

!Celeste methodsFor: 'categories pane' stamp: 'dvf 4/8/2000 23:45'!
updateToc
			| s |
	currentTOC _ OrderedCollection new: currentMessages size.
			1 to: currentMessages size do: 
				[:i | 
				s _ WriteStream on: (String new: 100).
				s nextPutAll: i printString;
				 space.
				[s position < 4]
					whileTrue: [s space].
				s nextPutAll: (mailDB getTOCstring: (currentMessages at: i)).
				currentTOC add: s contents].
			currentTOC _ currentTOC asArray.
			(currentMessages includes: currentMsgID)
				ifFalse: [currentMsgID _ nil]! !

!Celeste methodsFor: 'categories pane' stamp: 'dvf 4/8/2000 23:48'!
viewAllMessages
	currentMessages _ self filteredMessagesIn: self category.
	self updateToc. 
	self changed: #tocEntryList.
	self changed: #tocEntry.
	self changed: #messageText! !




More information about the Squeak-dev mailing list