/** * @file greeting.cc * @brief Implementation of the inital greeting. * @author Andreas Aardal Hanssen * @date 2002-2005 */ #include "globals.h" #include "iodevice.h" #include "iofactory.h" #include "session.h" #include using namespace Binc; static const unsigned int ISO8601SIZE = 32; namespace Binc { void showGreeting(); }; void Binc::showGreeting() { Session &session = Session::getInstance(); time_t t = time(nullptr); struct tm *mytm = localtime(&t); char mytime[ISO8601SIZE]; unsigned int size = strftime(mytime, sizeof(mytime), "%Y-%m-%d %H:%M:%S %z", mytm); if (size >= sizeof(mytime) || size == 0) mytime[0] = 0; if (session.hasEnv("VERBOSE_GREETING")) { bincClient << "* OK Welcome to Binc IMAP " << BINC_VERSION << " " << IMAP_VERSION << " by Andreas Aardal Hanssen & Erwin Hoffmann at " << mytime << std::endl; } else { bincClient << "* OK Welcome to Binc IMAP at " << mytime << std::endl; } }