• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.9.1 API Reference
  • KDE Home
  • Contact Us
 

kioslave/imap4

  • kioslave
  • imap4
imaplist.cpp
1 /**********************************************************************
2  *
3  * imapinfo.cc - IMAP4rev1 EXAMINE / SELECT handler
4  * Copyright (C) 2000 Sven Carstens <s.carstens@gmx.de>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * Send comments and bug fixes to
21  *
22  *********************************************************************/
23 
24 /*
25  References:
26  RFC 2060 - Internet Message Access Protocol - Version 4rev1 - December 1996
27  RFC 2192 - IMAP URL Scheme - September 1997
28  RFC 1731 - IMAP Authentication Mechanisms - December 1994
29  (Discusses KERBEROSv4, GSSAPI, and S/Key)
30  RFC 2195 - IMAP/POP AUTHorize Extension for Simple Challenge/Response
31  - September 1997 (CRAM-MD5 authentication method)
32  RFC 2104 - HMAC: Keyed-Hashing for Message Authentication - February 1997
33 
34  Supported URLs:
35  imap://server/ - Prompt for user/pass, list all folders in home directory
36  imap://user:pass@server/ - Uses LOGIN to log in
37  imap://user;AUTH=method:pass@server/ - Uses AUTHENTICATE to log in
38 
39  imap://server/folder/ - List messages in folder
40  */
41 
42 #include "imaplist.h"
43 #include "imapparser.h"
44 
45 #include <kimap/rfccodecs.h>
46 
47 #include <kdebug.h>
48 
49 imapList::imapList (): parser_(0), noInferiors_ (false),
50 noSelect_ (false), marked_ (false), unmarked_ (false),
51 hasChildren_ (false), hasNoChildren_ (false)
52 {
53 }
54 
55 imapList::imapList (const imapList & lr):parser_(lr.parser_),
56 hierarchyDelimiter_ (lr.hierarchyDelimiter_),
57 name_ (lr.name_),
58 noInferiors_ (lr.noInferiors_),
59 noSelect_ (lr.noSelect_), marked_ (lr.marked_), unmarked_ (lr.unmarked_),
60 hasChildren_ (lr.hasChildren_), hasNoChildren_ (lr.hasNoChildren_),
61 attributes_ (lr.attributes_)
62 {
63 }
64 
65 imapList & imapList::operator = (const imapList & lr)
66 {
67  // Avoid a = a.
68  if (this == &lr)
69  return *this;
70 
71  parser_ = lr.parser_;
72  hierarchyDelimiter_ = lr.hierarchyDelimiter_;
73  name_ = lr.name_;
74  noInferiors_ = lr.noInferiors_;
75  noSelect_ = lr.noSelect_;
76  marked_ = lr.marked_;
77  unmarked_ = lr.unmarked_;
78  hasChildren_ = lr.hasChildren_;
79  hasNoChildren_ = lr.hasNoChildren_;
80  attributes_ = lr.attributes_;
81 
82  return *this;
83 }
84 
85 imapList::imapList (const QString & inStr, imapParser &parser)
86 : parser_(&parser),
87 noInferiors_ (false),
88 noSelect_ (false),
89 marked_ (false), unmarked_ (false), hasChildren_ (false),
90 hasNoChildren_ (false)
91 {
92  parseString s;
93  s.data = inStr.toLatin1();
94 
95  if (s[0] != '(')
96  return; //not proper format for us
97 
98  s.pos++; // tie off (
99 
100  parseAttributes( s );
101 
102  s.pos++; // tie off )
103  parser_->skipWS (s);
104 
105  hierarchyDelimiter_ = QString::fromLatin1 (parser_->parseOneWord(s));
106  if (hierarchyDelimiter_ == "NIL")
107  hierarchyDelimiter_.clear();
108  name_ = QString::fromUtf8 (KIMAP::decodeImapFolderName (parser_->parseLiteral (s))); // decode modified UTF7
109 }
110 
111 void imapList::parseAttributes( parseString & str )
112 {
113 
114  while ( !str.isEmpty () && str[0] != ')' )
115  {
116  QString orig = QString::fromLatin1( parser_->parseOneWord(str) );
117  attributes_ << orig;
118  QString attribute = orig.toLower();
119  if ( attribute.contains ("\\noinferiors"))
120  noInferiors_ = true;
121  else if ( attribute.contains ("\\noselect"))
122  noSelect_ = true;
123  else if ( attribute.contains ("\\marked"))
124  marked_ = true;
125  else if ( attribute.contains ("\\unmarked"))
126  unmarked_ = true;
127  else if ( attribute.contains ("\\haschildren"))
128  hasChildren_ = true;
129  else if ( attribute.contains ("\\hasnochildren"))
130  hasNoChildren_ = true;
131  else
132  kDebug(7116) <<"imapList::imapList: bogus attribute" << attribute;
133  }
134 }
135 
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Sep 24 2012 09:02:51 by doxygen 1.8.1.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kioslave/imap4

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

kdepimlibs-4.9.1 API Reference

Skip menu "kdepimlibs-4.9.1 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal