Smilies in tkirc (patch irc)
Ключевые слова: patch, irc,  (найти похожие документы)
_ 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. А, впрочем,
  их всего ничего:
begin 664 smilies.tar.gz
M'XL("/0JT34"`W-M:6QI97,N=&%R`.V<6T@441C')]/:3,(NI`75K.9E+=VY
M[IA19(67RBW-K0Q-QW7;'=UVM]G99(L>3(@LBHHD"RU31*T>#+,K!$4/1CX$
M8?5@5Y)N+T64!5'M1?+6;9M<=H;O_S*<<Q;VX?`[___Y/F8<=EYMMNI9L]K,
M%:N%,H[7J^U;.#-GL*N1_R24PAB:1A'4+6S8LW^`:F@-A1,X3E`HBE,$0R(H
MC?A!#KO`\BB*\%:K\+O?_6E=HG+\9O_36+TAU6+DG4E&;K.(_\`Q3$-1O]Y_
MG-1X]Q]C*(Q@7!,:!F,0%(/]'W6E9Z8E+V##D##DW1CW^-NW_@7EYV#71!`R
MWSUPKU<,7@V*/A(RH7S&G)Q*:F:X:M.G#[,KYCS//=YR,"-MXYE7446=^:%K
M$60A`I(X_\L-VUP#NTG,$>`3_R3AFF!(A@#^`YK_56B]XIZQ=N6YV:F5;5V+
M>O/RW^<^-VH?$X:H716'=G7?*HX`_J7/?[K5NMFO_D]2'O_',>!?(O[_UM:E
M*)U5H=M=E1>9L->P_7YG0<--%/Q?'OSSG,7"68S^\W_:[?\4A@/_$N/_HTI;
MDUUXL6/B/OYH/+[GQC3@7_K\9[`VFW_]GX;[OV3]/R.A,")E^L(DX%\N_&?R
M5@NG%W<`_(/_8S3XO]3XC\VI69;0LR#IH0GROVSX7[G:4"+2_GWDWU/_IVBH
M_TF%__#H1XIG7Y*/O:^J[JMCF^/7-2>M/XVW"^#_,N!?ZV1-H\\_,\`_A;GY
MIPG@W]_\![G'.IW."[F7_[%#^?^Q&C2W=OR$<I7:S?^:IS<.73V17:A8'&K<
M>OUUP9W3=&2XT-6$A<`!('G^U[*B[?\O^*>'\T^24/\/:/^/^DG^/S#)N;'F
MTB;#@[:)E?&KQ@#]<N#?18=@%G<'\"G_4[BW_D\#_Q*[_X]+Z$W?6;<GL>#E
MAH@W1"S<_^7!/\]R1I,PNOQ3(_G7`/^!S+_R%_[?5+Z_)V9%6`.$?WGPG\N:
MRT2V_WW,_Q[^"9P$_J67_UMMQ5>$1_?/)C9V+87\+P_^[<*H]_\I;!#_A*?_
M3P#_`5W_BQFH__W(_^,:HX-+.XI"KPB-CJHI4`*0`__K.8L?_%\SC'\7_E#_
ME\S]'RM(2>O35=]-C6R)GW&X=?J\:QDJW+X%^G]RX%_TVW^^YG^/_[N>P+_T
M\G^3[>0E5_YO@_PO%_[S'&5E_LW_I"?_D\"_5/)___N_U7$'M"U+>J:>?QS2
M4=H>HK2K(/]+FW^]U>;DQ1;__XI_<MCW'QB,@OZ?G_D_A7C]OU_*KY.RV!(#
M6LX))C0],VO-R$0P-`5,N[#C18_N25S*Y&YE_>66!H<S^[8)C@`0"`0"@4`@
-$"B`]!T_%%S2`%``````
`
end
-- 
  Best regards, -- Boris.
Between two evils, I always pick the one I never tried before.
--- Gnus v5.5/XEmacs 20.3 - "London"
 * Origin: Linux inside (2:5020/510@fidonet)