Enlightenment CVS committal

Author  : devilhorns
Project : e_modules
Module  : mail

Dir     : e_modules/mail


Modified Files:
        e_mod_config_box.c e_mod_main.c imap.c imap.h mbox.c mdir.c 
        pop.c 


Log Message:
Icon and label should now properly reflect new mail count from all mailboxes.
HandyAndE, let me know if your imap works with this or not.

===================================================================
RCS file: /cvs/e/e_modules/mail/e_mod_config_box.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_mod_config_box.c  13 Jun 2006 01:30:29 -0000      1.8
+++ e_mod_config_box.c  13 Jun 2006 12:24:07 -0000      1.9
@@ -244,8 +244,8 @@
        cb->port = 110;
        cb->ssl = 0;
        is_new = 1;
-     }
-   
+     }  
+ 
    if (cb->name) evas_stringshare_del(cb->name);
    if (cfdata->name != NULL)
      cb->name = evas_stringshare_add(cfdata->name);
@@ -291,14 +291,13 @@
      cb->cur_path = evas_stringshare_add(cfdata->cur_path);
    else
      cb->cur_path = evas_stringshare_add("");
-   
-   e_config_save_queue();
 
-   _mail_box_config_updated(prev_dlg);
+   if (!is_new)
+     e_config_save_queue();
 
    if (is_new) 
      {
-       cfd->data = cb;
+//     cfd->data = cb;
        mail_ci->boxes = evas_list_append(mail_ci->boxes, cb);
        e_config_save_queue();
        _mail_box_added(mail_ci->id, cb->name);
===================================================================
RCS file: /cvs/e/e_modules/mail/e_mod_main.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- e_mod_main.c        12 Jun 2006 20:45:10 -0000      1.24
+++ e_mod_main.c        13 Jun 2006 12:24:07 -0000      1.25
@@ -7,7 +7,7 @@
  * it under the terms of version 2 of the GNU General Public License as
  * published by the Free Software Foundation.
  *
- * This program is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it cwill be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
@@ -487,7 +487,6 @@
    int have_imap = 0, have_pop = 0;
    
    if (!inst) return 1;
-   inst->count = 0;
    
    ci = _mail_config_item_get(inst->gcc->id);
    if (!ci->boxes) return 1;
@@ -520,13 +519,29 @@
 _mail_set_text(void *data) 
 {
    Instance *inst = data;
+   Config_Item *ci;
+   Evas_List *l;
    char buf[1024];
+   int count = 0;
    
    if (!inst) return;
+
+   ci = _mail_config_item_get(inst->gcc->id);
+   if (!ci) return;
+   for (l = ci->boxes; l; l = l->next) 
+     {
+       Config_Box *cb;
+       
+       cb = l->data;
+       if (!cb) continue;
+       count += cb->num_new;
+     }
+
+   printf("Count: %i\n", count);
    
-   if (inst->count > 0) 
+   if (count > 0) 
      {
-       snprintf(buf, sizeof(buf), "%d", inst->count);
+       snprintf(buf, sizeof(buf), "%d", count);
        edje_object_part_text_set(inst->mail->mail_obj, "new_label", buf);
        edje_object_signal_emit(inst->mail->mail_obj, "new_mail", "");
      }
===================================================================
RCS file: /cvs/e/e_modules/mail/imap.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- imap.c      12 Jun 2006 20:45:10 -0000      1.4
+++ imap.c      13 Jun 2006 12:24:07 -0000      1.5
@@ -182,7 +182,6 @@
 {
    Ecore_Con_Event_Server_Del *ev = event;
    ImapServer *is;
-   Instance *inst;
    
    is = _mail_imap_server_get(ev->server);
    if (!is) return 1;
@@ -194,10 +193,6 @@
    
    ecore_con_server_del(is->server);
    is->server = NULL;
-
-   inst = is->data;
-   inst->count += is->count;
-   _mail_set_text(inst);
    
    return 0;
 }
@@ -208,7 +203,6 @@
    Ecore_Con_Event_Server_Data *ev = event;
    ImapServer *is;
    ImapClient *ic;
-   Instance *inst;
    int len, num = 0, total = 0;
    char in[1024], out[1024], *spc;
    size_t slen;
@@ -256,9 +250,10 @@
       case IMAP_STATE_STATUS_OK:
        if (sscanf(in, "* STATUS %*s (MESSAGES %i UNSEEN %i)", &total, &num) == 
2) 
          {
-            is->count += num;
             ic->config->num_new = num;
             ic->config->num_total = total;
+            _mail_set_text(is->data);
+
             if ((num > 0) && (ic->config->use_exec) && (ic->config->exec))
               _mail_start_exe(ic->config);
             
===================================================================
RCS file: /cvs/e/e_modules/mail/imap.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- imap.h      11 Jun 2006 17:37:53 -0000      1.1
+++ imap.h      13 Jun 2006 12:24:07 -0000      1.2
@@ -21,7 +21,7 @@
    Ecore_Con_Server *server;
    Evas_List *clients;
    ImapClient *current;
-   int cmd, count;
+   int cmd;
    ImapState state;
    void *data;
    
===================================================================
RCS file: /cvs/e/e_modules/mail/mbox.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- mbox.c      12 Jun 2006 20:45:10 -0000      1.3
+++ mbox.c      13 Jun 2006 12:24:07 -0000      1.4
@@ -74,7 +74,6 @@
    char buf[1024];
    int total = 0, unread = 0;
    int header;
-   Instance *inst;
    
    mb = data;
    if (!mb) return;
@@ -104,9 +103,7 @@
      }
    fclose(f);
 
-   inst = mb->data;
-   inst->count += mb->config->num_new;
-   _mail_set_text(inst);
+   _mail_set_text(mb->data);
    if ((mb->config->num_new > 0) && (mb->config->use_exec) && 
(mb->config->exec))
      _mail_start_exe(mb->config);
 }
===================================================================
RCS file: /cvs/e/e_modules/mail/mdir.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- mdir.c      12 Jun 2006 20:45:10 -0000      1.3
+++ mdir.c      13 Jun 2006 12:24:07 -0000      1.4
@@ -68,7 +68,6 @@
 _mail_mdir_check_mail(void *data, Ecore_File_Monitor *monitor, 
Ecore_File_Event event, const char *path) 
 {
    MdirClient *mc;
-   Instance *inst;
    
    mc = data;
    if (!mc) return;
@@ -76,9 +75,7 @@
    mc->config->num_total = _mail_mdir_get_files(mc->config->cur_path);
    mc->config->num_new = _mail_mdir_get_files(mc->config->new_path);
 
-   inst = mc->data;
-   inst->count += mc->config->num_new;
-   _mail_set_text(inst);
+   _mail_set_text(mc->data);
    if ((mc->config->num_new > 0) && (mc->config->use_exec) && 
(mc->config->exec))
      _mail_start_exe(mc->config);
 }
===================================================================
RCS file: /cvs/e/e_modules/mail/pop.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- pop.c       12 Jun 2006 20:45:10 -0000      1.3
+++ pop.c       13 Jun 2006 12:24:07 -0000      1.4
@@ -123,7 +123,6 @@
 {
    Ecore_Con_Event_Server_Del *ev = event;
    PopClient *pc;
-   Instance *inst;
    
    pc = _mail_pop_client_get_from_server(ev->server);
    if (!pc) return 1;
@@ -143,7 +142,6 @@
 {
    Ecore_Con_Event_Server_Data *ev = event;
    PopClient *pc;
-   Instance *inst;
    char in[2048], out[2048];
    int len, num = 0, total = 0;
    
@@ -151,8 +149,6 @@
    if (!pc) return 1;
    if (pc->state == POP_STATE_DISCONNECTED) return 1;
    
-   inst = pc->data;
-   
    len = sizeof(in) -1;
    len = (((len) > (ev->size)) ? ev->size : len);
    memcpy(in, ev->data, len);
@@ -192,7 +188,6 @@
             pc->config->num_new = num;
             pc->config->num_total = num;
          }
-       inst->count += num;
        _mail_pop_client_quit(pc);
        if ((num > 0) && (pc->config->use_exec) && (pc->config->exec))
          _mail_start_exe(pc->config);




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

Reply via email to