Exemplo n.º 1
0
void CVoxSQLite::InsertEmailAddress( int nId, const std::string& type, const std::string& email, EnumVisibility::Visibility vis )
{
	if ( IsValidEmailAddress( email.c_str() ) )
	{
		std::string	strSql = "INSERT INTO EmailAddress "
			"( [profile_id], [type], [email], [visibility] ) "
							 "VALUES( ?, ?, ?, ? ); ";
		try
		{
			//TODO: compile as a member var?
			CppSQLite3Statement stmt = m_db.compileStatement( strSql.c_str() );

			stmt.bind( 1, nId			);
			stmt.bind( 2, type.c_str()	);
			stmt.bind( 3, email.c_str()	);
			stmt.bind( 4, (int)vis );

			stmt.execDML();		//We expect a return value == 1 (Number of rows changed);
			stmt.reset();
		}

		catch (CppSQLite3Exception& e)
		{
			e.errorCode();
		}
	}
}
Exemplo n.º 2
0
// When selecting a person from the Notes directory that is listed as "LastName, FirstName",
// when Notes add the person to the message and change the display value on the message to
// "FirstName LastName", the the lookup will fail to find a match. Since the lookup will succeed 
// if "LastName, FirstName", we only need to search with the LastName if we have failed to find any 
// matched on the default search and we can assume that the second part is the LastName. We will 
// verify the values returned. 
// ASSUME that the value is in the form "FirstName LastName"
// Only handle very simple case as we ASSUME that everything after the first white space will be part 
// of the last name. "FirstName MiddleName LastName" is not handled. 
void RecipientsHandler::SearchWithLastName(const std::wstring& name, 
										const std::wstring& mailServer,  
										bool exhaustiveSearch, 
										bool restrictExhaustiveSearch, 
										std::vector<RecipientMatch*	>& matches)
{

	{
		std::wostringstream msg;
		msg << "Start search with lastname for [" << name.c_str() << "]" << std::ends;
		LOG_WS_INFO(msg.str().c_str());
	}
	
	if(IsValidEmailAddress(name))
	{
		LOG_WS_INFO(L"Only perform lastname search on values other than valid email addresses");
		return;
	}
	
	std::wstring firstName, lastName;
	if(!Parser::GetFirstNameLastNameParts(name, firstName, lastName))
	{
		LOG_WS_INFO(L"The value is not in a part construct");
		return;
	}
	
	SearchLocalAndServer(lastName, mailServer, exhaustiveSearch, restrictExhaustiveSearch, matches);
	
	RemoveItemsWithoutMatchingLastName(firstName, lastName, matches);
}
Exemplo n.º 3
0
void RecipientsHandler::SearchWithNameWithoutDomain(const std::wstring& name, 
										const std::wstring& mailServer,  
										bool exhaustiveSearch, 
										bool restrictExhaustiveSearch, 
										std::vector<RecipientMatch*	>& matches)
{
	// Only for addresses in the format prefix@postfix that is not a valid X400 or SMTP addresses
	if(IsValidEmailAddress(name)) 
		return;	
	
	const std::wstring nameWithoutDomain = Parser::RemoveDomainFromName(name);
	if(0 == _wcsicmp(name.c_str(), nameWithoutDomain.c_str()))
		return;

	SearchLocalAndServer(nameWithoutDomain, mailServer, exhaustiveSearch, restrictExhaustiveSearch, matches);
}
Exemplo n.º 4
0
void RecipientsHandler::AddRecipient_NoMatchFound(const std::wstring& displayName,
												  AbstractRecipient::Location location,
												  int index, 
												  Recipients* pRecipients)
{
	std::wostringstream msg;
	msg << "No match found [" << displayName.c_str() << "]." << std::ends;
	LOG_WS_INFO(msg.str().c_str());

	// By default the recipient type is External if we do not find a match
	AbstractRecipient::Type defaultType = AbstractRecipient::EXTERNAL; 
	
	// If we did not find a match it might be that the value is invalid, 
	// i.e. no match in the addressbook and the address (display value) is not SMTP/X400 format.
	bool isValidEmailAddress = IsValidEmailAddress(displayName);
	
	// If the address is invalid, the user might want to override the default behaviour
	if(!isValidEmailAddress)
	{
		AbstractRecipient::Type overrideType = TreatIndeterminateRecipientsAs();
		switch(overrideType)
		{
			case AbstractRecipient::INTERNAL:
			case AbstractRecipient::EXTERNAL:	
			{
				defaultType = overrideType; // Use the override value for type
				isValidEmailAddress = true; // Prevent the Workshare Invalid Recipient Dialog from being displayed
				break;
			}
		}
	}

	pRecipients->Add(new Recipient(	pRecipients->GetNoteHandle(), 
									index, 
									location, 
									displayName, 
									defaultType,
									isValidEmailAddress)); 	

}