2005-10-25 [paul] 1.9.15cvs104
authorPaul Mangan <paul@claws-mail.org>
Tue, 25 Oct 2005 12:09:08 +0000 (12:09 +0000)
committerPaul Mangan <paul@claws-mail.org>
Tue, 25 Oct 2005 12:09:08 +0000 (12:09 +0000)
* src/wizard.c
Always guess servers from the right-hand
email part and guess username from the
left-hand part. (Thanks to Colin)
add an X-Face to the welcome message

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/wizard.c

index e0c7a78..f46e13e 100644 (file)
@@ -1,3 +1,11 @@
+2005-10-25 [paul]      1.9.15cvs104
+
+       * src/wizard.c
+               Always guess servers from the right-hand
+               email part and guess username from the
+               left-hand part. (Thanks to Colin)
+               add an X-Face to the welcome message
+
 2005-10-25 [paul]      1.9.15cvs103
 
        * manual/handling.xml
index 3c2dc5f..a9b025e 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.4.2.21 -r 1.4.2.22 src/gtk/about.c;  ) > 1.9.15cvs101.patchset
 ( cvs diff -u -r 1.207.2.78 -r 1.207.2.79 src/folderview.c;  cvs diff -u -r 1.14.2.12 -r 1.14.2.13 src/grouplistdialog.c;  cvs diff -u -r 1.179.2.82 -r 1.179.2.83 src/imap.c;  cvs diff -u -r 1.5.2.11 -r 1.5.2.12 src/noticeview.c;  ) > 1.9.15cvs102.patchset
 ( cvs diff -u -r 1.1.2.1 -r 1.1.2.2 manual/handling.xml;  ) > 1.9.15cvs103.patchset
+( cvs diff -u -r 1.1.2.22 -r 1.1.2.23 src/wizard.c;  ) > 1.9.15cvs104.patchset
index 6cea0f1..d41d670 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=15
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=103
+EXTRA_VERSION=104
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 2bfc8ef..b4f7dcc 100644 (file)
@@ -141,6 +141,8 @@ static void initialize_fonts(WizardWindow *wizard)
        g_free(tmp);
 }
 
+#define XFACE "+}Axz@~a,-Yx?0Ysa|q}CLRH=89Y]\"')DSX^<6p\"d)'81yx5%G#u^o*7JG&[aPU0h1Ux.vb2yIjH83{5`/bVo|~nn/i83vE^E)qk-4W)_E.4Y=D*qvf/,Ci_=P<iY<M6"
+
 static void write_welcome_email(WizardWindow *wizard)
 {
        gchar buf_date[64];
@@ -162,11 +164,12 @@ static void write_welcome_email(WizardWindow *wizard)
                "To: %s <%s>\n"
                "Date: %s\n"
                "Subject: %s\n"
+               "X-Face: %s\n"
                "Content-Type: text/plain; charset=UTF-8\n",
                _("Sylpheed-Claws Team"),
                gtk_entry_get_text(GTK_ENTRY(wizard->full_name)),
                gtk_entry_get_text(GTK_ENTRY(wizard->email)),
-               buf_date, subj);
+               buf_date, subj, XFACE);
        body = g_strdup_printf(
                _("\n"
                "Welcome to Sylpheed-Claws\n"
@@ -221,6 +224,8 @@ static void write_welcome_email(WizardWindow *wizard)
        g_free(msg);
        g_unlink(file);
 }
+#undef XFACE
+
 static gboolean wizard_write_config(WizardWindow *wizard)
 {
        gboolean mailbox_ok = FALSE;
@@ -371,31 +376,37 @@ static gchar *get_default_email_addr(void)
 
 static gchar *get_default_server(WizardWindow * wizard, const gchar *type)
 {
-       gchar *domain_name = g_strdup(get_domain_name());
+       gchar *domain_name = NULL;
+       gchar *tmp = gtk_editable_get_chars(
+                       GTK_EDITABLE(wizard->email), 0, -1);
        gchar *result;
        
-       if (strchr(domain_name, '.') != strrchr(domain_name, '.')
-       && strlen(strchr(domain_name, '.')) > 6) {
-               gchar *tmp = g_strdup(strchr(domain_name, '.')+1);
-               g_free(domain_name);
-               domain_name = tmp;
-       } else if (strchr(domain_name, '.') == NULL) {
-               /* only hostname found, use email suffix */
-               gchar *mail;
-               mail = gtk_editable_get_chars(GTK_EDITABLE(wizard->email), 0, -1);
-
-               if (strlen (mail) && strstr(mail, "@")) {
-                       g_free(domain_name);
-                       domain_name = g_strdup(strstr(mail, "@")+1);
-               }
-               g_free(mail);
+       if (strstr(tmp, "@")) {
+               domain_name = g_strdup(strstr(tmp,"@")+1);
+       } else {
+               domain_name = g_strdup(get_domain_name());
        }
+       
+       g_free(tmp);
+
        result = g_strdup_printf("%s.%s",
                                type, domain_name);
        g_free(domain_name);
        return result;
 }
 
+static gchar *get_default_account(WizardWindow * wizard)
+{
+       gchar *result = gtk_editable_get_chars(
+                       GTK_EDITABLE(wizard->email), 0, -1);
+       
+       if (strstr(result, "@")) {
+               *(strstr(result,"@")) = '\0';
+       } 
+
+       return result;
+}
+
 static void wizard_email_changed(GtkWidget *widget, gpointer data)
 {
        WizardWindow *wizard = (WizardWindow *)data;
@@ -408,6 +419,10 @@ static void wizard_email_changed(GtkWidget *widget, gpointer data)
        gtk_entry_set_text(GTK_ENTRY(wizard->smtp_server), text);
        g_free(text);
 
+       text = get_default_account(wizard);
+       gtk_entry_set_text(GTK_ENTRY(wizard->recv_username), text);
+       g_free(text);
+
        if (protocol == A_POP3) {
                text = get_default_server(wizard, "pop");
                gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
@@ -421,6 +436,7 @@ static void wizard_email_changed(GtkWidget *widget, gpointer data)
                gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), mbox);
                g_free(mbox);
        }
+       
 }
 
 static GtkWidget* user_page (WizardWindow * wizard)
@@ -586,6 +602,10 @@ static GtkWidget* recv_page (WizardWindow * wizard)
                         1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);            
        i++;
        
+       text = get_default_account(wizard);
+       gtk_entry_set_text(GTK_ENTRY(wizard->recv_username), text);
+       g_free(text);
+
        wizard->recv_password = gtk_entry_new();
        wizard->recv_password_label = gtk_label_new(_("Password:"));
        gtk_table_attach(GTK_TABLE(table), wizard->recv_password_label,