sync.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * mbsync - mailbox synchronizer
  3. * Copyright (C) 2000-2002 Michael R. Elkins <me@mutt.org>
  4. * Copyright (C) 2002-2006,2010-2012 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, see <http://www.gnu.org/licenses/>.
  18. *
  19. * As a special exception, mbsync may be linked with the OpenSSL library,
  20. * despite that library's more restrictive license.
  21. */
  22. #ifndef SYNC_H
  23. #define SYNC_H
  24. #include "driver.h"
  25. #define M 0 /* master */
  26. #define S 1 /* slave */
  27. #define OP_NEW (1<<0)
  28. #define OP_RENEW (1<<1)
  29. #define OP_DELETE (1<<2)
  30. #define OP_FLAGS (1<<3)
  31. #define OP_MASK_TYPE (OP_NEW|OP_RENEW|OP_DELETE|OP_FLAGS) /* asserted in the target ops */
  32. #define OP_EXPUNGE (1<<4)
  33. #define OP_CREATE (1<<5)
  34. #define OP_REMOVE (1<<6)
  35. #define XOP_PUSH (1<<8)
  36. #define XOP_PULL (1<<9)
  37. #define XOP_MASK_DIR (XOP_PUSH|XOP_PULL)
  38. #define XOP_HAVE_TYPE (1<<10)
  39. #define XOP_HAVE_EXPUNGE (1<<11)
  40. #define XOP_HAVE_CREATE (1<<12)
  41. #define XOP_HAVE_REMOVE (1<<13)
  42. typedef struct channel_conf {
  43. struct channel_conf *next;
  44. const char *name;
  45. store_conf_t *stores[2];
  46. const char *boxes[2];
  47. char *sync_state;
  48. string_list_t *patterns;
  49. int ops[2];
  50. uint max_messages; /* for slave only */
  51. signed char expire_unread;
  52. char use_internal_date;
  53. } channel_conf_t;
  54. typedef struct group_conf {
  55. struct group_conf *next;
  56. const char *name;
  57. string_list_t *channels;
  58. } group_conf_t;
  59. extern channel_conf_t global_conf;
  60. extern channel_conf_t *channels;
  61. extern group_conf_t *groups;
  62. extern const char *str_ms[2], *str_hl[2];
  63. #define SYNC_OK 0 /* assumed to be 0 */
  64. #define SYNC_FAIL 1
  65. #define SYNC_BAD(ms) (4<<(ms))
  66. #define SYNC_NOGOOD 16 /* internal */
  67. #define SYNC_CANCELED 32 /* internal */
  68. #define BOX_POSSIBLE -1
  69. #define BOX_ABSENT 0
  70. #define BOX_PRESENT 1
  71. /* All passed pointers must stay alive until cb is called. */
  72. void sync_boxes( store_t *ctx[], const char *names[], int present[], channel_conf_t *chan,
  73. void (*cb)( int sts, void *aux ), void *aux );
  74. #endif