tdeioslave/imap4

imapinfo.h
1 #ifndef _IMAPINFO_H
2 #define _IMAPINFO_H
3 /**********************************************************************
4  *
5  * imapinfo.h - IMAP4rev1 SELECT / EXAMINE handler
6  * Copyright (C) 2000 Sven Carstens <s.carstens@gmx.de>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Send comments and bug fixes to
23  *
24  *********************************************************************/
25 
26 #include <tqstringlist.h>
27 #include <tqstring.h>
28 
29 //class handling the info we get on EXAMINE and SELECT
30 class imapInfo
31 {
32 public:
33 
34 
35  enum MessageAttribute
36  {
37  Seen = 1 << 0,
38  Answered = 1 << 1,
39  Flagged = 1 << 2,
40  Deleted = 1 << 3,
41  Draft = 1 << 4,
42  Recent = 1 << 5,
43  User = 1 << 6,
44  // non standard flags
45  Forwarded = 1 << 7,
46  Todo = 1 << 8,
47  Watched = 1 << 9,
48  Ignored = 1 << 10
49  };
50 
51 
52  imapInfo ();
53  imapInfo (const TQStringList &);
54  imapInfo (const imapInfo &);
55  imapInfo & operator = (const imapInfo &);
56 
57  static ulong _flags (const TQCString &);
58 
59  void setCount (ulong l)
60  {
61  countAvailable_ = true;
62  count_ = l;
63  }
64 
65  void setRecent (ulong l)
66  {
67  recentAvailable_ = true;
68  recent_ = l;
69  }
70 
71  void setUnseen (ulong l)
72  {
73  unseenAvailable_ = true;
74  unseen_ = l;
75  }
76 
77  void setUidValidity (ulong l)
78  {
79  uidValidityAvailable_ = true;
80  uidValidity_ = l;
81  }
82 
83  void setUidNext (ulong l)
84  {
85  uidNextAvailable_ = true;
86  uidNext_ = l;
87  }
88 
89  void setFlags (ulong l)
90  {
91  flagsAvailable_ = true;
92  flags_ = l;
93  }
94 
95  void setFlags (const TQCString & inFlag)
96  {
97  flagsAvailable_ = true;
98  flags_ = _flags (inFlag);
99  }
100 
101  void setPermanentFlags (ulong l)
102  {
103  permanentFlagsAvailable_ = true;
104  permanentFlags_ = l;
105  }
106 
107  void setPermanentFlags (const TQCString & inFlag)
108  {
109  permanentFlagsAvailable_ = true;
110  permanentFlags_ = _flags (inFlag);
111  }
112 
113  void setReadWrite (bool b)
114  {
115  readWriteAvailable_ = true;
116  readWrite_ = b;
117  }
118 
119  void setAlert( const char* cstr )
120  {
121  alert_ = cstr;
122  }
123 
124  ulong count () const
125  {
126  return count_;
127  }
128 
129  ulong recent () const
130  {
131  return recent_;
132  }
133 
134  ulong unseen () const
135  {
136  return unseen_;
137  }
138 
139  ulong uidValidity () const
140  {
141  return uidValidity_;
142  }
143 
144  ulong uidNext () const
145  {
146  return uidNext_;
147  }
148 
149  ulong flags () const
150  {
151  return flags_;
152  }
153 
154  ulong permanentFlags () const
155  {
156  return permanentFlags_;
157  }
158 
159  bool readWrite () const
160  {
161  return readWrite_;
162  }
163 
164  ulong countAvailable () const
165  {
166  return countAvailable_;
167  }
168 
169  ulong recentAvailable () const
170  {
171  return recentAvailable_;
172  }
173 
174  ulong unseenAvailable () const
175  {
176  return unseenAvailable_;
177  }
178 
179  ulong uidValidityAvailable () const
180  {
181  return uidValidityAvailable_;
182  }
183 
184  ulong uidNextAvailable () const
185  {
186  return uidNextAvailable_;
187  }
188 
189  ulong flagsAvailable () const
190  {
191  return flagsAvailable_;
192  }
193 
194  ulong permanentFlagsAvailable () const
195  {
196  return permanentFlagsAvailable_;
197  }
198 
199  bool readWriteAvailable () const
200  {
201  return readWriteAvailable_;
202  }
203 
204  TQCString alert() const
205  {
206  return alert_;
207  }
208 
209 private:
210 
211  TQCString alert_;
212 
213  ulong count_;
214  ulong recent_;
215  ulong unseen_;
216  ulong uidValidity_;
217  ulong uidNext_;
218  ulong flags_;
219  ulong permanentFlags_;
220  bool readWrite_;
221 
222  bool countAvailable_;
223  bool recentAvailable_;
224  bool unseenAvailable_;
225  bool uidValidityAvailable_;
226  bool uidNextAvailable_;
227  bool flagsAvailable_;
228  bool permanentFlagsAvailable_;
229  bool readWriteAvailable_;
230 };
231 
232 #endif