Bincimap 2.0.16
Easy Imapping
Loading...
Searching...
No Matches
operator-namespace.cc
Go to the documentation of this file.
1
7#include <string>
8#include <iostream>
9
10#include "depot.h"
11#include "iodevice.h"
12#include "iofactory.h"
13#include "operators.h"
14#include "recursivedescent.h"
15#include "session.h"
16
17using namespace ::std;
18using namespace Binc;
19
20//----------------------------------------------------------------------
22{
23}
24
25//----------------------------------------------------------------------
27{
28}
29
30//----------------------------------------------------------------------
31const string NamespaceOperator::getName(void) const
32{
33 return "NAMESPACE";
34}
35
36//----------------------------------------------------------------------
38{
40}
41
42//----------------------------------------------------------------------
44 Request &command)
45{
46 bincClient << "* NAMESPACE ";
47
48 bincClient << "(("; // personal namespace
50 bincClient << " ";
51 char c = depot.getDelimiter();
52 bincClient << toImapString(string(&c, 1));
53 bincClient << "))";
54
55 bincClient << " NIL"; // others' namespaces
56 bincClient << " NIL"; // shared namespaces
57 bincClient << endl;
58
59 return OK;
60}
61
62//----------------------------------------------------------------------
64{
65 Session &session = Session::getInstance();
66
67 if (c_in.getUidMode())
68 return REJECT;
69
71 if ((res = expectCRLF()) != ACCEPT) {
72 session.setLastError("Expected CRLF after NAMESPACE");
73 return res;
74 }
75
76 c_in.setName("NAMESPACE");
77
78 return ACCEPT;
79}
virtual const std::string & getPersonalNamespace(void) const
Definition: depot.cc:139
const char getDelimiter(void) const
Definition: depot.cc:163
virtual ParseResult parse(Request &) const
virtual ProcessResult process(Depot &, Request &)
const std::string getName(void) const
void setName(const std::string &s_in)
Definition: imapparser.cc:70
bool getUidMode(void) const
Definition: imapparser.cc:40
void setLastError(const std::string &error) const
Definition: session.cc:185
@ AUTHENTICATED
Definition: session.h:37
static Session & getInstance(void)
Definition: session.cc:33
Declaration of the IODevice class.
Declaration of the IOFactory class.
#define bincClient
Definition: iofactory.h:31
Definition: bincimapd.cc:9
std::string toImapString(const std::string &s_in)
Definition: convert.h:103
Operator::ParseResult expectCRLF(void)
Declaration of all operators.
Declaration of a recursive descent IMAP command parser.