kioslaves

imapinfo.h

Go to the documentation of this file.
00001 #ifndef _IMAPINFO_H
00002 #define _IMAPINFO_H
00003 /**********************************************************************
00004  *
00005  *   imapinfo.h  - IMAP4rev1 SELECT / EXAMINE handler
00006  *   Copyright (C) 2000 Sven Carstens
00007  *
00008  *   This program is free software; you can redistribute it and/or modify
00009  *   it under the terms of the GNU General Public License as published by
00010  *   the Free Software Foundation; either version 2 of the License, or
00011  *   (at your option) any later version.
00012  *
00013  *   This program is distributed in the hope that it will be useful,
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *   GNU General Public License for more details.
00017  *
00018  *   You should have received a copy of the GNU General Public License
00019  *   along with this program; if not, write to the Free Software
00020  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00021  *
00022  *   Send comments and bug fixes to
00023  *
00024  *********************************************************************/
00025 
00026 #include <qstringlist.h>
00027 #include <qstring.h>
00028 
00029 //class handling the info we get on EXAMINE and SELECT
00030 class imapInfo
00031 {
00032 public:
00033 
00034 
00035   enum MessageAttribute
00036   {
00037     Seen = 1 << 0,
00038     Answered = 1 << 1,
00039     Flagged = 1 << 2,
00040     Deleted = 1 << 3,
00041     Draft = 1 << 4,
00042     Recent = 1 << 5,
00043     User = 1 << 6,
00044     // non standard flags
00045     Forwarded = 1 << 7,
00046     Todo = 1 << 8,
00047     Watched = 1 << 9,
00048     Ignored = 1 << 10
00049   };
00050 
00051 
00052     imapInfo ();
00053     imapInfo (const QStringList &);
00054     imapInfo (const imapInfo &);
00055     imapInfo & operator = (const imapInfo &);
00056 
00057   static ulong _flags (const QCString &);
00058 
00059   void setCount (ulong l)
00060   {
00061     countAvailable_ = true;
00062     count_ = l;
00063   }
00064 
00065   void setRecent (ulong l)
00066   {
00067     recentAvailable_ = true;
00068     recent_ = l;
00069   }
00070 
00071   void setUnseen (ulong l)
00072   {
00073     unseenAvailable_ = true;
00074     unseen_ = l;
00075   }
00076 
00077   void setUidValidity (ulong l)
00078   {
00079     uidValidityAvailable_ = true;
00080     uidValidity_ = l;
00081   }
00082 
00083   void setUidNext (ulong l)
00084   {
00085     uidNextAvailable_ = true;
00086     uidNext_ = l;
00087   }
00088 
00089   void setFlags (ulong l)
00090   {
00091     flagsAvailable_ = true;
00092     flags_ = l;
00093   }
00094 
00095   void setFlags (const QCString & inFlag)
00096   {
00097     flagsAvailable_ = true;
00098     flags_ = _flags (inFlag);
00099   }
00100 
00101   void setPermanentFlags (ulong l)
00102   {
00103     permanentFlagsAvailable_ = true;
00104     permanentFlags_ = l;
00105   }
00106 
00107   void setPermanentFlags (const QCString & inFlag)
00108   {
00109     permanentFlagsAvailable_ = true;
00110     permanentFlags_ = _flags (inFlag);
00111   }
00112 
00113   void setReadWrite (bool b)
00114   {
00115     readWriteAvailable_ = true;
00116     readWrite_ = b;
00117   }
00118 
00119   void setAlert( const char* cstr )
00120   {
00121     alert_ = cstr;
00122   }
00123 
00124   ulong count () const
00125   {
00126     return count_;
00127   }
00128 
00129   ulong recent () const
00130   {
00131     return recent_;
00132   }
00133 
00134   ulong unseen () const
00135   {
00136     return unseen_;
00137   }
00138 
00139   ulong uidValidity () const
00140   {
00141     return uidValidity_;
00142   }
00143 
00144   ulong uidNext () const
00145   {
00146     return uidNext_;
00147   }
00148 
00149   ulong flags () const
00150   {
00151     return flags_;
00152   }
00153 
00154   ulong permanentFlags () const
00155   {
00156     return permanentFlags_;
00157   }
00158 
00159   bool readWrite () const
00160   {
00161     return readWrite_;
00162   }
00163 
00164   ulong countAvailable () const
00165   {
00166     return countAvailable_;
00167   }
00168 
00169   ulong recentAvailable () const
00170   {
00171     return recentAvailable_;
00172   }
00173 
00174   ulong unseenAvailable () const
00175   {
00176     return unseenAvailable_;
00177   }
00178 
00179   ulong uidValidityAvailable () const
00180   {
00181     return uidValidityAvailable_;
00182   }
00183 
00184   ulong uidNextAvailable () const
00185   {
00186     return uidNextAvailable_;
00187   }
00188 
00189   ulong flagsAvailable () const
00190   {
00191     return flagsAvailable_;
00192   }
00193 
00194   ulong permanentFlagsAvailable () const
00195   {
00196     return permanentFlagsAvailable_;
00197   }
00198 
00199   bool readWriteAvailable () const
00200   {
00201     return readWriteAvailable_;
00202   }
00203 
00204   QCString alert() const
00205   {
00206     return alert_;
00207   }
00208 
00209 private:
00210 
00211   QCString alert_;
00212 
00213   ulong count_;
00214   ulong recent_;
00215   ulong unseen_;
00216   ulong uidValidity_;
00217   ulong uidNext_;
00218   ulong flags_;
00219   ulong permanentFlags_;
00220   bool readWrite_;
00221 
00222   bool countAvailable_;
00223   bool recentAvailable_;
00224   bool unseenAvailable_;
00225   bool uidValidityAvailable_;
00226   bool uidNextAvailable_;
00227   bool flagsAvailable_;
00228   bool permanentFlagsAvailable_;
00229   bool readWriteAvailable_;
00230 };
00231 
00232 #endif