Enlightenment CVS committal

Author  : devilhorns
Project : e_modules
Module  : mail

Dir     : e_modules/mail


Modified Files:
        e_mod_config.c e_mod_main.c e_mod_main.h 


Log Message:
Added port and ssl as a config option.
Removed some frees in e_mod_config that may have been causing segfaults.

Users will need to remove old module config.

===================================================================
RCS file: /cvs/e/e_modules/mail/e_mod_config.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_mod_config.c      7 Jun 2006 19:43:59 -0000       1.1
+++ e_mod_config.c      7 Jun 2006 21:47:57 -0000       1.2
@@ -5,6 +5,7 @@
 {
    int show_label;
    int use_exec;
+   int use_ssl;
    int type;
    double check_time;
    
@@ -14,6 +15,7 @@
    char *pass;
    char *path;
    char *path_current;
+   char *port;
    
    Evas_Object *new_path_label;
    Evas_Object *new_path_entry;
@@ -55,12 +57,15 @@
 static void
 _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata) 
 {
+   char buf[1024];
+   
    cfdata->host = NULL;
    cfdata->user = NULL;
    cfdata->pass = NULL;
    cfdata->exec = NULL;
    cfdata->path = NULL;
    cfdata->path_current = NULL;
+   cfdata->port = NULL;
    
    if (ci->host)
      cfdata->host = strdup(ci->host);
@@ -79,6 +84,10 @@
    cfdata->type = ci->type;
    cfdata->use_exec = ci->use_exec;
    cfdata->check_time = ci->check_time;
+   cfdata->use_ssl = ci->use_ssl;
+   
+   snprintf(buf, sizeof(buf), "%d", ci->port);
+   cfdata->port = strdup(buf);
 }
 
 static void *
@@ -98,12 +107,6 @@
 {
    if (!mail_config) return;
    mail_config->config_dialog = NULL;
-   free(cfdata->host);
-   free(cfdata->user);
-   free(cfdata->pass);
-   free(cfdata->exec);
-   free(cfdata->path);
-   free(cfdata->path_current);
    free(cfdata);
 }
 
@@ -154,26 +157,34 @@
    e_widget_list_object_append(o, of, 1, 1, 0.5);   
    
    of = e_widget_frametable_add(evas, _("Mailbox Settings"), 1);
-   ob = e_widget_label_add(evas, _("Mail Host:"));
+   ob = e_widget_label_add(evas, _("Port:"));
    e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 0, 0, 1, 0);
-   ob = e_widget_entry_add(evas, &cfdata->host);
+   ob = e_widget_entry_add(evas, &cfdata->port);
    e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 0, 0, 1, 0);
 
-   ob = e_widget_label_add(evas, _("Username:"));
+   ob = e_widget_check_add(evas, _("Use SSL"), &(cfdata->use_ssl));
    e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 0, 0, 1, 0);
+
+   ob = e_widget_label_add(evas, _("Mail Host:"));
+   e_widget_frametable_object_append(of, ob, 0, 3, 1, 1, 0, 0, 1, 0);
+   ob = e_widget_entry_add(evas, &cfdata->host);
+   e_widget_frametable_object_append(of, ob, 1, 3, 1, 1, 0, 0, 1, 0);
+
+   ob = e_widget_label_add(evas, _("Username:"));
+   e_widget_frametable_object_append(of, ob, 0, 4, 1, 1, 0, 0, 1, 0);
    ob = e_widget_entry_add(evas, &cfdata->user);
-   e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 0, 0, 1, 0);
+   e_widget_frametable_object_append(of, ob, 1, 4, 1, 1, 0, 0, 1, 0);
 
    ob = e_widget_label_add(evas, _("Password:"));
-   e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 0, 0, 1, 0);
+   e_widget_frametable_object_append(of, ob, 0, 5, 1, 1, 0, 0, 1, 0);
    ob = e_widget_entry_add(evas, &cfdata->pass);
    e_widget_entry_password_set(ob, 1);
-   e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 0, 0, 1, 0);
+   e_widget_frametable_object_append(of, ob, 1, 5, 1, 1, 0, 0, 1, 0);
    
    cfdata->new_path_label = e_widget_label_add(evas, _("New Mail Path:"));
-   e_widget_frametable_object_append(of, cfdata->new_path_label, 0, 3, 1, 1, 
0, 0, 1, 0);
+   e_widget_frametable_object_append(of, cfdata->new_path_label, 0, 6, 1, 1, 
0, 0, 1, 0);
    cfdata->new_path_entry = e_widget_entry_add(evas, &cfdata->path);
-   e_widget_frametable_object_append(of, cfdata->new_path_entry, 1, 3, 1, 1, 
0, 0, 1, 0);
+   e_widget_frametable_object_append(of, cfdata->new_path_entry, 1, 6, 1, 1, 
0, 0, 1, 0);
    if (cfdata->type == 0) 
      {
        e_widget_disabled_set(cfdata->new_path_label, 1);
@@ -181,9 +192,9 @@
      }
 
    cfdata->cur_path_label = e_widget_label_add(evas, _("Current Mail Path:"));
-   e_widget_frametable_object_append(of, cfdata->cur_path_label, 0, 4, 1, 1, 
0, 0, 1, 0);
+   e_widget_frametable_object_append(of, cfdata->cur_path_label, 0, 7, 1, 1, 
0, 0, 1, 0);
    cfdata->cur_path_entry = e_widget_entry_add(evas, &cfdata->path_current);
