% Filename: slrnface.sl % Comments by Troy Piggins: % X-Face macro by Jurriaan Kalkman from the slrn-user mailing list on 20/1/02 % http://sourceforge.net/mailarchive/message.php?msg_id=1078106 % % Some of his links to the view-x-face.sh script are old % Latest can be obtained here: % http://www.spinnaker.de/mutt/view-x-face % http://www.spinnaker.de/mutt/image2ascii define show_xface() { save_current_article("/tmp/art_xfce"); variable header_file, xfce_file; variable fp, xfce_fp; variable line, face; fp = fopen ("/tmp/art_xfce", "r"); if (fp == NULL) return; while (-1 != fgets (&line, fp)) { % X-Face can appear anywhere, even in the subject line % and I've seen it CaPitaLizED differently, even. % Compare first 7 characters of line with X-FACE: if (strncmp(substr(strup(line), 1, 7), "X-FACE:", 7) == 0) { % write headerline with xface xfce_fp = fopen("/tmp/hdr_xface", "w"); if (xfce_fp == NULL) return; () = fputs(line, xfce_fp); () = fputs("\n", xfce_fp); () = fclose(xfce_fp); % display it % TJP: check the path to view-x-face xfce_fp = popen ("cat /tmp/hdr_xface | /usr/local/bin/view-x-face", "r"); if (xfce_fp == NULL) return; popup_window ("X-Face:", strjoin (fgetslines(xfce_fp), "")); () = pclose (xfce_fp); break; } } () = system ("rm -f /tmp/art_xfce /tmp/hdr_xface /tmp/rslt_xface"); % No need to close files unless we want to check for errors. When % file pointer variables go out of scope, slang will close the file. } definekey ("show_xface", "x", "article"); % EOF vim:ft=slang