• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 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
49imapList::imapList (): parser_(0), noInferiors_ (false),
50noSelect_ (false), marked_ (false), unmarked_ (false),
51hasChildren_ (false), hasNoChildren_ (false)
52{
53}
54
55imapList::imapList (const imapList & lr):parser_(lr.parser_),
56hierarchyDelimiter_ (lr.hierarchyDelimiter_),
57name_ (lr.name_),
58noInferiors_ (lr.noInferiors_),
59noSelect_ (lr.noSelect_), marked_ (lr.marked_), unmarked_ (lr.unmarked_),
60hasChildren_ (lr.hasChildren_), hasNoChildren_ (lr.hasNoChildren_),
61attributes_ (lr.attributes_)
62{
63}
64
65imapList & imapList::operator = (const imapList & lr)
66{
67 // Avoid a = a.
68 if ( this == &lr ) {
69 return *this;
70 }
71
72 parser_ = lr.parser_;
73 hierarchyDelimiter_ = lr.hierarchyDelimiter_;
74 name_ = lr.name_;
75 noInferiors_ = lr.noInferiors_;
76 noSelect_ = lr.noSelect_;
77 marked_ = lr.marked_;
78 unmarked_ = lr.unmarked_;
79 hasChildren_ = lr.hasChildren_;
80 hasNoChildren_ = lr.hasNoChildren_;
81 attributes_ = lr.attributes_;
82
83 return *this;
84}
85
86imapList::imapList (const QString & inStr, imapParser &parser)
87: parser_(&parser),
88noInferiors_ (false),
89noSelect_ (false),
90marked_ (false), unmarked_ (false), hasChildren_ (false),
91hasNoChildren_ (false)
92{
93 parseString s;
94 s.data = inStr.toLatin1();
95
96 if ( s[0] != '(' ) {
97 return; //not proper format for us
98 }
99
100 s.pos++; // tie off (
101
102 parseAttributes( s );
103
104 s.pos++; // tie off )
105 parser_->skipWS( s );
106
107 hierarchyDelimiter_ = QString::fromLatin1( parser_->parseOneWord( s ) );
108 if ( hierarchyDelimiter_ == "NIL" ) {
109 hierarchyDelimiter_.clear();
110 }
111 name_ = QString::fromUtf8( KIMAP::decodeImapFolderName( parser_->parseLiteral( s ) ) ); // decode modified UTF7
112}
113
114void imapList::parseAttributes( parseString & str )
115{
116
117 while ( !str.isEmpty() && str[0] != ')' ) {
118 QString orig = QString::fromLatin1( parser_->parseOneWord( str ) );
119 attributes_ << orig;
120 QString attribute = orig.toLower();
121 if ( attribute.contains( "\\noinferiors" ) ) {
122 noInferiors_ = true;
123 } else if ( attribute.contains( "\\noselect" ) ) {
124 noSelect_ = true;
125 } else if ( attribute.contains( "\\marked" ) ) {
126 marked_ = true;
127 } else if ( attribute.contains( "\\unmarked" ) ) {
128 unmarked_ = true;
129 } else if ( attribute.contains( "\\haschildren" ) ) {
130 hasChildren_ = true;
131 } else if ( attribute.contains( "\\hasnochildren" ) ) {
132 hasNoChildren_ = true;
133 } else {
134 kDebug( 7116 ) << "imapList::imapList: bogus attribute" << attribute;
135 }
136 }
137}
parseString
a string used during parsing the string allows you to move the effective start of the string using st...
Definition: imapparser.h:52
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 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.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • 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