summaryrefslogtreecommitdiff
path: root/examples/basic.c
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2020-11-17 15:07:05 +0300
committerdefanor <defanor@uberspace.net>2020-11-17 15:18:22 +0300
commit48542332c351d21706e61abbd9cb50ce02afac2d (patch)
tree836aa3365f3de12a14bdd7b5ab4188f09eec8815 /examples/basic.c
parent0748958c63052a6c4e0fb20a172ae793fdf8fa6c (diff)
Add initial JID parsing
Diffstat (limited to 'examples/basic.c')
-rw-r--r--examples/basic.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/examples/basic.c b/examples/basic.c
index 88a1ca4..09a98c4 100644
--- a/examples/basic.c
+++ b/examples/basic.c
@@ -37,16 +37,8 @@ int my_sasl_property_cb (rexmpp_t *s, Gsasl_property prop) {
return GSASL_OK;
}
if (prop == GSASL_AUTHID) {
- char *domainpart = strchr(s->initial_jid, '@');
- if (domainpart != NULL) {
- int localpart_len = domainpart - s->initial_jid;
- char *localpart = malloc(localpart_len + 1);
- localpart[localpart_len] = 0;
- strncpy(localpart, s->initial_jid, localpart_len);
- gsasl_property_set (s->sasl_session, GSASL_AUTHID, localpart);
- free(localpart);
- return GSASL_OK;
- }
+ gsasl_property_set (s->sasl_session, GSASL_AUTHID, s->initial_jid.local);
+ return GSASL_OK;
}
printf("unhandled gsasl property: %d\n", prop);
return GSASL_NO_CALLBACK;