Patch: Elm ME+ 2.5 PLalpha50 -> Elm ME+ 2.5 PLalpha51 [5/6] (3/5)
From
Kari Hurtta@21:1/5 to
All on Tue Feb 11 20:06:30 2020
[continued from previous message]
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_cell: Overflow L_current_line=%d %s LINES=%d, L_current_col=%d %s COLUMNS=%d\n",
+ L_current_line,
+ L_current_line < LINES ? "<" : ">=",
+ LINES,
+ L_current_col,
+ L_current_col < COLUMNS ? "<" : ">",
+ COLUMNS));
+
+ }
+
+ DPRINT(Debug,12,(&Debug,"qd_draw_cell:"));
+ if (* current_line_p != L_current_line) {
+ DPRINT(Debug,12,(&Debug," * current_line_p = %d => %d",
+ * current_line_p,L_current_line));
+ * current_line_p = L_current_line;
+ }
+ if (* current_col_p != L_current_col) {
+ DPRINT(Debug,12,(&Debug," * current_col_p = %d => %d",
+ * current_col_p,L_current_col));
+ * current_col_p = L_current_col;
+ }
+ if (* redrawing_p != L_redrawing) {
+ DPRINT(Debug,12,(&Debug," * redrawing_p = %d => %d",
+ * redrawing_p,L_redrawing));
+
+ * redrawing_p = L_redrawing;
+ }
+ if (* mayclear_p != L_mayclear) {
+ DPRINT(Debug,12,(&Debug, " * mayclear_p = %d => %d",
+ * mayclear_p,L_mayclear));
+
+ * mayclear_p = L_mayclear;
+ }
+ if (* start_of_line_p != L_start_of_line) {
+ DPRINT(Debug,12,(&Debug, " * start_of_line_p = %d => %d",
+ * start_of_line_p,L_start_of_line));
+
+ * start_of_line_p = L_start_of_line;
+ }
+ DPRINT(Debug,12,(&Debug,"\n"));
+
+
+ }
+
+ static void qd_draw_quotaroot_name P_((struct menu_context * print_area,
+ struct mail_quotaroot * qr,
+ int * current_line_p, + int * current_col_p,
+ int * redrawing_p,
+ struct resize_columns * resize,
+ struct menu_param * list,
+ int * mayclear_p,
+ int * start_of_line_p));
+ static void qd_draw_quotaroot_name(print_area,qr,current_line_p,current_col_p,
+ redrawing_p,resize,list,mayclear_p,start_of_line_p)
+ struct menu_context * print_area;
+ struct mail_quotaroot * qr;
+ int * current_line_p;
+ int * current_col_p;
+ int * redrawing_p;
+ struct resize_columns * resize;
+ struct menu_param * list;
+ int * mayclear_p;
+ int * start_of_line_p;
+ {
+
+ enum quota_reserved_quotaroot qr_name_token = qr_root_none;
+ struct string * qr_name /* May be NULL */ =
+ quotaroot_name(qr,&qr_name_token);
+
+ int L_current_line = * current_line_p;
+ int L_current_col = * current_col_p;
+ int L_redrawing = * redrawing_p;
+ int L_mayclear = * mayclear_p;
+ int L_start_of_line = * start_of_line_p;
+ int printed = 0;
+
+ struct string * qr_NA =
+ format_string(CATGETS(elm_msg_cat, MeSet,
+ MeMQNA,
+ "n/a"));
+
+
+ DPRINT(Debug,12,(&Debug,"qd_draw_quotaroot_name: qr_name_token=%d",
+ qr_name_token));
+ switch (qr_name_token) {
+ case qr_root_none: DPRINT(Debug,12,(&Debug," qr_root_none")); break;
+ }
+ if (qr_name) {
+ DPRINT(Debug,12,(&Debug," qr_name=%S",qr_name));
+ }
+ DPRINT(Debug,12,(&Debug,"\n"));
+
+ switch (qr_name_token) {
+ case qr_root_none:
+ qd_draw_cell(print_area,qd_quotaroot,&L_current_line,
+ &L_current_col,&L_redrawing,
+ qr_name ? qr_name : qr_NA,
+ resize,list,0,qd_align_left,
+ &L_mayclear,&L_start_of_line);
+ printed = 1;
+ break;
+ }
+
+
+ if (! printed) {
+ DPRINT(Debug,12,(&Debug,"qd_draw_quotaroot_name: Bad qr_name_token\n"));
+
+ qd_draw_cell(print_area,qd_quotaroot,&L_current_line,
+ &L_current_col,&L_redrawing,
+ qr_name ? qr_name : qr_NA,
+ resize,list,0,qd_align_left,
+ &L_mayclear,&L_start_of_line);
+ }
+
+ if (qr_name)
+ free_string(&qr_name);
+
+ free_string(&qr_NA);
+
+ DPRINT(Debug,12,(&Debug,"qd_draw_quotaroot_name:"));
+ if (* current_line_p != L_current_line) {
+ DPRINT(Debug,12,(&Debug," * current_line_p = %d => %d",
+ * current_line_p,L_current_line));
+ * current_line_p = L_current_line;
+ }
+ if (* current_col_p != L_current_col) {
+ DPRINT(Debug,12,(&Debug," * current_col_p = %d => %d",
+ * current_col_p,L_current_col));
+ * current_col_p = L_current_col;
+ }
+ if (* redrawing_p != L_redrawing) {
+ DPRINT(Debug,12,(&Debug," * redrawing_p = %d => %d",
+ * redrawing_p,L_redrawing));
+
+ * redrawing_p = L_redrawing;
+ }
+ if (* mayclear_p != L_mayclear) {
+ DPRINT(Debug,12,(&Debug, " * mayclear_p = %d => %d",
+ * mayclear_p,L_mayclear));
+
+ * mayclear_p = L_mayclear;
+ }
+ if (* start_of_line_p != L_start_of_line) {
+ DPRINT(Debug,12,(&Debug, " * start_of_line_p = %d => %d",
+ * start_of_line_p,L_start_of_line));
+
+ * start_of_line_p = L_start_of_line;
+ }
+ DPRINT(Debug,12,(&Debug,"\n"));
+
+ }
+
+ static void qd_draw_resource_name P_((struct menu_context * print_area,
+ struct mail_quota_item * qr_item,
+ int * current_line_p, + int * current_col_p, + int * redrawing_p,
+ struct resize_columns * resize,
+ struct menu_param * list,
+ int * mayclear_p,
+ int * start_of_line_p));
+
+ static void qd_draw_resource_name(print_area,qr_item,current_line_p,current_col_p,
+ redrawing_p,resize,list,mayclear_p,start_of_line_p)
+ struct menu_context * print_area;
+ struct mail_quota_item * qr_item;
+ int * current_line_p;
+ int * current_col_p;
+ int * redrawing_p;
+ struct resize_columns * resize;
+ struct menu_param * list;
+ int * mayclear_p;
+ int * start_of_line_p;
+ {
+ enum quota_reserved_resource qr_item_token = qr_res_none;
+ struct string * qr_item_name /* May be NULL */ =
+ quota_item_name(qr_item,&qr_item_token);
+
+ int L_current_line = * current_line_p;
+ int L_current_col = * current_col_p;
+ int L_redrawing = * redrawing_p;
+ int L_mayclear = * mayclear_p;
+ int L_start_of_line = * start_of_line_p;
+ int printed = 0;
+
+ struct string * qr_NA =
+ format_string(CATGETS(elm_msg_cat, MeSet,
+ MeMQNA,
+ "n/a"));
+
+ DPRINT(Debug,12,(&Debug,"qd_draw_resource_name: qr_item_token=%d",
+ qr_item_token));
+ switch (qr_item_token) {
+ case qr_res_none: DPRINT(Debug,12,(&Debug," qr_res_none")); break;
+ }
+ if (qr_item_name) {
+ DPRINT(Debug,12,(&Debug," qr_item_name=%S",qr_item_name));
+ }
+ DPRINT(Debug,12,(&Debug,"\n"));
+
+
+ switch (qr_item_token) {
+ case qr_res_none:
+ qd_draw_cell(print_area,qd_resource,&L_current_line,
+ &L_current_col,&L_redrawing,
+ qr_item_name ? qr_item_name : qr_NA,
+ resize,list,0,qd_align_left,
+ &L_mayclear,&L_start_of_line);
+ printed = 1;
+ break;
+ }
+
+ if (! printed) {
+ DPRINT(Debug,12,(&Debug,"qd_draw_resource_name: Bad qr_item_token\n")); +
+ qd_draw_cell(print_area,qd_resource,&L_current_line,
+ &L_current_col,&L_redrawing,
+ qr_item_name ? qr_item_name : qr_NA,
+ resize,list,0,qd_align_left,
+ &L_mayclear,&L_start_of_line);
+ }
+
+ if (qr_item_name)
+ free_string(&qr_item_name);
+
+ free_string(&qr_NA);
+
+ DPRINT(Debug,12,(&Debug,"qd_draw_resource_name:"));
+ if (* current_line_p != L_current_line) {
+ DPRINT(Debug,12,(&Debug," * current_line_p = %d => %d",
+ * current_line_p,L_current_line));
+ * current_line_p = L_current_line;
+ }
+ if (* current_col_p != L_current_col) {
+ DPRINT(Debug,12,(&Debug," * current_col_p = %d => %d",
+ * current_col_p,L_current_col));
+ * current_col_p = L_current_col;
+ }
+ if (* redrawing_p != L_redrawing) {
+ DPRINT(Debug,12,(&Debug," * redrawing_p = %d => %d",
+ * redrawing_p,L_redrawing));
+
+ * redrawing_p = L_redrawing;
+ }
+ if (* mayclear_p != L_mayclear) {
+ DPRINT(Debug,12,(&Debug, " * mayclear_p = %d => %d",
+ * mayclear_p,L_mayclear));
+
+ * mayclear_p = L_mayclear;
+ }
+ if (* start_of_line_p != L_start_of_line) {
+ DPRINT(Debug,12,(&Debug, " * start_of_line_p = %d => %d",
+ * start_of_line_p,L_start_of_line));
+
+ * start_of_line_p = L_start_of_line;
+ }
+ DPRINT(Debug,12,(&Debug,"\n"));
+ }
+
+ static struct scale {
+ char * unit;
+ unsigned long factor;
+ unsigned long limit;
+
+ } scales[] = {
+ { "", 1, 0 },
+ { "k", 1000, 10000 },
+ { "M", 1000000, 10000000 }
+ };
+
+ static void qd_draw_resource_values(print_area,qr_item,current_line_p,current_col_p,
+ redrawing_p,resize,list,mayclear_p,start_of_line_p)
+ struct menu_context * print_area;
+ struct mail_quota_item * qr_item;
+ int * current_line_p;
+ int * current_col_p;
+ int * redrawing_p;
+ struct resize_columns * resize;
+ struct menu_param * list;
+ int * mayclear_p;
+ int * start_of_line_p;
+ {
+
+ int L_current_line = * current_line_p;
+ int L_current_col = * current_col_p;
+ int L_redrawing = * redrawing_p;
+ int L_mayclear = * mayclear_p;
+ int L_start_of_line = * start_of_line_p;
+
+ uint32 qr_item_usage = 0;
+ uint32 qr_item_limit = 0;
+ int qr_item_flag =
+ quota_item_values(qr_item,&qr_item_usage,&qr_item_limit);
+
+ int scale_index = (sizeof scales) / sizeof (scales[0]) - 1;
+
+ struct string * usage_s = NULL;
+ struct string * limit_s = NULL;
+ struct string * prct_s = NULL;
+
+ int LINES, COLUMNS;
+ menu_get_sizes(print_area,&LINES, &COLUMNS);
+
+ /* ;; Unsigned 32-bit integer
+ ;; (0 <= n < 4,294,967,296)
+ */
+
+ while (scale_index > 0) {
+ if (ison(QUOTA_ITEM_have_usage,qr_item_flag)) {
+
+ if (qr_item_usage < scales[scale_index].limit) {
+ scale_index--;
+ continue;
+ }
+
+ }
+
+ if (ison(QUOTA_ITEM_have_limit,qr_item_flag)) {
+ if (qr_item_limit < scales[scale_index].limit) {
+ scale_index--;
+ continue;
+ }
+ }
+
+ break;
+ }
+
+
+ DPRINT(Debug,12,(&Debug,"qd_draw_resource_values: scale_index=%d unit=%s factor=%lu\n",
+ scale_index,scales[scale_index].unit,scales[scale_index].factor));
+
+ if (ison(QUOTA_ITEM_have_usage,qr_item_flag)) {
+ unsigned long ul = qr_item_usage;
+
+ usage_s =
+ format_string(FRM("%lu%s"),
+ ul / scales[scale_index].factor,
+ scales[scale_index].unit);
+
+ } else {
+
+ usage_s = format_string(FRM("-"));
+
+ }
+
+ qd_draw_cell(print_area,qd_usage,&L_current_line,
+ &L_current_col,&L_redrawing,usage_s,
+ resize,list,0,qd_align_rigth,
+ &L_mayclear,&L_start_of_line);
+
+ if (L_current_line < LINES && L_current_col < COLUMNS) {
+ menu_Writechar(print_area,'/');
+ L_current_col++;
+ }
+
+ if (ison(QUOTA_ITEM_have_limit,qr_item_flag)) {
+ unsigned long ul = qr_item_limit;
+
+ limit_s =
+ format_string(FRM("%lu%s"),
+ ul / scales[scale_index].factor,
+ scales[scale_index].unit);
+
+
+ } else {
+ limit_s =
+ format_string(FRM("-"));
+
+ }
+
+ qd_draw_cell(print_area,qd_limit,&L_current_line,
+ &L_current_col,&L_redrawing,limit_s,
+ resize,list,0,qd_align_left,
+ &L_mayclear,&L_start_of_line);
+
+ if (ison(QUOTA_ITEM_have_usage,qr_item_flag) && 0 == qr_item_usage) {
+ prct_s =
+ format_string(FRM("0%%"));
+ } else if (ison(QUOTA_ITEM_have_usage,qr_item_flag) &&
+ ison(QUOTA_ITEM_have_limit,qr_item_flag) &&
+ qr_item_limit > 0) {
+
+ if (qr_item_usage == qr_item_limit) {
+ prct_s =
+ format_string(FRM("100%%"));
+
+ } else {
+ float f = 100.0 * qr_item_usage / qr_item_limit;
+
+ if (f < 999.0) {
+ int v = (int)f;
+
+ if ((float)v < f && v < 100)
+ v++;
+
+ prct_s =
+ format_string(FRM("%d%%"),
+ v);
+
+ } else {
+ prct_s =
+ format_string(FRM("-"));
+ }
+ }
+
+ } else {
+ prct_s =
+ format_string(FRM("-"));
+ }
+
+ qd_draw_cell(print_area,qd_percent,&L_current_line,
+ &L_current_col,&L_redrawing,prct_s,
+ resize,list,0,qd_align_rigth,
+ &L_mayclear,&L_start_of_line);
+
+ free_string(&prct_s);
+ free_string(&limit_s);
+ free_string(&usage_s);
+
+
+ DPRINT(Debug,12,(&Debug,"qd_draw_resource_values:"));
+ if (* current_line_p != L_current_line) {
+ DPRINT(Debug,12,(&Debug," * current_line_p = %d => %d",
+ * current_line_p,L_current_line));
+ * current_line_p = L_current_line;
+ }
+ if (* current_col_p != L_current_col) {
+ DPRINT(Debug,12,(&Debug," * current_col_p = %d => %d",
+ * current_col_p,L_current_col));
+ * current_col_p = L_current_col;
+ }
+ if (* redrawing_p != L_redrawing) {
+ DPRINT(Debug,12,(&Debug," * redrawing_p = %d => %d",
+ * redrawing_p,L_redrawing));
+
+ * redrawing_p = L_redrawing;
+ }
+ if (* mayclear_p != L_mayclear) {
+ DPRINT(Debug,12,(&Debug, " * mayclear_p = %d => %d",
+ * mayclear_p,L_mayclear));
+
+ * mayclear_p = L_mayclear;
+ }
+ if (* start_of_line_p != L_start_of_line) {
+ DPRINT(Debug,12,(&Debug, " * start_of_line_p = %d => %d",
+ * start_of_line_p,L_start_of_line));
+
+ * start_of_line_p = L_start_of_line;
+ }
+ DPRINT(Debug,12,(&Debug,"\n"));
+
+ }
+
+
+ static void qd_draw_mail_quota P_((struct menu_context * print_area,
+ struct quota_display * qd,
+ const size_t mq_ptr,
+ const size_t start_quotaroot,
+
+ int * add_p,
+ int * current_line_p,
+ int * printing_p,
+ int * redrawing_p,
+ int * before_top_p,
+ const int add_to_top,
+ struct cancel_data * cd,
+ struct resize_columns * resize,
+ struct menu_param * list,
+ int * add_line_p
+ ));
+ static void qd_draw_mail_quota(print_area,qd,mq_ptr,start_quotaroot,
+ add_p,current_line_p,
+ printing_p,redrawing_p,before_top_p,
+ add_to_top,cd,resize,list,add_line_p)
+ struct menu_context * print_area;
+ struct quota_display * qd;
+ const size_t mq_ptr;
+ const size_t start_quotaroot;
+ int * add_p;
+ int * current_line_p;
+ int * printing_p;
+ int * redrawing_p;
+ int * before_top_p;
+ const int add_to_top;
+ struct cancel_data * cd;
+ struct resize_columns * resize;
+ struct menu_param * list;
+ int * add_line_p;
+ {
+ int L_add = * add_p;
+ int L_current_line = * current_line_p;
+ int L_printing = * printing_p;
+ int L_redrawing = * redrawing_p;
+ int L_before_top = * before_top_p;
+ int L_add_line = * add_line_p;
+
+ int LINES, COLUMNS;
+ int exceed = 0;
+
+ menu_get_sizes(print_area,&LINES, &COLUMNS);
+
+ if (QUOTA_DISPLAY_magic != qd->magic)
+ panic("MBX PANIC",__FILE__,__LINE__,
+ "qd_draw_mail_quota",
+ "Bad magic number (quota_diplay)",0);
+
+ if (mq_ptr > qd->mail_quota_count)
+ panic("MBX PANIC",__FILE__,__LINE__,
+ "Bad mq_ptr",
+ "Bad magic number (quota_diplay)",0);
+
+
+ if (top_start_reached(qd->top_offset,L_add,&L_before_top,add_to_top,
+ & (qd-> mail_quota_list[mq_ptr].virtual_mq_start_line),
+ &exceed)) {
+
+
+
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: L_current_line = %d top_line=%d mail_quota_list[%zu].virtual_mq_start_line=%d top_offset=%d L_add=%d\n",
+ L_current_line,qd->top_line,
+ mq_ptr,qd-> mail_quota_list[mq_ptr].virtual_mq_start_line,
+ qd->top_offset,L_add));
+
+ if (virtual_start_set(L_current_line,qd->top_line,
+ & (qd-> mail_quota_list[mq_ptr].virtual_mq_start_line),
+ qd->top_offset)) {
+
+ int mq_start_line =
+ qd_start_line(L_current_line,qd->top_line,
+ & (qd-> mail_quota_list[mq_ptr].virtual_mq_start_line),
+ qd->top_offset,L_add);
+
+ qd_draw_to_start_line(print_area,&L_current_line,
+ &L_printing,mq_start_line,qd->top_line);
+
+ if (L_current_line > mq_start_line) {
+
+ int diff = L_current_line - mq_start_line;
+
+ if (qd-> mail_quota_list[mq_ptr].virtual_mq_start_line > 0) { +
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: L_add = %d",
+ L_add));
+
+ L_add += diff;
+
+ DPRINT(Debug,10,(&Debug," => %d\n",
+ L_add));
+ }
+
+ DPRINT(Debug,10,(&Debug,
+ "qd_draw_mail_quota: mail_quota_list[%zu].virtual_mq_start_line = %d",
+ mq_ptr,qd-> mail_quota_list[mq_ptr].virtual_mq_start_line));
+
+ qd-> mail_quota_list[mq_ptr].virtual_mq_start_line += diff;
+
+ DPRINT(Debug,12,(&Debug," => %d\n",
+ qd-> mail_quota_list[mq_ptr].virtual_mq_start_line));
+
+ mq_start_line += diff;
+ }
+
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: mail_quota_list[%zu]: L_current_line = %d %s mq_start_line=%d\n",
+ mq_ptr,L_current_line,
+ (L_current_line == mq_start_line) ? "==" : "<>", + mq_start_line));
+ } else {
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: mail_quota_list[%zu].virtual_mq_start_line = %d -- was not set\n",
+ mq_ptr,qd-> mail_quota_list[mq_ptr].virtual_mq_start_line));
+ }
+
+ } else {
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: mail_quota_list[%zu].virtual_mq_start_line = %d -- %d before top\n",
+ mq_ptr,qd-> mail_quota_list[mq_ptr].virtual_mq_start_line,
+ exceed));
+ }
+
+ if (qd-> mail_quota_list[mq_ptr].mail_quotarootl_list) {
+ size_t j;
+
+ for (j = qd->top_quotarootl; j < qd-> mail_quota_list[mq_ptr].mail_quotarootl_count; j++) {
+
+ if (L_add_line) {
+
+ if (L_current_line >= qd->top_line &&
+ L_current_line < LINES) {
+
+ if (!L_printing) {
+ DPRINT(Debug,12,(&Debug,"qd_draw_mail_quota: Gone to printing area, top_line=%d\n",
+ qd->top_line));
+ L_printing = 1;
+ }
+
+ menu_ClearLine(print_area,L_current_line);
+ }
+
+ L_current_line ++;
+
+ if (L_current_line >= LINES) {
+ if (L_printing) {
+ DPRINT(Debug,12,(&Debug,"qd_draw_mail_quota: Gone out of screen, LINES=%d\n",
+ LINES));
+ L_printing = 0;
+ }
+ }
+ }
+
+ if (top_start_reached(qd->top_offset,L_add,&L_before_top,add_to_top,
+ &( qd->mail_quota_list[mq_ptr].
+ mail_quotarootl_list[j].
+ virtual_ql_start_line ),
+ &exceed)) {
+
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: L_current_line = %d top_line=%d qd->mail_quota_list[%zu].mail_quotarootl_list[%zu].virtual_ql_start_line=%d top_offset=%d L_add=%d\n",
+ L_current_line,qd->top_line,
+ mq_ptr,j,qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ virtual_ql_start_line,
+ qd->top_offset,L_add));
+
+ if (virtual_start_set(L_current_line,qd->top_line,
+ &( qd->mail_quota_list[mq_ptr].
+ mail_quotarootl_list[j].
+ virtual_ql_start_line ),
+ qd->top_offset)) {
+
+ int ql_start_line = qd_start_line(L_current_line,qd->top_line,
+ &( qd->mail_quota_list[mq_ptr].
+ mail_quotarootl_list[j].
+ virtual_ql_start_line ),
+ qd->top_offset,L_add);
+
+
+ qd_draw_to_start_line(print_area,&L_current_line,&L_printing,
+ ql_start_line,qd->top_line);
+
+ qd_update_start_line(L_current_line,&ql_start_line,
+ & (qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ virtual_ql_start_line),&L_add);
+ } else {
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: mail_quota_list[%zu].mail_quotarootl_list[%zu].virtual_ql_start_line -- was not set\n",
+ mq_ptr,j,
+ qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ virtual_ql_start_line));
+ }
+
+ /* Draw folder names */
+
+ if (L_current_line >= qd->top_line &&
+ L_current_line < LINES) {
+
+ int current_col = 0;
+
+ int mayclear = 1;
+ int joined_line = 0;
+ int start_of_line = 1;
+
+ struct string * s1 = format_string(CATGETS(elm_msg_cat, MeSet,
+ MeMailQuota,
+ "Mail quota")); +
+ if (!L_printing) {
+ DPRINT(Debug,12,(&Debug,"qd_draw_mail_quota: Gone to printing area, top_line=%d\n",
+ qd->top_line));
+ L_printing = 1;
+ }
+
+ menu_MoveCursor(print_area,L_current_line,current_col);
+
+ if (!qd_draw_text(print_area,&L_current_line,¤t_col, + &mayclear,&joined_line,&start_of_line,
+ s1))
+ goto fail;
+
+ if (qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].folder_disp_name_list) {
+ size_t k;
+
+ struct string * s2 = format_string(CATGETS(elm_msg_cat, MeSet,
+ MeQuotaFor, + " for ")); +
+ struct string * s3 = format_string(FRM(", "));
+ struct string * delim = s2;
+
+ for (k = 0; k < qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ folder_disp_name_count ; k++) {
+
+ if (qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ folder_disp_name_list[k]) {
+ if (!qd_draw_text(print_area,&L_current_line,¤t_col,
+ &mayclear,&joined_line,&start_of_line,
+ delim))
+ goto fail2;
+
+ if (!qd_draw_text(print_area,&L_current_line,¤t_col,
+ &mayclear,&joined_line,&start_of_line,
+ qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ folder_disp_name_list[k]))
+ goto fail2;
+
+ delim = s3;
+ }
+ }
+
+
+ if ( qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].quota_list) {
+ struct string * s4 = format_string(FRM(": "));
+
+
+ if (!qd_draw_text(print_area,&L_current_line,¤t_col,
+ &mayclear,&joined_line,&start_of_line,
+ s4))
+ goto fail3;
+
+ qd_draw_eoln(print_area,&L_current_line,¤t_col,
+ &mayclear,&start_of_line,&L_printing,1);
+
+ fail3:
+ free_string(&s4);
+ }
+
+ fail2:
+ free_string(&s3);
+ free_string(&s2);
+
+ }
+
+ fail:
+ free_string(&s1);
+
+ } else if (L_current_line >= LINES) {
+ if (L_printing) {
+ DPRINT(Debug,12,(&Debug,"qd_draw_mail_quota: Gone out of screen, LINES=%d\n",
+ LINES));
+ L_printing = 0;
+ }
+ } else {
+ L_current_line++;
+ }
+
+ } else {
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: mail_quota_list[%zu].mail_quotarootl_list[%zu].virtual_ql_start_line = %d -- %d before top\n",
+ mq_ptr,j,
+ qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ virtual_ql_start_line,
+ exceed));
+ }
+
+
+ if (top_start_reached(qd->top_offset,L_add,&L_before_top,add_to_top,
+ &( qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ virtual_tb_start_line),
+ &exceed)) {
+
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: L_current_line = %d top_line=%d qd->mail_quota_list[%zu].mail_quotarootl_list[%zu].virtual_tb_start_line=%d top_offset=%d L_add=%d\n",
+ L_current_line,qd->top_line,
+ mq_ptr,j,qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ virtual_tb_start_line,
+ qd->top_offset,L_add));
+
+ if (virtual_start_set(L_current_line,qd->top_line,
+ &( qd->mail_quota_list[mq_ptr].
+ mail_quotarootl_list[j].
+ virtual_tb_start_line),
+ qd->top_offset)) {
+ int tb_start_line = qd_start_line(L_current_line,qd->top_line,
+ &( qd->mail_quota_list[mq_ptr].
+ mail_quotarootl_list[j].
+ virtual_tb_start_line),
+ qd->top_offset,L_add);
+
+ qd_draw_to_start_line(print_area,&L_current_line,&L_printing,
+ tb_start_line,qd->top_line);
+
+ qd_update_start_line(L_current_line,&tb_start_line,
+ &( qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ virtual_tb_start_line),&L_add);
+ } else {
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: mail_quota_list[%zu].mail_quotarootl_list[%zu].virtual_tb_start_line = %d -- was not set\n",
+ mq_ptr,j,
+ qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ virtual_tb_start_line));
+ }
+
+ L_add_line = 1;
+ } else {
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: mail_quota_list[%zu].mail_quotarootl_list[%zu].virtual_tb_start_line = %d -- %d before top\n",
+ mq_ptr,j,
+ qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].
+ virtual_tb_start_line,
+ exceed));
+ }
+
+
+ if (qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].quota_list) {
+
+ struct mail_quotaroot_list * const ql
+ = qd->mail_quota_list[mq_ptr].mail_quotarootl_list[j].quota_list;
+
+ const size_t quota_list_len =
+ quotaroot_list_len(ql);
+
+ struct string * qr_NA =
+ format_string(CATGETS(elm_msg_cat, MeSet,
+ MeMQNA,
+ "n/a"));
+
+
+ if (quota_list_len) {
+ size_t k;
+
+ /* Show title */
+
+ /* Should title always printed? */
+
+ if (qd_exceed_or_printing(print_area,
+ &exceed,&L_current_line,&L_printing,qd->top_line)) {
+
+ int current_col = 0;
+ int mayclear = 1;
+ int start_of_line = 1;
+
+ struct string * s_qr = format_string(CATGETS(elm_msg_cat, MeSet,
+ MeMQQuotaRootCol,
+ "Quotaroot"));
+
+ struct string * s_res = format_string(CATGETS(elm_msg_cat, MeSet,
+ MeMQResourceCol,
+ "Resource"));
+
+
+ struct string * s_usa = format_string(CATGETS(elm_msg_cat, MeSet,
+ MeMQUsageCol,
+ "Usage"));
+
+ struct string * s_lim = format_string(CATGETS(elm_msg_cat, MeSet,
+ MeMQLimitCol,
+ "Limit"));
+
+ struct string * s_prcnt = format_string(CATGETS(elm_msg_cat, MeSet,
+ MeMQLimitPrcnt,
+ "Prct"));
+
+
+ qd_draw_cell(print_area,qd_quotaroot,&L_current_line, + ¤t_col,&L_redrawing,s_qr,
+ resize,list,pg_UNDERLINE,qd_align_center, + &mayclear,&start_of_line);
+
+
+ qd_draw_cell(print_area,qd_resource,&L_current_line,
+ ¤t_col,&L_redrawing,s_res,
+ resize,list,pg_UNDERLINE,qd_align_center, + &mayclear,&start_of_line);
+
+ qd_draw_cell(print_area,qd_usage,&L_current_line,
+ ¤t_col,&L_redrawing,s_usa,
+ resize,list,pg_UNDERLINE,qd_align_rigth, + &mayclear,&start_of_line);
+
+ if (L_current_line < LINES && current_col < COLUMNS) { + menu_Writechar(print_area,'/');
+ current_col++;
+ }
+
+ qd_draw_cell(print_area,qd_limit,&L_current_line,
+ ¤t_col,&L_redrawing,s_lim,
+ resize,list,pg_UNDERLINE,qd_align_left,
+ &mayclear,&start_of_line);
+
+ qd_draw_cell(print_area,qd_percent,&L_current_line,
+ ¤t_col,&L_redrawing,s_prcnt,
+ resize,list,pg_UNDERLINE,qd_align_rigth, + &mayclear,&start_of_line);
+
+ qd_draw_eoln(print_area,&L_current_line,¤t_col, + &mayclear,&start_of_line,&L_printing,0); +
+ free_string(&s_prcnt);
+ free_string(&s_lim);
+ free_string(&s_usa);
+ free_string(&s_res);
+ free_string(&s_qr);
+ }
+
+ for (k = 0; k < quota_list_len; k++) {
+ struct mail_quotaroot * qr =
+ quotaroot_list_item(ql,k,cd);
+
+
+ if (qr) {
+ enum quota_reserved_quotaroot qr_name_token = qr_root_none;
+ struct string * qr_name /* May be NULL */ =
+ quotaroot_name(qr,&qr_name_token);
+ size_t qr_item_count = quotaroot_item_count(qr);
+ enum quota_quotaroot_status qr_status =
+ quotaroot_status(qr);
+ struct string * status_text = NULL;
+ int show_empty = 0;
+
+ size_t m;
+
+ DPRINT(Debug,12,(&Debug,
+ "qd_draw_mail_quota: mail_quota_list[%zu].mail_quotarootl_list[%zu]: quotaroot %zu/%zu: qr_status=%d",
+ mq_ptr,j,
+ k,quota_list_len,qr_status));
+
+ switch (qr_status) {
+ case qr_stat_failed: DPRINT(Debug,12,(&Debug," qr_stat_failed")); break;
+ case qr_stat_none: DPRINT(Debug,12,(&Debug," qr_stat_none")); break;
+ case qr_stat_empty: DPRINT(Debug,12,(&Debug," qr_stat_empty")); break;
+ case qr_stat_normal: DPRINT(Debug,12,(&Debug," qr_stat_normal")); break;
+ }
+ if (qr_name) {
+ DPRINT(Debug,12,(&Debug," qr_name=%S",qr_name));
+ }
+ DPRINT(Debug,12,(&Debug," qr_item_count=%zu\n",qr_item_count));
+
+ switch (qr_status) {
+ case qr_stat_failed:
+ status_text =
+ format_string(CATGETS(elm_msg_cat, MeSet, + MeMQFailedParse,
+ "Failed to parse quota root resource limits"));
+ break;
+ case qr_stat_none:
+ show_empty = 1;
+ break;
+ case qr_stat_empty:
+ status_text =
+ format_string(CATGETS(elm_msg_cat, MeSet, + MeMQNoAdminsLimits, + "No administrative resource limits in the quota root"));
+ break;
+ case qr_stat_normal:
+ break;
+ }
+
+ for (m = 0; m < qr_item_count; m++) {
+ struct mail_quota_item * qr_item =
+ quotaroot_item(qr,m);
+
+
+ if (qr_item) {
+
+ if (qd_exceed_or_printing(print_area,
+ &exceed,&L_current_line,&L_printing,
+ qd->top_line)) {
+ int current_col = 0;
+ int mayclear = 1;
+ int start_of_line = 1;
+
+ qd_draw_quotaroot_name(print_area,qr, + &L_current_line,
+ ¤t_col,&L_redrawing,
+ resize,list,
+ &mayclear,&start_of_line);
+
+ qd_draw_resource_name(print_area,qr_item,
+ &L_current_line,
+ ¤t_col,&L_redrawing,
+ resize,list,
+ &mayclear,&start_of_line);
+
+ qd_draw_resource_values(print_area,qr_item,
+ &L_current_line,
+ ¤t_col,&L_redrawing,
+ resize,list,
+ &mayclear,&start_of_line);
+
+ qd_draw_eoln(print_area,&L_current_line,¤t_col,
+ &mayclear,&start_of_line,&L_printing,0);
+
+ }
+
+ free_mail_quota_item(&qr_item);
+ }
+
+ }
+
+ if (show_empty && qr_name) { /* ? */
+
+ if (qd_exceed_or_printing(print_area,
+ &exceed,&L_current_line,&L_printing,
+ qd->top_line)) {
+
+ int current_col = 0;
+ int mayclear = 1;
[continued in next message]
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)