-   e_widget_frametable_object_append(of, cfdata->cur_path_entry, 1, 4, 1, 1, 
0, 0, 1, 0);
+   e_widget_frametable_object_append(of, cfdata->cur_path_entry, 1, 7, 1, 1, 
0, 0, 1, 0);
    if ((cfdata->type == 0) || (cfdata->type == 2)) 
      {
        e_widget_disabled_set(cfdata->cur_path_label, 1);
@@ -201,37 +212,37 @@
    
    ci = cfd->data;
 
-   if (ci->host) evas_stringshare_del(ci->host);
+   evas_stringshare_del(ci->host);
    if (cfdata->host != NULL)
      ci->host = evas_stringshare_add(cfdata->host);
    else
      ci->host = evas_stringshare_add("");
 
-   if (ci->user) evas_stringshare_del(ci->user);
+   evas_stringshare_del(ci->user);
    if (cfdata->user != NULL)
      ci->user = evas_stringshare_add(cfdata->user);
    else
      ci->user = evas_stringshare_add("");
 
-   if (ci->pass) evas_stringshare_del(ci->pass);
+   evas_stringshare_del(ci->pass);
    if (cfdata->pass != NULL)
      ci->pass = evas_stringshare_add(cfdata->pass);
    else
      ci->pass = evas_stringshare_add("");
 
-   if (ci->path) evas_stringshare_del(ci->path);
+   evas_stringshare_del(ci->path);
    if (cfdata->path != NULL)
      ci->path = evas_stringshare_add(cfdata->path);
    else
      ci->path = evas_stringshare_add("");
 
-   if (ci->path_current) evas_stringshare_del(ci->path_current);
+   evas_stringshare_del(ci->path_current);
    if (cfdata->path_current != NULL)
      ci->path_current = evas_stringshare_add(cfdata->path_current);
    else
      ci->path_current = evas_stringshare_add("");
 
-   if (ci->exec) evas_stringshare_del(ci->exec);   
+   evas_stringshare_del(ci->exec);   
    if (cfdata->exec != NULL)
      ci->exec = evas_stringshare_add(cfdata->exec);
    else
@@ -241,6 +252,13 @@
    ci->type = cfdata->type;
    ci->use_exec = cfdata->use_exec;
    ci->check_time = cfdata->check_time;
+
+   if (cfdata->port != NULL)
+     ci->port = atoi(cfdata->port);
+   else
+     ci->port = 110;
+
+   ci->use_ssl = cfdata->use_ssl;
    
    e_config_save_queue();
    _mail_config_updated(ci->id);
===================================================================
RCS file: /cvs/e/e_modules/mail/e_mod_main.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_mod_main.c        7 Jun 2006 21:15:06 -0000       1.2
+++ e_mod_main.c        7 Jun 2006 21:47:57 -0000       1.3
@@ -218,8 +218,13 @@
 {
    Instance *inst;
    Evas_Event_Mouse_Down *ev;
+   Config_Item *ci;
    
    inst = data;
+   if (!inst) return;
+   
+   ci = _mail_config_item_get(inst->gcc->id);
+   
    ev = event_info;
    if ((ev->button == 3) && (!mail_config->menu)) 
      {
@@ -318,6 +323,7 @@
    ci->type = MAIL_TYPE_POP;
    ci->use_exec = 0;
    ci->check_time = 15.0;
+   ci->use_ssl = 0;
    
    mail_config->items = evas_list_append(mail_config->items, ci);
    return ci;
@@ -347,6 +353,7 @@
    E_CONFIG_VAL(D, T, path_current, STR);
    E_CONFIG_VAL(D, T, show_label, UCHAR);
    E_CONFIG_VAL(D, T, use_exec, UCHAR);
+   E_CONFIG_VAL(D, T, use_ssl, UCHAR);
    E_CONFIG_VAL(D, T, type, INT);
    E_CONFIG_VAL(D, T, check_time, DOUBLE);
    
@@ -377,6 +384,8 @@
        ci->type = MAIL_TYPE_POP;       
        ci->use_exec = 0;
        ci->check_time = 15.0;
+       ci->use_ssl = 0;
+       
        mail_config->items = evas_list_append(mail_config->items, ci);
      }
    mail_config->module = m;
@@ -476,8 +485,9 @@
 {
    Instance *inst;
    Config_Item *ci;
-
+   Ecore_Con_Type type = ECORE_CON_REMOTE_SYSTEM;
    inst = data;
+   
    ci = _mail_config_item_get(inst->gcc->id);
    if ((!ci->host) || (!ci->user) || (!ci->pass)) return 0;
 
@@ -486,7 +496,9 @@
    
    if ((ci->host) && (ci->port != 0)) 
      { 
-       inst->server = ecore_con_server_connect(ECORE_CON_REMOTE_SYSTEM, 
ci->host, ci->port, inst);
+       if (ci->use_ssl)
+         type |= ECORE_CON_USE_SSL;
+       inst->server = ecore_con_server_connect(type, ci->host, ci->port, inst);
        inst->state = STATE_DISCONNECTED;
      }
    return 1;
===================================================================
RCS file: /cvs/e/e_modules/mail/e_mod_main.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_mod_main.h        7 Jun 2006 19:43:59 -0000       1.1
+++ e_mod_main.h        7 Jun 2006 21:47:57 -0000       1.2
@@ -22,6 +22,7 @@
 
    unsigned char show_label;
    unsigned char use_exec;
+   unsigned char use_ssl;
    const char *exec;
    double check_time;
    




_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to