mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	pactl: Implement list message-handlers
For better readability, "pactl list message-handlers" is introduced which prints a formatted output of "pactl send-message /core list-handlers". The patch also adds the functions pa_message_params_read_raw() and pa_message_params_read_string() for easy parsing of the message response string. Because the functions need to modify the parameter string, the message handler and the pa_context_string_callback function now receive a char* instead of a const char* as parameter argument. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/51>
This commit is contained in:
		
							parent
							
								
									5c0ab52145
								
							
						
					
					
						commit
						4a28b164d1
					
				
					 15 changed files with 253 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -90,6 +90,8 @@ void pa_message_handler_unregister(pa_core *c, const char *object_path) {
 | 
			
		|||
/* Send a message to an object identified by object_path */
 | 
			
		||||
int pa_message_handler_send_message(pa_core *c, const char *object_path, const char *message, const char *message_parameters, char **response) {
 | 
			
		||||
    struct pa_message_handler *handler;
 | 
			
		||||
    int ret;
 | 
			
		||||
    char *parameter_copy;
 | 
			
		||||
 | 
			
		||||
    pa_assert(c);
 | 
			
		||||
    pa_assert(object_path);
 | 
			
		||||
| 
						 | 
				
			
			@ -101,9 +103,14 @@ int pa_message_handler_send_message(pa_core *c, const char *object_path, const c
 | 
			
		|||
    if (!(handler = pa_hashmap_get(c->message_handlers, object_path)))
 | 
			
		||||
        return -PA_ERR_NOENTITY;
 | 
			
		||||
 | 
			
		||||
    parameter_copy = pa_xstrdup(message_parameters);
 | 
			
		||||
 | 
			
		||||
    /* The handler is expected to return an error code and may also
 | 
			
		||||
       return an error string in response */
 | 
			
		||||
    return handler->callback(handler->object_path, message, message_parameters, response, handler->userdata);
 | 
			
		||||
    ret = handler->callback(handler->object_path, message, parameter_copy, response, handler->userdata);
 | 
			
		||||
 | 
			
		||||
    pa_xfree(parameter_copy);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Set handler description */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue