X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcontrol%2Ftelnet.c;h=ce0f45c250115e2b6e4732a3af0fbd19e9f98d80;hb=80ba0c2698c7e30d1e6020045958ed7f88243e54;hp=93f31f1bd6940b8b4842d101704fbc899fa33547;hpb=2cb472dba008f7d877ffe6bae9c5575253365282;p=vlc diff --git a/modules/control/telnet.c b/modules/control/telnet.c index 93f31f1bd6..ce0f45c250 100644 --- a/modules/control/telnet.c +++ b/modules/control/telnet.c @@ -1,7 +1,7 @@ /***************************************************************************** * telnet.c: VLM interface plugin ***************************************************************************** - * Copyright (C) 2000-2005 the VideoLAN team + * Copyright (C) 2000-2006 the VideoLAN team * $Id$ * * Authors: Simon Latapie @@ -45,15 +45,8 @@ # include #endif -#if defined( UNDER_CE ) -# include -#elif defined( WIN32 ) -# include -#else -# include -#endif - #include "network.h" +#include "vlc_url.h" #include "vlc_vlm.h" @@ -76,19 +69,24 @@ static int Open ( vlc_object_t * ); static void Close( vlc_object_t * ); -#define TELNETHOST_TEXT N_( "Telnet Interface host" ) -#define TELNETHOST_LONGTEXT N_( "Default to listen on all network interfaces" ) -#define TELNETPORT_TEXT N_( "Telnet Interface port" ) -#define TELNETPORT_LONGTEXT N_( "Default to 4212" ) +#define TELNETHOST_TEXT N_( "Host" ) +#define TELNETHOST_LONGTEXT N_( "This is the host on which the " \ + "interface will listen. It defaults to all network interfaces (0.0.0.0)." \ + " If you want this interface to be available only on the local " \ + "machine, enter \"127.0.0.1\"." ) +#define TELNETPORT_TEXT N_( "Port" ) +#define TELNETPORT_LONGTEXT N_( "This is the TCP port on which this " \ + "interface will listen. It defaults to 4212." ) #define TELNETPORT_DEFAULT 4212 -#define TELNETPWD_TEXT N_( "Telnet Interface password" ) -#define TELNETPWD_LONGTEXT N_( "Default to admin" ) +#define TELNETPWD_TEXT N_( "Password" ) +#define TELNETPWD_LONGTEXT N_( "A single administration password is used " \ + "to protect this interface. The default value is \"admin\"." ) #define TELNETPWD_DEFAULT "admin" vlc_module_begin(); set_shortname( "Telnet" ); set_category( CAT_INTERFACE ); - set_subcategory( SUBCAT_INTERFACE_GENERAL ); + set_subcategory( SUBCAT_INTERFACE_CONTROL ); add_string( "telnet-host", "", NULL, TELNETHOST_TEXT, TELNETHOST_LONGTEXT, VLC_TRUE ); add_integer( "telnet-port", TELNETPORT_DEFAULT, NULL, TELNETPORT_TEXT, @@ -139,7 +137,7 @@ struct intf_sys_t * option is missing from --telnet-host. */ static int getPort(intf_thread_t *p_intf, vlc_url_t url, int i_port) - { +{ // Print error if two different ports have been specified if (url.i_port != 0 && i_port != TELNETPORT_DEFAULT && @@ -156,7 +154,6 @@ static int getPort(intf_thread_t *p_intf, vlc_url_t url, int i_port) { return url.i_port; } - // return default return i_port; } @@ -177,7 +174,7 @@ static int Open( vlc_object_t *p_this ) return VLC_EGENERIC; } - msg_Info( p_intf, "Using the VLM interface plugin..." ); + msg_Info( p_intf, "using the VLM interface plugin..." ); i_telnetport = config_GetInt( p_intf, "telnet-port" ); psz_address = config_GetPsz( p_intf, "telnet-host" ); @@ -193,18 +190,22 @@ static int Open( vlc_object_t *p_this ) == NULL ) { msg_Err( p_intf, "cannot listen for telnet" ); + vlc_UrlClean(&url); + free( psz_address ); free( p_intf->p_sys ); return VLC_EGENERIC; } msg_Info( p_intf, - "Telnet interface started on interface %s %d", - url.psz_host, url.i_port ); + "telnet interface started on interface %s %d", + url.psz_host, url.i_port ); p_intf->p_sys->i_clients = 0; p_intf->p_sys->clients = NULL; p_intf->p_sys->mediatheque = mediatheque; p_intf->pf_run = Run; + vlc_UrlClean(&url); + free( psz_address ); return VLC_SUCCESS; } @@ -270,7 +271,7 @@ static void Run( intf_thread_t *p_intf ) cl->fd = fd; cl->buffer_write = NULL; cl->p_buffer_write = cl->buffer_write; - Write_message( cl, NULL, "Password:\xff\xfb\x01", WRITE_MODE_PWD ); + Write_message( cl, NULL, "Password: \xff\xfb\x01", WRITE_MODE_PWD ); TAB_APPEND( p_sys->i_clients, p_sys->clients, cl ); } @@ -413,7 +414,8 @@ static void Run( intf_thread_t *p_intf ) else { /* wrong password */ - Write_message( cl, NULL, "\r\nWrong password. ", + Write_message( cl, NULL, + "\r\nWrong password.\r\nPassword: ", WRITE_MODE_PWD ); } } @@ -495,11 +497,12 @@ static char *MessageToString( vlm_message_t *message, int i_level ) else if( !i_level && !message->i_child && !message->psz_value ) { /* A command is successful. Don't write anything */ - return strdup( STRING_CR STRING_TAIL ); + return strdup( /*STRING_CR*/ STRING_TAIL ); } i_message += strlen( message->psz_name ) + i_level * sizeof( " " ) + 1; - psz_message = malloc( i_message ); *psz_message = 0; + psz_message = malloc( i_message ); + *psz_message = 0; for( i = 0; i < i_level; i++ ) strcat( psz_message, " " ); strcat( psz_message, message->psz_name );