[RFC] Add getHostname convenience function to kdelibs? (was: Re: [PATCH] Make the default sending domain configurable)
Malte Starostik
malte at kde.org
Sat Apr 20 19:53:34 BST 2002
Am Saturday 20 April 2002 14:35 schrieb Thiago Macieira:
> Ingo Klöcker wrote
>
> >QCString <classname>::getHostname( bool fallback_to_localhost )
> >{
> > char str[256];
> > if ( !gethostname( str, 255 ) )
> > // str is not guaranteed to be NUL-terminated if it has full length
> > str[255] = 0;
> > else
> > str[0] = 0;
> >
> > if( !*str && fallback_to_localhost )
> > return QCString( "localhost" );
> > else
> > return QCString( str );
> >}
>
> For lack of better place, I'll add that as a static function to
> KExtendedSocket, without the bool argument.
What about instead of a bool argument something like this:
enum HostNameType { FQDN = 0, Short = 1, FallbackToLocalhost = 2 }; and have a
default of FQDN? Ehm, and maybe a better naming for Fallback... :)
--
Malte Starostik
PGP: 1024D/D2F3C787 [C138 2121 FAF3 410A 1C2A 27CD 5431 7745 D2F3 C787]
More information about the kde-core-devel
mailing list