Nicolas H. wrote:
> Hello everyone here,
> 
> 
> I hope it's the right place to send this, I was recommended to do so on
> the #e irc.
> 
> So, I already have used the mail module in the past and I remember it
> used to display the number of new (unread) e-mails of my mailbox, using
> pop3. This seems quite expected. I would be really surprised if I'm
> wrong about this.
> 
> Yesterday I tried it again but this time instead of displaying the
> number of unread e-mails, it displays the total number of e-mails. Which
> I find weird (is it really the purpose of the mail module ?).
> 
> So I checked the source code here :
> http://trac.enlightenment.org/e/browser … A/mail/src
> <http://trac.enlightenment.org/e/browser/trunk/E-MODULES-EXTRA/mail/src>
> 
> and noticed that there is a field called num_new that is used... and
> because of its name, and because of the way it is used, I think it is
> intended to get the number of new messages.
> 
> For instance, in e_mod_main.c :
> 
> 
>         Code:
> 
> 649    void
> 650    _mail_set_text (void *data)
> 651    {
> 652      Instance *inst = data;
> 653      Eina_List *l;
> 654      char buf[1024];
> 655      int count = 0;
> 656
> 657      if (!inst)
> 658        return;
> 659
> 660      for (l = inst->ci->boxes; l; l = l->next)
> 661        {
> 662           Config_Box *cb;
> 663
> 664           cb = l->data;
> 665           if (!cb)
> 666             continue;
> 667           count += cb->num_new;
> 668        }
> 669
> 670      if (count > 0)
> 671        {
> ...
> 
> 
> The loop seems to count the sum of all new messages of the different
> mailboxes.
> 
> In pop.c :
> 
> 
>         Code:
> 
> static void
> 215    _mail_cb_mouse_down (void *data, Evas * e, Evas_Object * obj,
> 216                         void *event_info)
> 217    {
> ...
> 254                  snprintf (buf, sizeof (buf), "%s: %d/%d", cb->name,
> cb->num_new,
> 255                            cb->num_total);
> ...
> 
> 
> 
> this seems to be the code what displays the small pop-up with name of
> the mailbox, plus number of new messages and number of all messages
> (that can be expected to be usually different).
> 
> Then here in pop.c :
> 
> 
>         Code:
> 
> 156    static int
> 157    _mail_pop_server_data (void *data, int type, void *event)
> 158    {
> ...
> 203 case POP_STATE_STATUS_OK:
> 204          if (sscanf (in, "+OK %i %i", &num, &total) == 2)
> 205            {
> 206              pc->config->num_new = num;
> 207              pc->config->num_total = num;
> 208            }
> 
> 
> 
> Here the data received from the pop3 server are "scanned" and weirdly,
> both fields num_new and num_total get the same value (num).
> 
> Then I read the pop3 rfc (http://www.ietf.org/rfc/rfc1939.txt) and
> unfortunately it seems NOT to be possible to retrieve directly the
> number of new e-mails from the pop3 server. The sscanf (in, "+OK %i %i",
> &num, &total) actually gives the total number of e-mails to &num and the
> size of the mailbox to &total. So num_new gets the total number of
> e-mails and it's no surprise that the mail module displays this number
> instead of the number of new messages.
> 
> So I am a bit confused. I am quite sure it used to work. Is there still
> a way to bring the mail module to display the number of new e-mails
> (using pop3) ? Or am I totally wrong and it is not intended to do so ??
> 
> I hope I didn't bother you with a scilly question, but I couldn't find
> an answer to it anywhere else so far.
> 
> I wish you a nice day,
> 
> 
> 
> Nicolas Hainaux
> 
You are correct in your assumptions there. POP3 does not have a "total 
new" option. It may have been possible in the past (due to the code), 
but the pop code was rewritten (by someone, don't remember who) after my 
initial write, so I am not entirely sure how it is handled now. If you 
really really want the total # of new messages, I believe that IMAP has 
support for that (iirc).

Honestly tho, the whole mail module needs a serious rewrite but I just 
haven't found the time.

devilhorns

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to