Logo Search packages:      
Sourcecode: pan version File versions

std::string GNKSA::generate_message_id ( const StringView domain  )  [static]

thus spake son-of-1036: "the most popular method of generating local parts is to use the date and time, plus some way of distinguishing between simultaneous postings on the same host (e.g., a process number), and encode them in a suitably-reduced alphabet.

Definition at line 839 of file gnksa.cc.

References pan::StringView::empty(), and pan::StringView::to_string().

{
   std::string s;

   // start with '<'
   s += '<';

   // add unique local part to message-id 
   s += "pan.";
   const time_t now (time(NULL));
   struct tm local_now = *gmtime (&now);
   char buf[64];
   std::strftime (buf, sizeof(buf), "%Y.%m.%d.%H.%M.%S", &local_now);
   s += buf;

   // delimit
   s += '@';

   // add domain
   s += domain.empty() ? default_domain : domain.to_string();

   // end with '>'
   s += '>';

   return s;
}


Generated by  Doxygen 1.6.0   Back to index