• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

kioslave/imap4

imaplist.cpp

00001 /**********************************************************************
00002  *
00003  *   imapinfo.cc  - IMAP4rev1 EXAMINE / SELECT handler
00004  *   Copyright (C) 2000 Sven Carstens <s.carstens@gmx.de>
00005  *
00006  *   This program is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   This program is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with this program; if not, write to the Free Software
00018  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  *   Send comments and bug fixes to
00021  *
00022  *********************************************************************/
00023 
00024 /*
00025   References:
00026     RFC 2060 - Internet Message Access Protocol - Version 4rev1 - December 1996
00027     RFC 2192 - IMAP URL Scheme - September 1997
00028     RFC 1731 - IMAP Authentication Mechanisms - December 1994
00029                (Discusses KERBEROSv4, GSSAPI, and S/Key)
00030     RFC 2195 - IMAP/POP AUTHorize Extension for Simple Challenge/Response
00031              - September 1997 (CRAM-MD5 authentication method)
00032     RFC 2104 - HMAC: Keyed-Hashing for Message Authentication - February 1997
00033 
00034   Supported URLs:
00035     imap://server/ - Prompt for user/pass, list all folders in home directory
00036     imap://user:pass@server/ - Uses LOGIN to log in
00037     imap://user;AUTH=method:pass@server/ - Uses AUTHENTICATE to log in
00038 
00039     imap://server/folder/ - List messages in folder
00040  */
00041 
00042 #include "imaplist.h"
00043 #include "imapparser.h"
00044 
00045 #include <kimap/rfccodecs.h>
00046 
00047 #include <kdebug.h>
00048 
00049 imapList::imapList (): parser_(0), noInferiors_ (false),
00050 noSelect_ (false), marked_ (false), unmarked_ (false),
00051 hasChildren_ (false), hasNoChildren_ (false)
00052 {
00053 }
00054 
00055 imapList::imapList (const imapList & lr):parser_(lr.parser_),
00056 hierarchyDelimiter_ (lr.hierarchyDelimiter_),
00057 name_ (lr.name_),
00058 noInferiors_ (lr.noInferiors_),
00059 noSelect_ (lr.noSelect_), marked_ (lr.marked_), unmarked_ (lr.unmarked_),
00060 hasChildren_ (lr.hasChildren_), hasNoChildren_ (lr.hasNoChildren_),
00061 attributes_ (lr.attributes_)
00062 {
00063 }
00064 
00065 imapList & imapList::operator = (const imapList & lr)
00066 {
00067   // Avoid a = a.
00068   if (this == &lr)
00069     return *this;
00070 
00071   parser_ = lr.parser_;
00072   hierarchyDelimiter_ = lr.hierarchyDelimiter_;
00073   name_ = lr.name_;
00074   noInferiors_ = lr.noInferiors_;
00075   noSelect_ = lr.noSelect_;
00076   marked_ = lr.marked_;
00077   unmarked_ = lr.unmarked_;
00078   hasChildren_ = lr.hasChildren_;
00079   hasNoChildren_ = lr.hasNoChildren_;
00080   attributes_ = lr.attributes_;
00081 
00082   return *this;
00083 }
00084 
00085 imapList::imapList (const QString & inStr, imapParser &parser)
00086 : parser_(&parser),
00087 noInferiors_ (false),
00088 noSelect_ (false),
00089 marked_ (false), unmarked_ (false), hasChildren_ (false),
00090 hasNoChildren_ (false)
00091 {
00092   parseString s;
00093   s.data = inStr.toLatin1();
00094 
00095   if (s[0] != '(')
00096     return;                     //not proper format for us
00097 
00098   s.pos++;  // tie off (
00099 
00100   parseAttributes( s );
00101 
00102   s.pos++;  // tie off )
00103   parser_->skipWS (s);
00104 
00105   hierarchyDelimiter_ = parser_->parseOneWord(s);
00106   if (hierarchyDelimiter_ == "NIL")
00107     hierarchyDelimiter_.clear();
00108   name_ = KIMAP::decodeImapFolderName (parser_->parseLiteral (s));  // decode modified UTF7
00109 }
00110 
00111 void imapList::parseAttributes( parseString & str )
00112 {
00113 
00114   while ( !str.isEmpty () && str[0] != ')' )
00115   {
00116     QString orig = QString::fromLatin1( parser_->parseOneWord(str) );
00117     attributes_ << orig;
00118     QString attribute = orig.toLower();
00119     if ( attribute.contains ("\\noinferiors"))
00120       noInferiors_ = true;
00121     else if ( attribute.contains ("\\noselect"))
00122       noSelect_ = true;
00123     else if ( attribute.contains ("\\marked"))
00124       marked_ = true;
00125     else if ( attribute.contains ("\\unmarked"))
00126       unmarked_ = true;
00127     else if ( attribute.contains ("\\haschildren"))
00128       hasChildren_ = true;
00129     else if ( attribute.contains ("\\hasnochildren"))
00130       hasNoChildren_ = true;
00131     else
00132       kDebug(7116) <<"imapList::imapList: bogus attribute" << attribute;
00133   }
00134 }
00135 

kioslave/imap4

Skip menu "kioslave/imap4"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.6
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal