TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ldifconverter.h 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. This file is part of libtdeabc.
  3. Copyright (c) 2003 Helge Deller <deller@kde.org>
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License version 2 only as published by the Free Software Foundation.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this library; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. Boston, MA 02110-1301, USA.
  15. */
  16. #ifndef KABC_LDIFCONVERTER_H
  17. #define KABC_LDIFCONVERTER_H
  18. #include <tqstring.h>
  19. #include <tqdatetime.h>
  20. #include "addressee.h"
  21. #include "addresseelist.h"
  22. namespace TDEABC {
  23. /**
  24. * A set of functions to convert a string with LDIF information to addressees
  25. * and vice versa. It is useful for addressbook import- and exportfilters
  26. * and might be used to read and write Mozilla and Netscape addresssbooks.
  27. */
  28. namespace LDIFConverter {
  29. /**
  30. * Converts a LDIF string to a list of addressees.
  31. *
  32. * @param str The vcard string.
  33. * @param addrList The addresseelist.
  34. * @param dt The date & time value of the last modification (e.g. file modification time).
  35. * @since 3.2
  36. */
  37. KABC_EXPORT bool LDIFToAddressee( const TQString &str, AddresseeList &addrList, TQDateTime dt = TQDateTime::currentDateTime() );
  38. /**
  39. * Converts a list of addressees to a LDIF string.
  40. *
  41. * @param addrList The addresseelist.
  42. * @param str The LDIF string.
  43. * @since 3.2
  44. */
  45. KABC_EXPORT bool addresseeToLDIF( const AddresseeList &addrList, TQString &str );
  46. /**
  47. * Converts an addressee to a LDIF string.
  48. *
  49. * @param addr The addressee.
  50. * @param str The LDIF string.
  51. * @since 3.2
  52. */
  53. KABC_EXPORT bool addresseeToLDIF( const Addressee &addr, TQString &str );
  54. /**
  55. * @deprecated
  56. * Obsoleted - please use LDIF::assembleLine()
  57. * Returns a LDIF compatible string representing a given field/value pair.
  58. * If necessary, the value parameter will be base64encoded and split into multiple.
  59. * This function will return an empty string if the given value is empty.
  60. *
  61. * @param field The LDAP field name or a complete LDIF field string (e.g. "cn" or "cn = %1\n").
  62. * @param value The value for this field.
  63. * @param allowEncode Set to false if you wish no encoding of the value.
  64. * @since 3.2
  65. */
  66. KABC_EXPORT TQString makeLDIFfieldString( TQString field, TQString value, bool allowEncode = true ) KDE_DEPRECATED;
  67. /* internal functions - do not use !! */
  68. /** No need for this function anymore - use LDIF::splitLine() + evaluatePair() */
  69. KABC_EXPORT bool parseSingleLine( Addressee &a,
  70. Address &homeAddr, Address &workAddr, TQString &line );
  71. /** No need for this function anymore - use LDIF::splitLine() */
  72. KABC_EXPORT bool splitLine( TQString &line, TQString &fieldname, TQString &value);
  73. KABC_EXPORT bool evaluatePair( Addressee &a, Address &homeAddr, Address &workAddr,
  74. TQString &fieldname, TQString &value );
  75. }
  76. }
  77. #endif