summaryrefslogtreecommitdiffstats
path: root/kioslaves/imap4/imapinfo.h
blob: 7350544968e0c56173c3885666783a26c85d7ff3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
#ifndef _IMAPINFO_H
#define _IMAPINFO_H
/**********************************************************************
 *
 *   imapinfo.h  - IMAP4rev1 SELECT / EXAMINE handler
 *   Copyright (C) 2000 Sven Carstens
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *   Send comments and bug fixes to
 *
 *********************************************************************/

#include <tqstringlist.h>
#include <tqstring.h>

//class handling the info we get on EXAMINE and SELECT
class imapInfo
{
public:


  enum MessageAttribute
  {
    Seen = 1 << 0,
    Answered = 1 << 1,
    Flagged = 1 << 2,
    Deleted = 1 << 3,
    Draft = 1 << 4,
    Recent = 1 << 5,
    User = 1 << 6,
    // non standard flags
    Forwarded = 1 << 7,
    Todo = 1 << 8,
    Watched = 1 << 9,
    Ignored = 1 << 10
  };


    imapInfo ();
    imapInfo (const TQStringList &);
    imapInfo (const imapInfo &);
    imapInfo & operator = (const imapInfo &);

  static ulong _flags (const TQCString &);

  void setCount (ulong l)
  {
    countAvailable_ = true;
    count_ = l;
  }

  void setRecent (ulong l)
  {
    recentAvailable_ = true;
    recent_ = l;
  }

  void setUnseen (ulong l)
  {
    unseenAvailable_ = true;
    unseen_ = l;
  }

  void setUidValidity (ulong l)
  {
    uidValidityAvailable_ = true;
    uidValidity_ = l;
  }

  void setUidNext (ulong l)
  {
    uidNextAvailable_ = true;
    uidNext_ = l;
  }

  void setFlags (ulong l)
  {
    flagsAvailable_ = true;
    flags_ = l;
  }

  void setFlags (const TQCString & inFlag)
  {
    flagsAvailable_ = true;
    flags_ = _flags (inFlag);
  }

  void setPermanentFlags (ulong l)
  {
    permanentFlagsAvailable_ = true;
    permanentFlags_ = l;
  }

  void setPermanentFlags (const TQCString & inFlag)
  {
    permanentFlagsAvailable_ = true;
    permanentFlags_ = _flags (inFlag);
  }

  void setReadWrite (bool b)
  {
    readWriteAvailable_ = true;
    readWrite_ = b;
  }

  void setAlert( const char* cstr )
  {
    alert_ = cstr;
  }

  ulong count () const
  {
    return count_;
  }

  ulong recent () const
  {
    return recent_;
  }

  ulong unseen () const
  {
    return unseen_;
  }

  ulong uidValidity () const
  {
    return uidValidity_;
  }

  ulong uidNext () const
  {
    return uidNext_;
  }

  ulong flags () const
  {
    return flags_;
  }

  ulong permanentFlags () const
  {
    return permanentFlags_;
  }

  bool readWrite () const
  {
    return readWrite_;
  }

  ulong countAvailable () const
  {
    return countAvailable_;
  }

  ulong recentAvailable () const
  {
    return recentAvailable_;
  }

  ulong unseenAvailable () const
  {
    return unseenAvailable_;
  }

  ulong uidValidityAvailable () const
  {
    return uidValidityAvailable_;
  }

  ulong uidNextAvailable () const
  {
    return uidNextAvailable_;
  }

  ulong flagsAvailable () const
  {
    return flagsAvailable_;
  }

  ulong permanentFlagsAvailable () const
  {
    return permanentFlagsAvailable_;
  }

  bool readWriteAvailable () const
  {
    return readWriteAvailable_;
  }

  TQCString alert() const
  {
    return alert_;
  }

private:

  TQCString alert_;

  ulong count_;
  ulong recent_;
  ulong unseen_;
  ulong uidValidity_;
  ulong uidNext_;
  ulong flags_;
  ulong permanentFlags_;
  bool readWrite_;

  bool countAvailable_;
  bool recentAvailable_;
  bool unseenAvailable_;
  bool uidValidityAvailable_;
  bool uidNextAvailable_;
  bool flagsAvailable_;
  bool permanentFlagsAvailable_;
  bool readWriteAvailable_;
};

#endif