Archived
1
0

track primordial goo frontends

This commit is contained in:
Jeff Becker
2016-10-15 09:12:01 -04:00
parent 9e9a1efe06
commit cc089b3401
20 changed files with 900 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#include "message.hpp"
namespace nntpchan
{
bool IsValidMessageID(const MessageID & msgid)
{
auto itr = msgid.begin();
auto end = msgid.end();
--end;
if (*itr != '<') return false;
if (*end != '>') return false;
bool atfound = false;
while(itr != end) {
auto c = *itr;
++itr;
if(atfound && c == '@') return false;
if(c == '@') {
atfound = true;
continue;
}
if (c == '$' || c == '_' || c == '-') continue;
if (c > '0' && c < '9') continue;
if (c > 'A' && c < 'Z') continue;
if (c > 'a' && c < 'z') continue;
return false;
}
return true;
}
}