Rework and optimise the XFace/CFace code.
authorSteve Youngs <steve@emchat.org>
Sat, 30 May 2015 06:28:38 +0000 (16:28 +1000)
committerSteve Youngs <steve@emchat.org>
Sat, 30 May 2015 06:28:38 +0000 (16:28 +1000)
commit261046fb62c395bc9b3fd5720e3b1950d748ff54
tree1854604ea61d1882bad445cffa599313d4d23370
parent0f111109f36bef272b0369f6c61076239a4c9d8b
Rework and optimise the XFace/CFace code.

The old way of finding and displaying XFace/CFace avatar images was
to crawl through the entire bbdb each and every time an image was
needed. Pfft!

The NEW way is to do a specific search on the `icqnick' field a
(hopefully) maximum of once per contact, per emacs session.  Once
an avatar is found, it is stored in `emchat-world' for easier and
faster access from then on.

The `*-xface' defuns and vars were renamed to `*-avatar', which seems
to make more sense in this context.

It is also now possible to customise the fore/back colours of XFace
avatars (black on red looks pretty sexy, BTW).  See:
`emchat-buddy-xface-foreground' and `emchat-buddy-xface-background'

* emchat-buddy.el (top level): Autoload #'bbdb-search at compile
time.
(emchat-buddy-show-avatar): New, renamed from
`emchat-buddy-show-xface'.
(emchat-buddy-show-xface): Made obsolete.
(emchat-buddy-xface-foreground): New customisable variable.
(emchat-buddy-xface-background): New customisable variable.
(emchat-buddy-make-avatar): New.  Returns a glyph object from
either an X-Face or cface.
(emchat-buddy-show-avatar): New.  Replaces the now removed
`emchat-buddy-show-xface' function.  Uses #'bbdb-search instead of
walking through the entire bbdb.  Stores the cface/xface in
emchat-world.
(emchat-buddy-show-buffer): Use it.
(emchat-buddy-show-avatar-in-balloon): New.  Replaces
`emchat-buddy-show-xface-in-balloon'.  Gets the face info from
emchat-world instead of crawling through the bbdb.
(balloon-help-display-help): Use it.

* emchat-world.el (emchat-world-update): Ensure that avatars are
not lost.

* emchat-status.el (emchat-status-face): Autoload it.

Signed-off-by: Steve Youngs <steve@emchat.org>
emchat-buddy.el
emchat-status.el
emchat-world.el