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.

50 lines
1.0 KiB

1 year ago
8 years ago
8 years ago
1 year ago
1 year ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. /**
  2. * @file mime.c
  3. * @brief functionality as produced/consumed by the engine. This is the interface to the engine's
  4. * use of the underlying MIME parser
  5. * @license GNU General Public License 3.0 - see LICENSE.txt
  6. */
  7. #define _EXPORT_PEP_ENGINE_DLL
  8. #include "mime.h"
  9. #include "pEp_internal.h"
  10. #include <string.h>
  11. #include <stdlib.h>
  12. #include <assert.h>
  13. #include <errno.h>
  14. /**
  15. * @internal
  16. *
  17. * <!-- is_whitespace() -->
  18. *
  19. * @brief checks if a character is a whitepsace character
  20. *
  21. * @param[in] c char
  22. *
  23. * @return bool true if whitespace, false otherwise
  24. */
  25. static bool is_whitespace(char c)
  26. {
  27. switch (c) {
  28. case ' ':
  29. case '\t':
  30. case '\r':
  31. case '\n':
  32. return true;
  33. default:
  34. return false;
  35. }
  36. }
  37. DYNAMIC_API bool is_PGP_message_text(const char *text)
  38. {
  39. if (EMPTYSTR(text))
  40. return false;
  41. for (; *text && is_whitespace(*text); text++);
  42. return strncmp(text, "-----BEGIN PGP MESSAGE-----", 27) == 0;
  43. }