• Patch: Elm ME+ 2.5 PLalpha48 -> Elm ME+ 2.5 PLalpha49 [8/9] (2/5)

    From Kari Hurtta@21:1/5 to All on Thu Jan 3 16:45:45 2019
    [continued from previous message]

    + int menu_separator_count(mailbox)
    + struct MailboxView *mailbox;
    + {
    + if (mailbox->magic != MAILBOXVIEW_magic)
    + panic("MBX VIEW PANIC",__FILE__,__LINE__,"menu_separator_count",
    + "Bad magic number",0);
    +
    + return mailbox->separators_len;
    + }
    +
    + int menu_separator_init(mailbox,subpage_lines,subpage_columns)
    + struct MailboxView * mailbox;
    + int subpage_lines;
    + int subpage_columns;
    + {
    + int r = 0;
    +
    + int yseparator_flag = 0;
    + int aseparator_flag = 0;
    + int todaysep_flag = 0;
    + int badsort = 0;
    +
    + if (mailbox->magic != MAILBOXVIEW_magic)
    + panic("MBX VIEW PANIC",__FILE__,__LINE__,"menu_separator_init",
    + "Bad magic number",0);
    +
    + DPRINT(Debug,16,(&Debug,
    + "menu_separator_init: subpgate_lines=%d, subpage_columns=%d\n",
    + subpage_lines,subpage_columns));
    +
    +
    + if ((yseparator_flag = dt_flag_is_set(&mail_menu_time,mmtime_yseparator_flag))) {
    + update_separators(mailbox);
    + } else if (((aseparator_flag = dt_flag_is_set(&mail_menu_time,mmtime_aseparator_flag)) &&
    + subpage_lines > 20)
    + ||
    + ((todaysep_flag = dt_flag_is_set(&mail_menu_time,(mmtime_todaysep_flag))) &&
    + subpage_lines > 5)
    + ) {
    +
    + switch (abs(give_dt_sort_as_int(&sortby))) {
    + case MAILBOX_ORDER:
    + case SENT_DATE:
    + case RECEIVED_DATE:
    + update_separators(mailbox);
    + break;
    + default:
    + badsort = 1;
    + goto out;
    + }
    + } else
    + goto out;
    +
    + r = mailbox->separators_len > 0;
    +
    + out:
    +
    + DPRINT(Debug,16,(&Debug,
    + "menu_separator_init=%d"));
    + if (mailbox->separators_len) {
    + DPRINT(Debug,16,(&Debug,", separators_len=%d",
    + mailbox->separators_len));
    + }
    + if (yseparator_flag) {
    + DPRINT(Debug,16,(&Debug,", used year-separator"));
    + }
    + if (aseparator_flag) {
    + DPRINT(Debug,16,(&Debug,", used auto-separator"));
    + }
    + if (todaysep_flag) {
    + DPRINT(Debug,16,(&Debug,", used today-separator"));
    + }
    + if (badsort) {
    + DPRINT(Debug,16,(&Debug,", sorting order not good for separators"));
    + }
    +
    + DPRINT(Debug,16,(&Debug,"\n"));
    +
    + return r;
    + }
    +
    + int get_menu_separator_index(mailbox,index)
    + struct MailboxView *mailbox;
    + int index;
    + {
    + if (mailbox->magic != MAILBOXVIEW_magic)
    + panic("MBX VIEW PANIC",__FILE__,__LINE__,"get_menu_separator_index",
    + "Bad magic number",0);
    +
    + if (mailbox->mailbox_type->magic != MAILBOXTYPE_magic)
    + panic("MBX VIEW PANIC",__FILE__,__LINE__,"get_menu_separator_index",
    + "Bad type magic number",0);
    +
    + if (index < 0 || index >= mailbox->view_len)
    + return HEADER_NO_SEPARATOR;
    +
    + if (mailbox->view[index].separator_number >= 0 &&
    + mailbox->view[index].separator_number < mailbox->separators_len &&
    + mailbox->separators[mailbox->view[index].separator_number]) {
    +
    + if (MENU_SEPARATOR_magic != mailbox->separators[mailbox->view[index].separator_number]->magic)
    + panic("MBX VIEW PANIC",__FILE__,__LINE__,"get_menu_separator_index",
    + "Bad magic number (menu_separator)",0);
    +
    + return mailbox->view[index].separator_number;
    + }
    +
    + return HEADER_NO_SEPARATOR;
    + }
    +
    + const struct today_info * get_today_info(mailbox)
    + struct MailboxView *mailbox;
    + {
    + if (MAILBOXVIEW_magic != mailbox->magic)
    + panic("MBX VIEW PANIC",__FILE__,__LINE__,"get_today_info",
    + "Bad magic number (MailboxView)",0);
    +
    + if (mailbox->today_info) {
    + if (TODAY_INFO_magic != mailbox->today_info->magic)
    + panic("MBX VIEW PANIC",__FILE__,__LINE__,"get_today_info",
    + "Bad magic number (today_info)",0);
    +
    + return mailbox->today_info;
    + }
    +
    + return NULL;
    + }
    +
    /*
    * Local Variables:
    * mode:c
    Index: elmME+.2.5.alpha49-cvs/src/messages/thread.c
    *** elmME+.2.5.alpha48/src/messages/thread.c Sat May 21 10:02:24 2016
    --- elmME+.2.5.alpha49-cvs/src/messages/thread.c Sun Aug 12 11:42:17 2018
    ***************
    *** 1,7 ****
    ! static char rcsid[] = "@(#)$Id: thread.c,v 2.5 2016/03/21 20:26:15 hurtta Exp $";

    /******************************************************************************
    ! * The Elm (ME+) Mail System - $Revision: 2.5 $ $State: Exp $
    *
    * Author: Kari Hurtta <hurtta+elm@siilo.FMI.FI> (was hurtta+elm@posti.FMI.FI)
    * or Kari Hurtta <elm@elmme-mailer.org>
    --- 1,7 ----
    ! static char rcsid[] = "@(#)$Id: thread.c,v 2.7 2018/08/12 08:42:17 hurtta Exp $";

    /******************************************************************************
    ! * The Elm (ME+) Mail System - $Revision: 2.7 $ $State: Exp $
    *
    * Author: Kari Hurtta <hurtta+elm@siilo.FMI.FI> (was hurtta+elm@posti.FMI.FI)
    * or Kari Hurtta <elm@elmme-mailer.org>
    ***************
    *** 24,29 ****
    --- 24,34 ----
    return (unsigned char *)str;
    }

    + /* SHRT_MAX */
    + #include <limits.h>
    +
    +
    +
    #d