added: notifications to users' emails
(core/notify.h core/notify.cpp)
templatesnotify directory
all notifications are managed by a second thread
git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@512 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -358,3 +358,47 @@ std::string::size_type i;
|
||||
s[i] = s[i] - 'A' + 'a';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ValidateEmail(const std::string & email)
|
||||
{
|
||||
if( email.empty() )
|
||||
return false;
|
||||
|
||||
bool correct = true;
|
||||
size_t i;
|
||||
char allowed_chars[] = "!#$%&'*+-/=?^_`{|}~.@";
|
||||
int at = 0;
|
||||
|
||||
for(i=0 ; i<email.length() && correct ; ++i)
|
||||
{
|
||||
correct = false;
|
||||
|
||||
if( (email[i] >= 'A' && email[i]<='Z') ||
|
||||
(email[i] >= 'a' && email[i]<='z') ||
|
||||
(email[i] >= '0' && email[i]<='9') )
|
||||
{
|
||||
correct = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(size_t a=0 ; a < sizeof(allowed_chars)-1 ; ++a)
|
||||
{
|
||||
if( email[i] == allowed_chars[a] )
|
||||
{
|
||||
correct = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( email[i] == '@' )
|
||||
++at;
|
||||
}
|
||||
|
||||
if( at != 1 )
|
||||
return false;
|
||||
|
||||
return correct;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user