Re: Balsa command line -a -attach option does not work



On 05/09/2006 03:33:40 PM, Peter Enseleit wrote:
Peter,

I am using balsa 2.3.8-1ubuntu2 on Ubuntu Dapper drake beta and no matter what i try I can't get any attachments to be included from the command line.

I tried balsa -m "" --attach "filename" but it still does not work.
[snip]

Maybe this is an Ubuntu package problem?

Ubuntu is still on 2.3.8 while Balsa is now at version 2.3.12

I can see it with current CVS, too. There is a bug in GOption handling. Attached patch fixes the problem for me.

Pawel
Index: src/main.c
===================================================================
RCS file: /cvs/gnome/balsa/src/main.c,v
retrieving revision 1.199
diff -u -r1.199 main.c
--- src/main.c	25 Feb 2006 17:58:22 -0000	1.199
+++ src/main.c	9 May 2006 15:19:29 -0000
@@ -201,8 +201,8 @@
 static void
 balsa_init(int argc, char **argv)
 {
-    static char *attachment = NULL;
 #ifndef GNOME_PARAM_GOPTION_CONTEXT
+    static char *attachment = NULL;
     int opt;
     poptContext context;
     static struct poptOption options[] = {
@@ -254,13 +254,14 @@
                        NULL);
 #else /* USE GOption interface */
     static gchar **remaining_args = NULL;
+    static gchar **attach_vect = NULL;
     static GOptionEntry option_entries[] = {
 	{"checkmail", 'c', 0, G_OPTION_ARG_NONE,
 	 &(cmd_check_mail_on_startup),
 	 N_("Get new mail on startup"), NULL},
 	{"compose", 'm', 0, G_OPTION_ARG_STRING, &(opt_compose_email),
 	 N_("Compose a new email to EMAIL ADDRESS"), "EMAIL ADDRESS"},
-	{"attach", 'a', 0, G_OPTION_ARG_STRING, &(attachment),
+	{"attach", 'a', 0, G_OPTION_ARG_FILENAME_ARRAY, &(attach_vect),
 	 N_("Attach file at PATH"), "PATH"},
 	{"open-mailbox", 'o', 0, G_OPTION_ARG_STRING,
          &(cmd_line_open_mailboxes),
@@ -305,6 +306,16 @@
         }
         g_strfreev (remaining_args);
         remaining_args = NULL;
+    }
+    if (attach_vect != NULL) {
+        gint i, num_args;
+        
+        num_args = g_strv_length (attach_vect);
+        for (i = 0; i < num_args; ++i) {
+            opt_attach_list = g_slist_append(opt_attach_list, attach_vect[i]);
+        }
+        g_free(attach_vect);
+        attach_vect = NULL;
     }
 #endif /* OPTION HANDLING */
     balsa_handle_automation_options();  



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]