gestion minime d'erreurs
This commit is contained in:
		
							parent
							
								
									8c00640929
								
							
						
					
					
						commit
						8ddc1b4e87
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -77,7 +77,14 @@ int cb_currentsong_plugin(void *data, struct t_gui_buffer *buffer, int argc, cha
 | 
			
		|||
 | 
			
		||||
	wait(&status);
 | 
			
		||||
	if(WEXITSTATUS(status) != 0)
 | 
			
		||||
		sprintf(song,"didn't worked !!!");
 | 
			
		||||
	{
 | 
			
		||||
		for(i = 0 ; i < TAILLE_BUFFER_CURRENT_SONG ; i++)
 | 
			
		||||
			song[i] = '\0';
 | 
			
		||||
		sprintf(song,"/currentsong didn't work !!! You should probably use the 'host <ip|url>' or 'port num' option");
 | 
			
		||||
		sprintf(affichage,"pluginerr\t%s",song);
 | 
			
		||||
		weechat_printf(buffer,affichage);
 | 
			
		||||
		return WEECHAT_RC_ERROR;
 | 
			
		||||
	}
 | 
			
		||||
	sprintf(affichage,"/me ♪ %s", song);
 | 
			
		||||
	
 | 
			
		||||
	//sprintf(affichage,"/me ♪ %s%s", weechat_color ("_red"), song); // Ne s'affiche pas correctement chez les autres
 | 
			
		||||
| 
						 | 
				
			
			@ -101,7 +108,7 @@ int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]
 | 
			
		|||
    weechat_hook_command ("currentsong",
 | 
			
		||||
                          "Affiche le morceau que vous écoutez",
 | 
			
		||||
						  "[host ip]",
 | 
			
		||||
						  "si mpd n'est pas en local : host <ip>",
 | 
			
		||||
						  "si mpd n'est pas en local : host <ip|url>",
 | 
			
		||||
						  "host ",
 | 
			
		||||
                          &cb_currentsong_plugin, NULL);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue