PATCH: balsa-subject



hello,

doesnt it often happen, that you sit at home, write some mails
to annoying people :-) press send and anfterwards figure out
that you forget to enter the subject ? well at least it often
happens here. this little patch named

balsa-subject.patch

which was made for todays CVS solves this issue. it forces the
user to enter not only FROM and TO it also waits that there is
an subject entered.

this patch works perfectly is cleanly implemented. it also solves
some previous issues with implementing the GList correctly.

neverthless this isnt the SOLUTION in how it should behave really.

a) it uses the 'is_ready_to_send(BalsaSendmsg * bsmsg)' which also
   checks for '@' signs in the text entered. but this shouldnt be
   a problem at all.

b) i dont know if this is RFC conform at all :)

c) the right way would look like this. if you press either send,
   postphone or queue, then at least a function should check for
   an empty subject then open a dialog where you can enter the
   subject or leave it empty.

-- 
Name....: Ali Akcaagac
Status..: Student Of Computer & Economic Science
E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
--- balsa/src/sendmsg-window.c.orig	Tue Oct  2 14:16:29 2001
+++ balsa/src/sendmsg-window.c	Tue Oct  2 15:23:18 2001
@@ -1106,6 +1106,9 @@
 
     /* Subject: */
     create_string_entry(table, _("Subject:"), 2, msg->subject);
+    gtk_signal_connect(GTK_OBJECT(msg->subject[1]), "changed",
+		       GTK_SIGNAL_FUNC(check_readiness), msg);
+
     /* cc: */
     create_email_entry(table, _("Cc:"), 3, GNOME_STOCK_MENU_BOOK_YELLOW,
 		       msg, msg->cc);
@@ -2115,44 +2118,41 @@
 is_ready_to_send(BalsaSendmsg * bsmsg)
 {
     GList* list = NULL;
-    GList* l;
-    gchar *tmp;
     size_t len;
 
     list = g_list_append(list, gtk_entry_get_text(GTK_ENTRY(bsmsg->to[1])));
-    l = list =
-        g_list_append(list, gtk_entry_get_text(GTK_ENTRY(bsmsg->from[1])));
+    list = g_list_append(list, gtk_entry_get_text(GTK_ENTRY(bsmsg->from[1])));
+    list = g_list_append(list, gtk_entry_get_text(GTK_ENTRY(bsmsg->subject[1])));
 
     while (list) {
-        tmp = (gchar*) list->data;
-        len = strlen(tmp);
-        
-        if (len < 1) {		/* empty */
-            g_list_free(l);
-            return FALSE;
-        }
-        
+	len = strlen((gchar*) list->data);
 
-        if (tmp[len - 1] == '@') {	/* this shouldn't happen */
-            g_list_free(l);
-            return FALSE;
-        }
-        
-        if (len < 4) {
-            if (strchr(tmp, '@')) {	
-                /* you won't have an @ in an address less than 4
-                   characters */
-                g_list_free(l);
-                return FALSE;
-            }
-            
-            /* assume they are mailing it to someone in their local domain */
-        }
+	if (len < 1) {
+	/* empty */
+	    g_list_free(list);
+	    return FALSE;
+	}
+
+	if (((gchar*) list->data)[len - 1] == '@') {
+	/* this shouldn't happen */
+	    g_list_free(list);
+	    return FALSE;
+	}
 
-        list = g_list_next(list);
+	if (len < 4) {
+	    if (strchr((gchar*) list->data, '@')) {
+	    /* you won't have an @ in an address less than 4 characters */
+		g_list_free(list);
+		return FALSE;
+	    }
+
+	/* assume they are mailing it to someone in their local domain */
+	}
+
+	list = g_list_next(list);
     }
-    
-    g_list_free(l);
+
+    g_list_free(list);
     return TRUE;
 }
 


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