pidgin: 3c0fae00: Grab only the "short" hostname on system...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sun Feb 15 17:00:41 EST 2009


-----------------------------------------------------------------
Revision: 3c0fae0099a5ab71fe5e97a09a7d16b24eb66ad4
Ancestor: f450cc27747b13860314b51bf1aaa7a923f42b8f
Author: mcepl at redhat.com
Date: 2009-02-15T20:22:30
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3c0fae0099a5ab71fe5e97a09a7d16b24eb66ad4

Modified files:
        ChangeLog libpurple/protocols/jabber/jabber.c

ChangeLog: 

Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
which put the FQDN in the hostname.  Fixes #8419.

-------------- next part --------------
============================================================
--- ChangeLog	0b07eb862f014020305d395e0012257fdb4dd4ad
+++ ChangeLog	9b192027d05c25a758145d011152a61343cda6f8
@@ -7,6 +7,9 @@ version 2.5.5 (??/??/????):
 	  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
============================================================
--- libpurple/protocols/jabber/jabber.c	687026e2691399edddca701e1ed503668fc1feaf
+++ libpurple/protocols/jabber/jabber.c	ba28e4ae155263bc56f22f3327529df9f71ebff1
@@ -148,7 +148,8 @@ static char *jabber_prep_resource(char *
 }
 
 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 @@ static char *jabber_prep_resource(char *
 	}
 	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);
 }
 


More information about the Commits mailing list