enable 'dynamic' signatures
authorPaul Mangan <paul@claws-mail.org>
Tue, 21 Aug 2001 13:57:04 +0000 (13:57 +0000)
committerPaul Mangan <paul@claws-mail.org>
Tue, 21 Aug 2001 13:57:04 +0000 (13:57 +0000)
AUTHORS
ChangeLog.claws
src/compose.c

diff --git a/AUTHORS b/AUTHORS
index 1c6307f514c95bb9e7fa65707ecb5cb054731fc9..cd7c93df57ab0fbe411d5c09abe0f1f4989b0057 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -78,3 +78,4 @@ contributors (beside the above; based on Changelog)
        Henrik Carlqvist
        Don Quijote
        David Looney
        Henrik Carlqvist
        Don Quijote
        David Looney
+       Eric Limpens
index da468cef1c9fa66870bc1981af4d372f2c39bac9..b9e4af9c909e9d1a1d1a4ba865095694c1234f0e 100644 (file)
@@ -1,3 +1,11 @@
+2001-08-21 [paul]
+
+       * src/summaryview.c
+               remove unnecessary code
+       * src/compose.c
+               enable 'dynamic' signatures (submitted by
+               Eric Limpens <eric@hscg-internet.nl>)
+
 2001-08-21 [paul]
 
        clean up after sync with sylpheed 0.5.3 release
 2001-08-21 [paul]
 
        clean up after sync with sylpheed 0.5.3 release
index 919400b2957927d3735b160ed201ce0ae68bbb9e..6b6e624d183f7b3c9a2a7add77d8d80d5528d299 100644 (file)
@@ -1621,6 +1621,49 @@ static void compose_reedit_set_entry(Compose *compose, MsgInfo *msginfo)
 
 #undef SET_ENTRY
 
 
 #undef SET_ENTRY
 
+static void compose_exec_sig(Compose *compose, gchar *sigfile)
+{
+       FILE *tmpfp;
+       pid_t thepid;
+       gchar *sigtext;
+       FILE  *sigprg;
+       gchar  *buf;
+       size_t buf_len = 128;
+       if (strlen(sigfile) < 2)
+         return;
+       sigprg = popen(sigfile+1, "r");
+       if (sigprg) {
+
+               buf = g_malloc(buf_len);
+
+               if (!buf) {
+                       gtk_stext_insert(GTK_STEXT(compose->text), NULL, NULL, NULL, \
+                       "Unable to insert signature (malloc failed)\n", -1);
+
+                       pclose(sigprg);
+                       return;
+               }
+
+               while (!feof(sigprg)) {
+                       bzero(buf, buf_len);
+                       fread(buf, buf_len-1, 1, sigprg);
+                       gtk_stext_insert(GTK_STEXT(compose->text), NULL, NULL, NULL, buf, -1);
+               }
+
+               g_free(buf);
+               pclose(sigprg);
+       }
+       else
+       {
+               gtk_stext_insert(GTK_STEXT(compose->text), NULL, NULL, NULL, \
+               "Can't exec file: ", -1);
+               gtk_stext_insert(GTK_STEXT(compose->text), NULL, NULL, NULL, \
+               sigfile+1, -1);
+       }
+}
+
 static void compose_insert_sig(Compose *compose)
 {
        gchar *sigfile;
 static void compose_insert_sig(Compose *compose)
 {
        gchar *sigfile;
@@ -1632,7 +1675,7 @@ static void compose_insert_sig(Compose *compose)
                                      DEFAULT_SIGNATURE, NULL);
        }
 
                                      DEFAULT_SIGNATURE, NULL);
        }
 
-       if (!is_file_or_fifo_exist(sigfile)) {
+       if (!is_file_or_fifo_exist(sigfile) & (sigfile[0] != '|')) {
                g_free(sigfile);
                return;
        }
                g_free(sigfile);
                return;
        }
@@ -1645,7 +1688,14 @@ static void compose_insert_sig(Compose *compose)
                                "\n", 1);
        }
 
                                "\n", 1);
        }
 
-       compose_insert_file(compose, sigfile);
+       if (sigfile[0] == '|')
+       {
+               compose_exec_sig(compose, sigfile);
+       }
+       else
+       {
+               compose_insert_file(compose, sigfile);
+       }
        g_free(sigfile);
 }
 
        g_free(sigfile);
 }