disclaimer: this is a quick and dirty hack!
this hack is still in development and it really doesnt work without retrieving before the vcard of the contact you want to see his avatar.
anyway, you can go around a while:
(there are 3 steps for now)
1. paste this two procedures at bottom of the file "userinfo.tcl", just before the hooks:
proc userinfo::is_foto_image {jid} {
variable userinfo
if {[info exists userinfo(photo_use,$jid)]} {
return $userinfo(photo_use,$jid)
#return text "image" if foto available
}
}
proc userinfo::foto_binval {jid} {
variable userinfo
if {[info exists userinfo(photo_use,$jid)]} {
return $userinfo(photo_binval,$jid)
}
}2. in "avatars.tcl" paste the following procedure:
proc ::avatar::get_image {xlib jid} {
variable avatar
if {[info exists avatar(hash,$xlib,$jid)]} {
if {![info exists avatar(data,$xlib,$jid)]} {
image create photo avatar$xlib@$jid
get $xlib $jid
} elseif {$avatar(needupdate,$xlib,$jid)} {
get $xlib $jid
}
return avatar$xlib@$jid
} else {
return [image create photo -data [userinfo::foto_binval $jid] -height 96 -width 96]
}
}
3. in "chats.tcl" replace the line
pack $cw.isw -fill both -expand yes -side bottom -in $dowwith the following 4 lines:
pack $cw.isw -fill both -expand yes -side left -in $dow
set avatar_img [avatar::get_image $xlib $jid]
label $cw.avatar -image $avatar_img
pack $cw.avatar -side right -in $dowthat's all. restart Tkabber and pray! :D
TODO
====
* display the avatar without retrieving before the vcard
* resizing correctly the avatar if the user pic is big
2 comments (+add yours?)
Use plugin for it :-)
http://ru.tkabber.jabe.ru/images/ru.tkabber.jabe.ru/6/68/Vcardavatars.zip
En el punto 2.
Ese procedimiento ya existe en el archivo avatars.tcl
solo cambia una linea respecto el tuyo.
el original dice return “”, mientras que el tuyo dice return [image create photo -data [userinfo::foto_binval $jid] -height 96 -width 96]
Asi que ahi solo sería cambiar esa linea para no repetir proc
Post new comment