<commit_before>//
//  MCAddressDisplay.cpp
//  testUI
//
//  Created by <NAME> on 1/27/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#include "MCAddressDisplay.h"

using namespace mailcore;

String * AddressDisplay::displayStringForAddress(Address * address)
{
    return address->nonEncodedRFC822String();
}

String * AddressDisplay::shortDisplayStringForAddress(Address * address)
{
    if ((address->displayName() != NULL) && (address->displayName()->length() > 0)) {
        return address->displayName();
    }
    else if (address->mailbox()) {
        return address->mailbox();
    }
    else {
        return MCSTR("invalid");
    }
}

String * AddressDisplay::veryShortDisplayStringForAddress(Address * address)
{
    if ((address->displayName() != NULL) && (address->displayName()->length() > 0)) {
        Array * components;
        String * senderName;
        
        senderName = address->displayName();
        senderName = (String *) senderName->copy()->autorelease();
        
        senderName->replaceOccurrencesOfString(MCSTR(","), MCSTR(" "));
        senderName->replaceOccurrencesOfString(MCSTR("'"), MCSTR(" "));
        senderName->replaceOccurrencesOfString(MCSTR("\""), MCSTR(" "));
        components = senderName->componentsSeparatedByString(MCSTR(" "));
        if (components->count() == 0) {
            return MCLOCALIZEDSTRING(MCSTR("invalid"));
        }
        return (String *) components->objectAtIndex(0);
    }
    else if (address->mailbox()) {
        return address->mailbox();
    }
    else {
        return MCLOCALIZEDSTRING(MCSTR("invalid"));
    }
}

String * AddressDisplay::displayStringForAddresses(Array * addresses)
{
    return Address::nonEncodedRFC822StringForAddresses(addresses);
}

String * AddressDisplay::shortDisplayStringForAddresses(Array * addresses)
{
    String * result = String::string();
    for(unsigned int i = 0 ; i < addresses->count() ; i ++) {
        Address * address = (Address *) addresses->objectAtIndex(i);
        if (i != 0) {<commit_msg>Made very short display string even shorter<commit_after>//
//  MCAddressDisplay.cpp
//  testUI
//
//  Created by <NAME> on 1/27/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#include "MCAddressDisplay.h"

using namespace mailcore;

String * AddressDisplay::displayStringForAddress(Address * address)
{
    return address->nonEncodedRFC822String();
}

String * AddressDisplay::shortDisplayStringForAddress(Address * address)
{
    if ((address->displayName() != NULL) && (address->displayName()->length() > 0)) {
        return address->displayName();
    }
    else if (address->mailbox()) {
        return address->mailbox();
    }
    else {
        return MCSTR("invalid");
    }
}

String * AddressDisplay::veryShortDisplayStringForAddress(Address * address)
{
    if ((address->displayName() != NULL) && (address->displayName()->length() > 0)) {
        Array * components;
        String * senderName;
        
        senderName = address->displayName();
        senderName = (String *) senderName->copy()->autorelease();
        
        senderName->replaceOccurrencesOfString(MCSTR(","), MCSTR(" "));
        senderName->replaceOccurrencesOfString(MCSTR("'"), MCSTR(" "));
        senderName->replaceOccurrencesOfString(MCSTR("\""), MCSTR(" "));
        components = senderName->componentsSeparatedByString(MCSTR(" "));
        if (components->count() == 0) {
            return MCLOCALIZEDSTRING(MCSTR("invalid"));
        }
        return (String *) components->objectAtIndex(0);
    }
    else if (address->mailbox()) {
        Array * components = address->mailbox()->componentsSeparatedByString(MCSTR("@"));
        if (components->count() == 0) {
            return MCSTR("");
        }
        return (String *) components->objectAtIndex(0);
    }
    else {
        return MCLOCALIZEDSTRING(MCSTR("invalid"));
    }
}

String * AddressDisplay::displayStringForAddresses(Array * addresses)
{
    return Address::nonEncodedRFC822StringForAddresses(addresses);
}

String * AddressDisplay::shortDisplayStringForAddresses(Array * addresses)
{
    String * result = String::string();
    for(unsigned int i = 0 ; i < addresses->count() ; i ++) {
        Address * address = (Address *) addresses->objectAtIndex(i);
        if (i != 0) {
{'fraction_non_alphanumeric': 0.15509635477130254, 'fraction_numerical': 0.010215927559786394, 'mean_word_length': 3.2865671641791043, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 58, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6329148', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1231, 'n_words': 233}