mail.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * helper routines
  4. *
  5. * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
  6. *
  7. * Licensed under GPLv2, see file LICENSE in this source tree.
  8. */
  9. struct globals {
  10. pid_t helper_pid;
  11. unsigned timeout;
  12. unsigned verbose;
  13. unsigned opts;
  14. char *user;
  15. char *pass;
  16. FILE *fp0; // initial stdin
  17. char *opt_charset;
  18. char *content_type;
  19. };
  20. #define G (*ptr_to_globals)
  21. #define timeout (G.timeout )
  22. #define verbose (G.verbose )
  23. #define opts (G.opts )
  24. //#define user (G.user )
  25. //#define pass (G.pass )
  26. //#define fp0 (G.fp0 )
  27. //#define opt_charset (G.opt_charset)
  28. //#define content_type (G.content_type)
  29. #define INIT_G() do { \
  30. SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
  31. G.opt_charset = (char *)CONFIG_FEATURE_MIME_CHARSET; \
  32. G.content_type = (char *)"text/plain"; \
  33. } while (0)
  34. //char FAST_FUNC *parse_url(char *url, char **user, char **pass);
  35. void launch_helper(const char **argv) FAST_FUNC;
  36. void get_cred_or_die(int fd) FAST_FUNC;
  37. char *send_mail_command(const char *fmt, const char *param) FAST_FUNC;
  38. void encode_base64(char *fname, const char *text, const char *eol) FAST_FUNC;