isync.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * isync - mbsync wrapper: IMAP4 to maildir mailbox synchronizer
  3. * Copyright (C) 2000-2002 Michael R. Elkins <me@mutt.org>
  4. * Copyright (C) 2002-2004 Oswald Buddenhagen <ossi@users.sf.net>
  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 Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  19. */
  20. #define _GNU_SOURCE
  21. #include <config.h>
  22. #include <sys/types.h>
  23. #include <stdarg.h>
  24. #define as(ar) (sizeof(ar)/sizeof(ar[0]))
  25. #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
  26. # define ATTR_UNUSED __attribute__((unused))
  27. # define ATTR_NORETURN __attribute__((noreturn))
  28. # define ATTR_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
  29. #else
  30. # define ATTR_UNUSED
  31. # define ATTR_NORETURN
  32. # define ATTR_PRINTFLIKE(fmt,var)
  33. #endif
  34. typedef struct config {
  35. struct config *next;
  36. const char *server_name;
  37. int servers;
  38. char *host;
  39. int port;
  40. char *user;
  41. char *pass;
  42. char *tunnel;
  43. unsigned int require_cram:1;
  44. unsigned int require_ssl:1;
  45. unsigned int use_imaps:1;
  46. unsigned int use_sslv2:1;
  47. unsigned int use_sslv3:1;
  48. unsigned int use_tlsv1:1;
  49. char *cert_file;
  50. const char *store_name;
  51. int stores;
  52. char *copy_deleted_to;
  53. unsigned int use_namespace:1;
  54. const char *channel_name;
  55. int channels;
  56. const char *alias;
  57. const char *box;
  58. const char *path; /* path relative to .maildir, or absolute path */
  59. int max_size;
  60. unsigned int max_messages;
  61. unsigned int expunge:1;
  62. unsigned int delete:1;
  63. } config_t;
  64. extern int Quiet, Verbose, Debug;
  65. extern const char *Home;
  66. extern int HomeLen;
  67. extern config_t global, *boxes;
  68. extern const char *maildir, *xmaildir, *folder, *inbox;
  69. extern int o2o, altmap, delete, expunge;
  70. /* config.c */
  71. void load_config( const char *, config_t *** );
  72. void write_config( int );
  73. char *expand_strdup( const char * );
  74. config_t *find_box( const char * );
  75. /* convert.c */
  76. void convert( config_t * );
  77. /* util.c */
  78. char *next_arg( char ** );
  79. void *nfmalloc( size_t sz );
  80. void *nfrealloc( void *mem, size_t sz );
  81. char *nfstrdup( const char *str );
  82. int nfvasprintf( char **str, const char *fmt, va_list va );
  83. int nfasprintf( char **str, const char *fmt, ... );
  84. int nfsnprintf( char *buf, int blen, const char *fmt, ... );
  85. void ATTR_NORETURN oob( void );