Adium

Ticket #7120 (assigned task)

Opened 1 year ago

Last modified 2 months ago

Track previous messages in AIChat, rather than dropping them in AIWebKitMessageViewController

Reported by: applmak Assigned to: cbarrett (accepted)
Priority: normal Milestone: Adium X 1.4
Component: Adium Core Version: 1.1svn
Severity: normal Keywords:
Cc: Patch: None
Pending: 0

Description

In order to support AppleScript referencing various pieces of text in a chat, and in order to dynamically switch between styles and have a chat's history be persistant, the various AIContentObjects that are added to the AIWebKitMessageView and then dropped, should rather be stored and remembered. It would make sense to keep these on the model, AIChat. Also, some users do not close AIChat windows, and leave them open for *long* stretches of time, so these AIContentObjects may need to be removed after a day or so.

Change History

08/04/2007 02:18:31 AM changed by edr1084

  • milestone set to Adium X 1.2.

08/15/2007 09:36:08 PM changed by boredzo

An alternate means of accomplishing the same ends would be reading the transcripts that intersect with the current chat, accumulating the enumerated objects into an array, and keeping the enumerator and array around for some arbitrary timeout, releasing them when time expires to conserve memory.

09/16/2007 10:49:02 PM changed by tick

Can this wait until 1.3 guys?

09/17/2007 06:51:45 AM changed by cbarrett

I think Peter went in the direction he was talking about, and started working on a class to replay chat transcripts. I don't think he's done, but I'd ping him about it :)

10/09/2007 01:17:04 PM changed by cbarrett

  • owner changed from nobody to cbarrett.

(follow-up: ↓ 10 ) 10/09/2007 01:31:28 PM changed by cbarrett

So I talked to Peter, and his class wouldn't work for situations where you don't have logs.

I didn't think it was right to keep a "cache" which is actually just a log, just in a different directory with different file extension, since if you've disabled logs you probably don't want them on disk either.

So I'm going to write a cache for this. On cache miss, if you have logs enabled, we'll get those, otherwise fail.

I'm thinking the cache eviction strategy should be:

  • When the cache grows to more than ~5-10MB (formal definition will probably be in terms of number of elements) globally (across all AIChats), older objects will be evicted.
  • All objects for closed windows will be evicted.

Thoughts on this?

10/09/2007 02:05:06 PM changed by cbarrett

It would also be nice to hook up scrollback such that old messages get evicted too, limiting you only to cache if you have logging off, and giving you infinite scrollback (i.e. from the beginning of time) if you have logging on. (note that the loads would happen asynchronously).

See #8088

10/09/2007 02:10:24 PM changed by cbarrett

See also #367

10/09/2007 02:10:31 PM changed by cbarrett

  • status changed from new to assigned.

(in reply to: ↑ 6 ; follow-ups: ↓ 13 ↓ 15 ) 10/27/2007 10:15:22 AM changed by evands

Replying to cbarrett:

So I'm going to write a cache for this. On cache miss, if you have logs enabled, we'll get those, otherwise fail.

If we're logging, I think we shouldn't use the cache at all. It is -not- a common activity for most users to utilize applescript to look at previous messages; I don't think we should increase our already not-insignificant memory footprint by keeping in memory data we've written to disk to save a small disk access performance hit for a minority of users.

11/09/2007 08:27:52 AM changed by evands

Colin, what's our status on this? Do you want to do it in the 'soon' timeframe, or should we shift it to a later milestone?

11/09/2007 09:25:05 AM changed by cbarrett

  • milestone changed from Adium X 1.2 to Adium X 1.3.

We should move this to 1.3, this can wait. Might be able to get it done before then, but it's not gonna block the release

(in reply to: ↑ 10 ) 12/09/2007 07:15:37 AM changed by TheDodger

Replying to evands:

If we're logging, I think we shouldn't use the cache at all. It is -not- a common activity for most users to utilize applescript to look at previous messages;

What about dynamically switching between unencrypted logged chatting and encrypted and therefore not logged chatting?

12/09/2007 07:26:26 AM changed by TheDodger

Then there is a mention of dynamically switching between styles which could, if implemented as a per tab/window/contact setting, be a common activity. Just a thought...

(in reply to: ↑ 10 ; follow-up: ↓ 16 ) 02/07/2008 06:05:53 AM changed by cbarrett

Replying to evands:

Replying to cbarrett:

So I'm going to write a cache for this. On cache miss, if you have logs enabled, we'll get those, otherwise fail.

If we're logging, I think we shouldn't use the cache at all. It is -not- a common activity for most users to utilize applescript to look at previous messages; I don't think we should increase our already not-insignificant memory footprint by keeping in memory data we've written to disk to save a small disk access performance hit for a minority of users.

I disagree. First, having a rather large codepath like this that is just not used on pretty much every developer's machine is asking for trouble. Secondly keeping AIContentObjects is useful for a lot of things other than just this one applescript command. It could be used to actually increase performance by removing items from the WKMV and inserting the only when the user scrolls up, via AJAX techniques.

Thirdly, if the memory footprint hit isn't acceptable for people using logging, why is it acceptable for people not using logging? The cache will limit the global number of objects in it, so the footprint hit will be a known quantity (only a few MB).

(in reply to: ↑ 15 ) 02/07/2008 08:02:10 AM changed by cbarrett

Replying to cbarrett:

First, having a rather large codepath like this that is just not used on pretty much every developer's machine is asking for trouble.

I meant that no Adium developer runs with logs off. Not that we should only have code used by everyone.

02/07/2008 08:43:29 PM changed by evands

Looking back on old-Evan's comments, I think I was overestimating the memory impact of a sanely written cache. Evict after a sane number of entries, use logs on a cache miss if logging is enabled, and do our thing :) We really shouldn't be talking about massive memory usage since we'll have an eviction policy, unlike the old implementation which kept around every message's AIContentObject even if the chat had hundreds of messages.

(follow-up: ↓ 19 ) 05/02/2008 10:55:39 AM changed by Catfish_Man

This could be a little weird for AS, I think. It becomes "get some arbitrary number of past messages for this chat" rather than "get the past messages for this chat".

(in reply to: ↑ 18 ) 05/13/2008 04:40:41 PM changed by evands

Replying to Catfish_Man:

This could be a little weird for AS, I think. It becomes "get some arbitrary number of past messages for this chat" rather than "get the past messages for this chat".

Yeah... with logging off, we'd have no way of keeping messages around without them being in memory.

Could we do a DOM parse to pull messages back out of an open webkit chat window?

05/13/2008 05:12:48 PM changed by Catfish_Man

Not without making a non-backwards compatible change to the message style format. The current format provides extremely few guarantees about the structure of the page. One top-level element per message would help a lot, but dealing with consecutive messages, and determining which elements corresponded to which bits of data would still be tricky.

05/15/2008 08:38:10 AM changed by djmori

05/21/2008 02:49:33 AM changed by cbarrett

  • milestone changed from Adium X 1.3 to Adium X 1.4.

Punting again, whee.