<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> <head> <title>libemailfunctions: email.h Source File (libemailfunctions)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org" r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org" r (n 0 s 0 v 0 l 0))' /> <meta name="trademark" content="KDE e.V." /> <meta name="description" content="K Desktop Environment Homepage, KDE.org" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="robots" content="all" /> <link rel="shortcut icon" href="../../favicon.ico" /> <link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" /> <style type="text/css"> <!-- hr { display: none; } #content h2 { margin-left: 0px; } table.mdTable { background-color: #f8f8f8; border: .2em solid #d7d7d7; } td.mdRow { padding: 8px 20px; } td.md { font-weight: bold; } td.mdname1 { font-weight: bold; color: #602020; } td.mdname { font-weight: bold; color: #602020; } --> </style> </head> <body> <div id="nav_header_top" align="right"> <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a> <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a> <span class="doNotDisplay">::</span> <img id="nav_header_logo_right" alt="" align="right" src="../../pimlogo.png" border="0" /> <div id="nav_header_title" align="left">KDE PIM API Reference</div> </div> <div id="nav_header_bottom" align="right"> <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span> <div id="nav_header_bottom_left" style="text-align: left;"> / <a href="../../">API Reference</a> / <a href=".">libemailfunctions</a> </div> </div> <table id="main" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="top" class="menuheader" height="0"></td> <td id="contentcolumn" valign="top" rowspan="2" > <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;"> <h2><a name="content"></a>libemailfunctions</h2> <!-- Generated by Doxygen 1.5.5 --> <h1>email.h</h1><a href="email_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode: C++; c-file-style: "gnu" -*-</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment"> This file is part of kdepim.</span> <a name="l00004"></a>00004 <span class="comment"> Copyright (c) 2004 KDEPIM developers</span> <a name="l00005"></a>00005 <span class="comment"></span> <a name="l00006"></a>00006 <span class="comment"> This library is free software; you can redistribute it and/or</span> <a name="l00007"></a>00007 <span class="comment"> modify it under the terms of the GNU Library General Public</span> <a name="l00008"></a>00008 <span class="comment"> License as published by the Free Software Foundation; either</span> <a name="l00009"></a>00009 <span class="comment"> version 2 of the License, or (at your option) any later version.</span> <a name="l00010"></a>00010 <span class="comment"></span> <a name="l00011"></a>00011 <span class="comment"> This library is distributed in the hope that it will be useful,</span> <a name="l00012"></a>00012 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00013"></a>00013 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00014"></a>00014 <span class="comment"> Library General Public License for more details.</span> <a name="l00015"></a>00015 <span class="comment"></span> <a name="l00016"></a>00016 <span class="comment"> You should have received a copy of the GNU Library General Public License</span> <a name="l00017"></a>00017 <span class="comment"> along with this library; see the file COPYING.LIB. If not, write to</span> <a name="l00018"></a>00018 <span class="comment"> the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,</span> <a name="l00019"></a>00019 <span class="comment"> Boston, MA 02110-1301, USA.</span> <a name="l00020"></a>00020 <span class="comment">*/</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="preprocessor">#ifndef EMAIL_H</span> <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define EMAIL_H</span> <a name="l00024"></a>00024 <span class="preprocessor"></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <qstringlist.h></span> <a name="l00026"></a>00026 <span class="preprocessor">#include <qcstring.h></span> <a name="l00027"></a>00027 <a name="l00028"></a>00028 <span class="preprocessor">#include <kdepimmacros.h></span> <a name="l00029"></a>00029 <a name="l00039"></a><a class="code" href="namespaceKPIM.html">00039</a> <span class="keyword">namespace </span>KPIM { <a name="l00040"></a>00040 <a name="l00044"></a><a class="code" href="namespaceKPIM.html#e264878f406140142a8ea814d844269c">00044</a> <span class="keyword">enum</span> <a class="code" href="namespaceKPIM.html#e264878f406140142a8ea814d844269c" title="Result type for splitAddress, isValidEmailAddress.">EmailParseResult</a> { AddressOk, AddressEmpty, UnexpectedEnd, <a name="l00045"></a>00045 UnbalancedParens, MissingDomainPart, <a name="l00046"></a>00046 UnclosedAngleAddr, UnopenedAngleAddr, <a name="l00047"></a>00047 TooManyAts, UnexpectedComma, <a name="l00048"></a>00048 TooFewAts, MissingLocalPart, <a name="l00049"></a>00049 UnbalancedQuote, NoAddressSpec, <a name="l00050"></a>00050 DisallowedChar, InvalidDisplayName }; <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="comment">// Helper functions</span> <a name="l00054"></a>00054 <span class="comment"></span>KDE_EXPORT QStringList <a class="code" href="namespaceKPIM.html#1b3f944447af939d7cc8dbcca3e17dd1" title="Split a comma separated list of email addresses.">splitEmailAddrList</a>(<span class="keyword">const</span> QString& aStr); <a name="l00055"></a>00055 <a name="l00075"></a>00075 KDE_EXPORT <a class="code" href="namespaceKPIM.html#e264878f406140142a8ea814d844269c" title="Result type for splitAddress, isValidEmailAddress.">EmailParseResult</a> <a class="code" href="namespaceKPIM.html#d6086383a189e47fec3dfb8b23454e42" title="Splits the given address into display name, email address and comment.">splitAddress</a>( <span class="keyword">const</span> QCString & address, <a name="l00076"></a>00076 QCString & displayName, <a name="l00077"></a>00077 QCString & addrSpec, <a name="l00078"></a>00078 QCString & comment ); <a name="l00079"></a>00079 <a name="l00102"></a>00102 KDE_EXPORT <a class="code" href="namespaceKPIM.html#e264878f406140142a8ea814d844269c" title="Result type for splitAddress, isValidEmailAddress.">EmailParseResult</a> <a class="code" href="namespaceKPIM.html#d6086383a189e47fec3dfb8b23454e42" title="Splits the given address into display name, email address and comment.">splitAddress</a>( <span class="keyword">const</span> QString & address, <a name="l00103"></a>00103 QString & displayName, <a name="l00104"></a>00104 QString & addrSpec, <a name="l00105"></a>00105 QString & comment ); <a name="l00106"></a>00106 <a name="l00116"></a>00116 KDE_EXPORT <a class="code" href="namespaceKPIM.html#e264878f406140142a8ea814d844269c" title="Result type for splitAddress, isValidEmailAddress.">EmailParseResult</a> <a class="code" href="namespaceKPIM.html#ede7c3a71b38831ff4af76ae1c43ba59" title="Validates an email address in the form of &quot;Joe User&quot; &lt;joe@example.org&gt;...">isValidEmailAddress</a>( <span class="keyword">const</span> QString& aStr ); <a name="l00117"></a>00117 <a name="l00125"></a>00125 KDE_EXPORT QString <a class="code" href="namespaceKPIM.html#a30952e2f1363639b6cbf9900eca8c48" title="Translate the enum errorcodes from emailParseResult into i18n&#39;d strings that...">emailParseResultToString</a>( <a class="code" href="namespaceKPIM.html#e264878f406140142a8ea814d844269c" title="Result type for splitAddress, isValidEmailAddress.">EmailParseResult</a> errorCode ); <a name="l00126"></a>00126 <a name="l00137"></a>00137 KDE_EXPORT <span class="keywordtype">bool</span> <a class="code" href="namespaceKPIM.html#2a79d27619162ebcde5e1baafab32107" title="Validates an email address in the form of joe@example.org.">isValidSimpleEmailAddress</a>( <span class="keyword">const</span> QString& aStr ); <a name="l00138"></a>00138 <a name="l00146"></a>00146 KDE_EXPORT QString <a class="code" href="namespaceKPIM.html#07eb04eabd4c1a4751367e4315830118" title="Returns a i18n string to be used in msgboxes this allows for error messages to be...">simpleEmailAddressErrorMsg</a>(); <a name="l00147"></a>00147 <a name="l00155"></a>00155 KDE_EXPORT QCString <a class="code" href="namespaceKPIM.html#a99a7f05e78366de201ef16e9ad3f2f5" title="Returns the pure email address (addr-spec in RFC2822) of the given address (mailbox...">getEmailAddress</a>( <span class="keyword">const</span> QCString & address ); <a name="l00156"></a>00156 <a name="l00167"></a>00167 KDE_EXPORT QString <a class="code" href="namespaceKPIM.html#a99a7f05e78366de201ef16e9ad3f2f5" title="Returns the pure email address (addr-spec in RFC2822) of the given address (mailbox...">getEmailAddress</a>( <span class="keyword">const</span> QString & address ); <a name="l00168"></a>00168 <a name="l00176"></a>00176 KDE_EXPORT QCString <a class="code" href="namespaceKPIM.html#ae29d22b62f0fcbf0d38d3bcf248b3fd" title="Returns the pure email address (addr-spec in RFC2822) of the first email address...">getFirstEmailAddress</a>( <span class="keyword">const</span> QCString & addresses ); <a name="l00177"></a>00177 <a name="l00188"></a>00188 KDE_EXPORT QString <a class="code" href="namespaceKPIM.html#ae29d22b62f0fcbf0d38d3bcf248b3fd" title="Returns the pure email address (addr-spec in RFC2822) of the first email address...">getFirstEmailAddress</a>( <span class="keyword">const</span> QString & addresses ); <a name="l00189"></a>00189 <a name="l00198"></a>00198 KDE_EXPORT <span class="keywordtype">bool</span> <a class="code" href="namespaceKPIM.html#d54fbc02d97ef37fb27d30c26af9ab76" title="Return email address and name from string.">getNameAndMail</a>(<span class="keyword">const</span> QString& aStr, QString& name, QString& mail); <a name="l00199"></a>00199 <a name="l00205"></a>00205 KDE_EXPORT <span class="keywordtype">bool</span> <a class="code" href="namespaceKPIM.html#1cbe7054b25251d7bc7f4b56c343ec6a" title="Compare two email addresses.">compareEmail</a>( <span class="keyword">const</span> QString& email1, <span class="keyword">const</span> QString& email2, <a name="l00206"></a>00206 <span class="keywordtype">bool</span> matchName ); <a name="l00207"></a>00207 <a name="l00220"></a>00220 KDE_EXPORT QString <a class="code" href="namespaceKPIM.html#8e002e2ce057d79589151e36e2cd00c7" title="Returns a normalized address built from the given parts.">normalizedAddress</a>( <span class="keyword">const</span> QString & displayName, <a name="l00221"></a>00221 <span class="keyword">const</span> QString & addrSpec, <a name="l00222"></a>00222 <span class="keyword">const</span> QString & comment ); <a name="l00223"></a>00223 <a name="l00229"></a>00229 KDE_EXPORT QString <a class="code" href="namespaceKPIM.html#dda15f298395eb08a1e739ea2dd71879" title="Decodes the punycode domain part of the given addr-spec if it&#39;s an IDN.">decodeIDN</a>( <span class="keyword">const</span> QString & addrSpec ); <a name="l00230"></a>00230 <a name="l00237"></a>00237 KDE_EXPORT QString <a class="code" href="namespaceKPIM.html#f9d1d1c848629fdfc1ee760a917f7e6b" title="Encodes the domain part of the given addr-spec in punycode if it&#39;s an IDN.">encodeIDN</a>( <span class="keyword">const</span> QString & addrSpec ); <a name="l00238"></a>00238 <a name="l00245"></a>00245 KDE_EXPORT QString <a class="code" href="namespaceKPIM.html#838c1fb6709e5772887c1e0cebe9e73a" title="Normalizes all email addresses in the given list and decodes all IDNs.">normalizeAddressesAndDecodeIDNs</a>( <span class="keyword">const</span> QString & addresses ); <a name="l00246"></a>00246 <a name="l00250"></a>00250 KDE_EXPORT QString <a class="code" href="namespaceKPIM.html#424439bc3d3250ef48d9ac1cf0582ff2" title="Normalizes all email addresses in the given list and encodes all IDNs in punycode...">normalizeAddressesAndEncodeIDNs</a>( <span class="keyword">const</span> QString & str ); <a name="l00251"></a>00251 <a name="l00255"></a>00255 KDE_EXPORT QString <a class="code" href="namespaceKPIM.html#a65552fc3f9ec5420b19fad2c2d82f25" title="Add quote characters around the given string if it contains a character that makes...">quoteNameIfNecessary</a>( <span class="keyword">const</span> QString& str ); <a name="l00256"></a>00256 <a name="l00257"></a>00257 } <span class="comment">// namespace</span> <a name="l00258"></a>00258 <a name="l00259"></a>00259 <span class="preprocessor">#endif </span><span class="comment">/* EMAIL_H */</span> <a name="l00260"></a>00260 </pre></div></div> </div></div> </td> </tr> <tr> <td valign="top" id="leftmenu" width="25%"> <a name="navigation"></a> <div class="menu_box"><h2>libemailfunctions</h2> <div class="nav_list"> <ul><li><a href="index.html">Main Page</a></li><li><a href="namespaces.html">Namespace List</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="namespacemembers.html">Namespace Members</a></li><li><a href="functions.html">Class Members</a></li><li><a href="pages.html">Related Pages</a></li></ul> <!-- <h2>Class Picker</h2> <div style="text-align: center;"> <form name="guideform"> <select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value"> <option value="annotated.html">-- Choose --</option> <option value="classKPIM_1_1IdMapper.html">kpim::idmapper</option>, <option value="classKPIM_1_1NetworkStatus.html">kpim::networkstatus</option>, </select> </form> </div> --> </div></div> <div class="menu_box"><h2>API Dox</h2> <div class="nav_list"> <ul> <li><a href="../../akregator/html/index.html">akregator</a></li><li> <a href="../../akregator/src/html/index.html">src</a></li><li> <a href="../../akregator/src/librss/html/index.html">librss</a></li><li><a href="../../certmanager/html/index.html">certmanager</a></li><li> <a href="../../certmanager/lib/html/index.html">lib</a></li><li><a href="../../kaddressbook/html/index.html">kaddressbook</a></li><li><a href="../../kalarm/html/index.html">kalarm</a></li><li> <a href="../../kalarm/lib/html/index.html">lib</a></li><li><a href="../../kandy/html/index.html">kandy</a></li><li><a href="../../karm/html/index.html">karm</a></li><li><a href="../../kdgantt/html/index.html">kdgantt</a></li><li><a href="../../kgantt/html/index.html">kgantt</a></li><li><a href="../../kioslaves/html/index.html">kioslaves</a></li><li> <a href="../../kioslaves/imap4/html/index.html">imap4</a></li><li> <a href="../../kioslaves/mbox/html/index.html">mbox</a></li><li><a href="../../kitchensync/html/index.html">kitchensync</a></li><li><a href="../../kmail/html/index.html">kmail</a></li><li><a href="../../knotes/html/index.html">knotes</a></li><li><a href="../../konsolekalendar/html/index.html">konsolekalendar</a></li><li><a href="../../kontact/html/index.html">kontact</a></li><li><a href="../../korganizer/html/index.html">korganizer</a></li><li><a href="../../kpilot/html/index.html">kpilot</a></li><li> <a href="../../kpilot/kpilot/html/index.html">kpilot</a></li><li> <a href="../../kpilot/lib/html/index.html">lib</a></li><li><a href="../../libemailfunctions/html/index.html">libemailfunctions</a></li><li><a href="../../libkcal/html/index.html">libkcal</a></li><li><a href="../../libkdepim/html/index.html">libkdepim</a></li><li><a href="../../libkholidays/html/index.html">libkholidays</a></li><li><a href="../../libkmime/html/index.html">libkmime</a></li><li><a href="../../libkpgp/html/index.html">libkpgp</a></li><li><a href="../../libkpimidentities/html/index.html">libkpimidentities</a></li> </ul></div></div> </td> </tr> </table> <span class="doNotDisplay"> <a href="http://www.kde.org/" accesskey="8">KDE Home</a> | <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> | <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a> </span> <div style="height: 8px"></div> <div id="footer"> <div id="footer_left"> Maintained by <a href="mailto:groot@kde.org">Adriaan de Groot</a> and <a href="mailto:winter@kde.org">Allen Winter</a>. <br/> KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a> </div> <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div> </div> <!-- WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL BE BLOCKED INSTANTLY AND PERMANENTLY! <a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a> WARNING END --> </body> </html>