# HG changeset patch # User mcepl@redhat.com # Date 1234729350 0 # Node ID 43055addf13500b3514322ffc96a0253f334045a # Parent a3e3c6331e06eab641e01d5a88edd8a7909b30cd Grab only the "short" hostname on systems (like Fedora/RedHat, but others too) which put the FQDN in the hostname. Fixes #8419. committer: John Bailey diff -r a3e3c6331e06 -r 43055addf135 ChangeLog --- a/ChangeLog Sun Feb 15 19:01:58 2009 +0000 +++ b/ChangeLog Sun Feb 15 20:22:30 2009 +0000 @@ -7,6 +7,9 @@ enable, check the "Use SSL" option from the Advanced tab when editing your AIM or ICQ account. (Paul Aurich) * Fix a memory leak in SILC. (Luke Petre) + * XMPP resources using __HOSTNAME__ substitution will now grab only the + short hostname instead of the FQDN on systems which put the FQDN in + the hostname (Matěj Cepl) ICQ: * Fix retrieval of status messages from users of ICQ 6.x, Miranda, and diff -r a3e3c6331e06 -r 43055addf135 libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Sun Feb 15 19:01:58 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sun Feb 15 20:22:30 2009 +0000 @@ -148,7 +148,8 @@ } static char *jabber_prep_resource(char *input) { - char hostname[256]; /* current hostname */ + char hostname[256], /* current hostname */ + *dot = NULL; /* Empty resource == don't send any */ if (input == NULL || *input == '\0') @@ -170,6 +171,12 @@ } hostname[sizeof(hostname) - 1] = '\0'; + /* We want only the short hostname, not the FQDN - this will prevent the + * resource string from being unreasonably long on systems which stuff the + * whole FQDN in the hostname */ + if((dot = strchr(hostname, '.'))) + dot = '\0'; + return purple_strreplace(input, "__HOSTNAME__", hostname); }