--- a/xeme/tests/testaddress.c Thu Dec 07 21:35:02 2023 -0600
+++ b/xeme/tests/testaddress.c Thu Dec 07 21:44:47 2023 -0600
@@ -52,7 +52,7 @@
for(int i = 0; data[i] != NULL; i++) {
- g_assert_true(xeme_address_parse(data[i], NULL, NULL, NULL));
+ g_assert_true(xeme_address_parse(data[i], NULL, NULL, NULL, NULL)); @@ -76,7 +76,7 @@
for(int i = 0; data[i] != NULL; i++) {
- g_assert_false(xeme_address_parse(data[i], NULL, NULL, NULL));
+ g_assert_false(xeme_address_parse(data[i], NULL, NULL, NULL, NULL)); --- a/xeme/xemeaddress.c Thu Dec 07 21:35:02 2023 -0600
+++ b/xeme/xemeaddress.c Thu Dec 07 21:44:47 2023 -0600
@@ -20,16 +20,18 @@
#define XEME_ADDRESS_REGEX \
- "^(?:(?P<local>[^\\\"&'/:<>@]+)@)?" \
- "(?P<domain>(?:[^@/[\\\\_$]+|(\\[[0-9a-fA-F:]+\\])))" \
+ "(?:(?P<local>[^\\\"&'/:<>@]+)@)?" \ + "(?P<domain>(?:[^@/[\\\\_$]+|(\\[[0-9a-fA-F:]+\\])))" \ "(?:/(?P<resource>.+))?$"
/******************************************************************************
*****************************************************************************/
-xeme_address_parse(const char *address, char **local, char **domain,
+xeme_address_parse(const char *address, char **bare_jid, char **local, + char **domain, char **resource) static GRegex *regexp = NULL;
@@ -58,6 +60,15 @@
+ tmp = g_match_info_fetch_named(info, "bare_jid"); + if(xeme_str_is_empty(tmp)) { + g_clear_pointer(&tmp, g_free); tmp = g_match_info_fetch_named(info, "local");
if(xeme_str_is_empty(tmp)) {
--- a/xeme/xemeaddress.h Thu Dec 07 21:35:02 2023 -0600
+++ b/xeme/xemeaddress.h Thu Dec 07 21:44:47 2023 -0600
@@ -28,6 +28,8 @@
* @address: The address to parse.
+ * @bare_jid: (nullable): An optional return address for the bare jid, that is + * the `local@domain` part of the jid including the `@`. * @local: (nullable): An optional return address for the localpart.
* @domain: (nullable): An optional return address for the domainpart.
* @resource: (nullable): An optional return address for the resourcepart.
@@ -41,7 +43,7 @@
-gboolean xeme_address_parse(const char *address, char **local, char **domain, char **resource);
+gboolean xeme_address_parse(const char *address, char **bare_jid, char **local, char **domain, char **resource);