* Reverted changes for bug 85454 since it adds another bugs
[modest] / src / maemo / easysetup / modest-presets.c
index 0a6df35..7dc7c64 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <string.h> /* for strcmp */
 #include "modest-presets.h"
+#include <stdio.h>
 
 /* Include config.h so that _() works: */
 #ifdef HAVE_CONFIG_H
@@ -43,7 +44,8 @@
 #define MODEST_PRESETS_KEY_OUTGOING            "OutgoingMailServer"
 #define MODEST_PRESETS_KEY_MAILBOX_TYPE        "MailboxType"
 #define MODEST_PRESETS_KEY_APOP                "APOPSecureLogin"
-#define MODEST_PRESETS_KEY_SECURE_SMTP         "SecureSMTP"
+#define MODEST_PRESETS_KEY_SECURE_SMTP         "SecureSmtp"
+#define MODEST_PRESETS_KEY_SMTP_PORT           "SmtpPort"
                                                    
 
 ModestPresets*
@@ -62,8 +64,6 @@ modest_presets_new (const gchar *presetfile)
                g_free (presets);
                return NULL;
        }
-
-       /* TODO: Unobfuscate an obfuscated file and then load it with g_key_file_load_from_data() instead. */
        
        if (!g_key_file_load_from_file (presets->keyfile, presetfile,
                                        G_KEY_FILE_NONE, &err)) {
@@ -115,10 +115,12 @@ modest_presets_get_providers  (ModestPresets *self, guint mcc,
        };
                
        /* return *all* providers? */
+       /*
        if (mcc == 0 && include_globals) {
                *provider_ids = all_provider_ids;
                return all_providers;
        }
+       */
        
        /* nope: filter them */
 
@@ -265,28 +267,42 @@ modest_presets_get_info_server_security (ModestPresets *self, const gchar *provi
                                             MODEST_PRESETS_KEY_OUTGOING, NULL);
                if (val) {
                        g_free (val);
-                       info |= MODEST_PRESETS_SECURITY_SECURE_SMTP;
                        
                        val = g_key_file_get_string (self->keyfile, provider_id,
                                                     MODEST_PRESETS_KEY_SECURE_SMTP, NULL);
+                       /* printf("debug: %s: provider_id=%s, secure-smtp val=%s\n", __FUNCTION__, provider_id, val); */
                        if (val && strcmp(val,"true") == 0)
                                info |= MODEST_PRESETS_SECURITY_SECURE_SMTP;
                        g_free(val);
                }
        }
 
-       /* debug */
-/*     g_message ("provider id: %s, apop:%s, secure-incoming:%s, altport: %s, secure-smtp: %s", */
-/*                provider_id, */
-/*                info & MODEST_PRESETS_SECURITY_APOP ? "yes" : "no", */
-/*                info & MODEST_PRESETS_SECURITY_SECURE_INCOMING ? "yes" : "no", */
-/*                info & MODEST_PRESETS_SECURITY_SECURE_INCOMING_ALTERNATE_PORT ? "yes" : "no", */
-/*                info & MODEST_PRESETS_SECURITY_SECURE_SMTP ? "yes" : "no"); */
-
        return info;
 }
 
-                                                       
+
+/*
+ * at the moment, this only for mac.com, which have a special SMTP port
+ */
+guint
+modest_presets_get_port (ModestPresets *self, const gchar* provider_id,
+                        gboolean incoming_server)
+{
+       guint port;
+       
+       g_return_val_if_fail (self && self->keyfile, 0);
+
+       if (incoming_server)
+               port = 0; /* not used yet */
+       else 
+               port = (guint)g_key_file_get_integer (self->keyfile, provider_id,
+                                                     MODEST_PRESETS_KEY_SMTP_PORT, NULL);
+
+       return port;
+}
+
+
+
 
        
 void