Bincimap 2.0.16
Easy Imapping
Loading...
Searching...
No Matches
greeting.cc
Go to the documentation of this file.
1
7#include <time.h>
8
9#include "iodevice.h"
10#include "iofactory.h"
11#include "session.h"
12#include "globals.h"
13
14using namespace ::std;
15using namespace Binc;
16
17static const unsigned int ISO8601SIZE = 32;
18
19namespace Binc {
20 void showGreeting(void);
21};
22
23
24//------------------------------------------------------------------------
25void Binc::showGreeting(void)
26{
27 Session &session = Session::getInstance();
28
29 time_t t = time(0);
30 struct tm *mytm = localtime(&t);
31
32 char mytime[ISO8601SIZE];
33 unsigned int size = strftime(mytime, sizeof(mytime), "%Y-%m-%d %H:%M:%S %z", mytm);
34 if (size >= sizeof(mytime) || size == 0)
35 mytime[0] = 0;
36
37 if (session.hasEnv("VERBOSE_GREETING")) {
38 bincClient << "* OK Welcome to Binc IMAP "
39 << BINC_VERSION
40 << " "
41 << IMAP_VERSION
42 << " by Andreas Aardal Hanssen & Erwin Hoffmann at "
43 << mytime << endl;
44 } else {
45 bincClient << "* OK Welcome to Binc IMAP at " << mytime << endl;
46 }
47}
static Session & getInstance(void)
Definition: session.cc:33
bool hasEnv(const std::string &key) const
Definition: session.cc:224
Global constants.
#define BINC_VERSION
Definition: globals.h:10
#define IMAP_VERSION
Definition: globals.h:11
Declaration of the IODevice class.
Declaration of the IOFactory class.
#define bincClient
Definition: iofactory.h:31
Definition: bincimapd.cc:9
void showGreeting(void)
Definition: bincimapd.cc:10