Ejemplo n.º 1
0
void EmailAdapter::SerializeAddress(const char* type, EmailAddressPtr address, MojObject& recipient)
{
	MojErr err;
	
	if( address.get() == NULL ) {
		throw MailException("attempted to serialize null address", __FILE__, __LINE__);
	}

	err = recipient.putString(Address::TYPE, type);
	ErrorToException(err);
	
	err = recipient.putString(Address::ADDR, address->GetAddress().c_str());
	ErrorToException(err);
	
	if(address->HasDisplayName()) {
		err = recipient.putString(Address::NAME, address->GetDisplayName().c_str());
		ErrorToException(err);
	} else {
		err = recipient.putString(Address::NAME, address->GetAddress().c_str());
		ErrorToException(err);
	}
}