#include #include #include #include #include /* * 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) { int start = 0; // inclusive int stop = strlen(jid); // exclusive for(int i=0; iai_next) { if (p->ai_family == AF_INET) { printf("an IPv4!\n"); // TODO } else if (p->ai_family == AF_INET6) { printf("an IPv6!\n"); // TODO } else { printf("Unknown addrinfo address type.\n"); } } return NULL; } /* * Initialize the network connection to the XMPP server * * TODO: Error handling is missing. */ 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); printf("Domainpart is '%s'.\n", domain); get_addrinfo(domain); }