/*
* LimoX - The Linux on mobile XMPP chat client
* Copyright (C) 2022 xengineering
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#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);
}