diff options
-rw-r--r-- | xmpp.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -5,13 +5,15 @@ #include <string.h> #include <sys/types.h> #include <sys/socket.h> +#include <netdb.h> /* - * Get the domainpart of the Jabber ID (JID). + * Get the domainpart of the Jabber ID (JID) + * * See https://datatracker.ietf.org/doc/html/rfc7622#section-3.2 for details. */ -char *domainpart(char *jid) +char *get_domainpart(char *jid) { int start = 0; // inclusive int stop = strlen(jid); // exclusive @@ -78,10 +80,11 @@ void xmpp_connect(void) { printf("net_init()\n"); - char* user_str = getenv("LIMOX_USER"); - char* pwd_str = getenv("LIMOX_PWD"); - char *domain = domainpart(user_str); - printf("Trying to connect as '%s' with '%s'.\n", user_str, pwd_str); + char *jid = getenv("LIMOX_USER"); + char *pwd = getenv("LIMOX_PWD"); + printf("Trying to connect as '%s' with '%s'.\n", jid, pwd); + + char *domain = get_domainpart(jid); printf("Domainpart is '%s'.\n", domain); get_addrinfo(domain); |