_ RU.UNIX (2:5077/15.22) _____________________________________________ RU.UNIX _
From : Boris Tobotras 2:5020/510 12 Aug 98 08:41:10
Subj : Smilies in tkirc
________________________________________________________________________________
Кому в tkirc смайликов? Как в XEmacs? Hалетай:
- --- tkirc Wed Mar 11 18:35:28 1998
+++ /usr/local/bin/tkirc Tue Aug 11 18:52:17 1998
@@ -1964,7 +1963,70 @@
}
# no URLs and no MessageIDs in line
- $widget insert end "$line" $prestylenum
+ insertPlainLine $widget $line $prestylenum
+}
+
+proc insertPlainLine { widget line prestylenum } {
+
+ set GifDir "/usr/local/lib/tkirc/smilies/"
+
+ set rest $line
+ while { "$rest" != "" } {
+ if { [regexp {(.*)([8:;,.][-^]?[Oo*PpQqE|)(/])(.*)} $rest matchVar
pre smileBytes post] } {
+ $widget insert end $pre $prestylenum
+ switch -regexp $smileBytes {
+ {:[-^]?)} {
+ set smile "FaceHappy"
+ }
+ {:[-^]?(} {
+ set smile "FaceSad"
+ }
+ {:[-^]?[\/]} {
+ set smile "FaceIronic"
+ }
+ {;[-^]?)} {
+ set smile "FaceWinking"
+ }
+ {:[-^]?E} {
+ set smile "FaceAngry"
+ }
+ {:[-^]?|} {
+ set smile "FaceStraight"
+ }
+ {[:8][-^]?[Oo]} {
+ set smile "FaceStartled"
+ }
+ {[:;,][-^]?[PpQq]} {
+ set smile "FaceYukky"
+ }
+ {8[-^]?[)(|/]} {
+ set smile "FaceKOed"
+ }
+ default {
+ set smile "default"
+ }
+ }
+ # insert image with $smile into $widget
+ set imageFile "${GifDir}${smile}.gif"
+ if { [file readable $imageFile] } {
+ global smilies
+ if { [info exists smilies($smile)] } {
+ set smiley $smilies($smile)
+ } else {
+ set smiley [image create photo]
+ $smiley read $imageFile
+ set smilies($smile) $smiley
+ }
+ $widget image create end -image $smiley
+ } else {
+ $widget insert end $smileBytes $prestylenum
+ }
+ set rest $post
+ } else {
+ $widget insert end [string index $rest 0] $prestylenum
+ set rest [string range $rest 1 end]
+ }
+ }
}
proc print2log {destlog line} {
В /usr/local/lib/tkirc/smilies положить смайлики из
xemacs-20/etc/smilies, сконвертированные из xpm в gif. А, впрочем,
их всего ничего: