diff options
Diffstat (limited to 'xmpp.c')
-rw-r--r-- | xmpp.c | 54 |
1 files changed, 0 insertions, 54 deletions
@@ -1,54 +0,0 @@ - - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> - - -/* - * 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; i<strlen(jid); i++) { - if (jid[i] == '/') { - stop = i; - break; - } - } - - for(int i=0; i<strlen(jid); i++) { - if (jid[i] == '@') { - start = i + 1; - break; - } - } - - char* retval = (char *)malloc((stop-start+1) * sizeof(char)); - memcpy(retval, jid+start, (stop-start)*sizeof(char)); - retval[stop] = '\0'; - - return retval; -} - -void net_init(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); -} - -void net_quit(void) -{ - printf("net_quit()\n"); -} |