[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: implement wire subject parser
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: implement wire subject parser |
Date: |
Wed, 12 Apr 2023 15:58:58 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 3e8115c5 implement wire subject parser
3e8115c5 is described below
commit 3e8115c5e4a2c9a7f37202c63f107230d8087c42
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Apr 12 15:58:55 2023 +0200
implement wire subject parser
---
src/backend/taler-merchant-wirewatch.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/backend/taler-merchant-wirewatch.c
b/src/backend/taler-merchant-wirewatch.c
index 77cec3d3..2c62b446 100644
--- a/src/backend/taler-merchant-wirewatch.c
+++ b/src/backend/taler-merchant-wirewatch.c
@@ -178,7 +178,8 @@ shutdown_task (void *cls)
/**
* Parse @a subject from wire transfer into @a wtid and @a exchange_url.
*
- * @param subject wire transfer subject to parse
+ * @param subject wire transfer subject to parse;
+ * format is "$WTID $URL"
* @param[out] wtid wire transfer ID to extract
* @param[out] exchange_url set to exchange URL
* @return #GNUNET_OK on success
@@ -188,8 +189,29 @@ parse_subject (const char *subject,
struct TALER_WireTransferIdentifierRawP *wtid,
char **exchange_url)
{
- *exchange_url = NULL;
- return GNUNET_SYSERR;
+ const char *space;
+
+ space = strchr (subject, ' ');
+ if (NULL == space)
+ return GNUNET_NO;
+ if (GNUNET_OK !=
+ GNUNET_STRINGS_string_to_data (subject,
+ space - subject,
+ wtid,
+ sizeof (*wtid)))
+ return GNUNET_NO;
+ space++;
+ if (! TALER_url_valid_charset (space))
+ return GNUNET_NO;
+ if ( (0 != strncasecmp ("http://",
+ space,
+ strlen ("http://"))) &&
+ (0 != strncasecmp ("https://",
+ space,
+ strlen ("https://"))) )
+ return GNUNET_NO;
+ *exchange_url = GNUNET_strdup (space);
+ return GNUNET_OK;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: implement wire subject parser,
gnunet <=