Feature Requests item #1037228, was opened at 2004-09-29 19:25
Message generated for change (Comment added) made by eperez
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=350235&aid=1037228&group_id=235

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Eduardo Perez Ureta (eperez)
Assigned to: Richard Laager (rlaager)
Summary: use file hash as name (instead of rand number) in icon cache

Initial Comment:
use file hash as name (instead of random number) in
icon cache
this would allow to not have repeated icons on disk
(great if you don't like removing old icons)

now the icons are saved like ~/.gaim/icons/f076f565
better would be to use the MD5 or SHA1 hash like
~/.gaim/icons/9f1ff86ca817591160c043445e816264ccc9ae79

----------------------------------------------------------------------

>Comment By: Eduardo Perez Ureta (eperez)
Date: 2007-02-09 16:14

Message:
Logged In: YES 
user_id=60347
Originator: YES

Even better!
Now it does not save the icon if it is already in the cache!
File Added: gaim2_buddyicon_notremove.diff

----------------------------------------------------------------------

Comment By: Eduardo Perez Ureta (eperez)
Date: 2007-01-09 10:21

Message:
Logged In: YES 
user_id=60347
Originator: YES

Changes: now uses sha1
File Added: gaim2_buddyicon_notremove.diff

----------------------------------------------------------------------

Comment By: Eduardo Perez Ureta (eperez)
Date: 2007-01-08 17:34

Message:
Logged In: YES 
user_id=60347
Originator: YES

> Why wouldn't you want to remove icons from the cache?
Because I want to keep all the icons my buddies put but I do not want to
have them repeated.
I will take another look at http://gaim-album.sf.net (but I think that was
not the solution I wanted)

> there's no reason for the application to crash if the hash isn't
available for some reason.
So, what do I do if the SHA1 hash is not available? Use the old code?

I will make my patch refactor the extension generation code to not have
any code duplication.

But, I do not know when I will have the time to continue working on this
patch.

----------------------------------------------------------------------

Comment By: Richard Laager (rlaager)
Date: 2007-01-08 16:33

Message:
Logged In: YES 
user_id=156487
Originator: NO

Why wouldn't you want to remove icons from the cache? If they're unused,
they're wasting space. It's not like it increases efficiency, because if
someone uses one of those icons, it's still going to come over the network
from the server. If you want to save them to look at later, look at the
Gaim Album plugin, at http://gaim-album.sf.net

You don't need a hard error. While it should never happen, there's no
reason for the application to crash if the hash isn't available for some
reason. From the end user's point of view, it's going to be much worse.
>From our point of view, it'd be much harder to debug if we ever
accidentally made a release like that.

I'm not dead-set against adding a function for the extension generation
code, but it's probably unnecessary. If this ends up in the core (which it
will if done right), then the Gaim Album plugin could be reworked to just
keep the existing filename, which would greatly simplify it. We wouldn't
need to do any filename building in the plugin at all.

----------------------------------------------------------------------

Comment By: Eduardo Perez Ureta (eperez)
Date: 2007-01-07 23:06

Message:
Logged In: YES 
user_id=60347
Originator: YES

The point on this feature request is that I do not want to remove icons
from the cache (at least automatically).
I am using g_error because it is a hard check. If there is no sha1 code
the code will not work at all. gaim_debug_error does not seem to abort the
program. I just would like to check that the sha1 algorithm exists at
compilation time but the current integrated at gaim does not seem to allow
that.
Should the extension generation code be put in a function I can call,
instead of having to copy it?
like: gaim_buffer_get_type(const void *data, size_t len)

----------------------------------------------------------------------

Comment By: Richard Laager (rlaager)
Date: 2007-01-07 18:45

Message:
Logged In: YES 
user_id=156487
Originator: NO

Also, you shouldn't be using g_error(), I'd imagine. Use the gaim_debug_*
functions instead.

Finally, I think I use SHA-1 in the Gaim Album plugin, so you should use
that too. Also , you should copy the extension generation code (so files
will be .png, .gif, .jpg, etc.) That way the filenames will be the same,
which might be useful to someone (and it's certainly not harmful).

----------------------------------------------------------------------

Comment By: Richard Laager (rlaager)
Date: 2007-01-07 18:31

Message:
Logged In: YES 
user_id=156487
Originator: NO

Your patch changes the behavior so that icons are NEVER DELETED. This is
not good. Here's an idea of how you might solve this:

At startup, create a hashtable that links strings (icon filenames) to an
integer. Increment the integer for every time that icon file is referenced
by a blist entry. Decrement it when you remove a reference. Then change the
existing deletion code to check if the count is zero and then delete the
icon file.

----------------------------------------------------------------------

Comment By: Eduardo Perez Ureta (eperez)
Date: 2007-01-07 16:36

Message:
Logged In: YES 
user_id=60347
Originator: YES

I change code to use the great: gaim_util_write_data_to_file
File Added: gaim2_buddyicon_notremove.diff

----------------------------------------------------------------------

Comment By: Eduardo Perez Ureta (eperez)
Date: 2007-01-07 16:21

Message:
Logged In: YES 
user_id=60347
Originator: YES

I have attached a patch to implement this Feature Request.
File Added: gaim2_buddyicon_notremove.diff

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=350235&aid=1037228&group_id=235

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Gaim-features mailing list
Gaim-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gaim-features

Reply via email to