/* Print the most common variant of a list of unique mailboxes, and * conflate the counts. */ static void print_popular (const search_context_t *ctx, GList *list) { GList *l; mailbox_t *mailbox = NULL, *m; int max = 0; int total = 0; for (l = list; l; l = l->next) { m = l->data; total += m->count; if (m->count > max) { mailbox = m; max = m->count; } } if (! mailbox) INTERNAL_ERROR("Empty list in address hash table\n"); /* The original count is no longer needed, so overwrite. */ mailbox->count = total; print_mailbox (ctx, mailbox); }
void print_summary() { int i; char buf[1024]; /* time_t numsec = (time_t)-1; */ /* for(i = 0; i < head.hstack.top; i++) { */ /* if( head.hstack.hlines[i].tag == hltRCV ) { */ /* if( head.hstack.hlines[i].state & (1<<H_STATE_BAD_DATA) ) { */ /* break; */ /* } else { */ /* if( numsec == (time_t)-1 ) { */ /* numsec = head.hstack.hlines[i].data.rcv.numsec; */ /* } */ /* printf("%ld ", head.hstack.hlines[i].data.rcv.numsec - numsec); */ /* numsec = head.hstack.hlines[i].data.rcv.numsec; */ /* } */ /* } */ /* } */ /* printf("\n"); */ if( u_options & (1<<U_OPTION_HM_ADDRESSES) ) { /* we print out any mailboxes we find, preceded by type */ for(i = 0; i < head.hstack.top; i++) { print_mailbox(head.hstack.hlines + i, buf, 1024); } } }
/* Print or prepare for printing addresses from InternetAddressList. */ static void process_address_list (const search_context_t *ctx, InternetAddressList *list) { InternetAddress *address; int i; for (i = 0; i < internet_address_list_length (list); i++) { address = internet_address_list_get_address (list, i); if (INTERNET_ADDRESS_IS_GROUP (address)) { InternetAddressGroup *group; InternetAddressList *group_list; group = INTERNET_ADDRESS_GROUP (address); group_list = internet_address_group_get_members (group); if (group_list == NULL) continue; process_address_list (ctx, group_list); } else { InternetAddressMailbox *mailbox = INTERNET_ADDRESS_MAILBOX (address); mailbox_t mbx = { .name = internet_address_get_name (address), .addr = internet_address_mailbox_get_addr (mailbox), }; /* OUTPUT_COUNT only works with deduplication */ if (ctx->dedup != DEDUP_NONE && is_duplicate (ctx, mbx.name, mbx.addr)) continue; /* OUTPUT_COUNT and DEDUP_ADDRESS require a full pass. */ if (ctx->output & OUTPUT_COUNT || ctx->dedup == DEDUP_ADDRESS) continue; print_mailbox (ctx, &mbx); } } }
static void print_list_value (void *mailbox, void *context) { print_mailbox (context, mailbox); }