#include #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 *get_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 *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); }