Add event listener with JSON output (WIP) Add notifier on movement events Refactor Parameter and ParameterList (still shit)
This commit is contained in:
		
							parent
							
								
									2c0a8ab616
								
							
						
					
					
						commit
						d8cdc2bb11
					
				
					 14 changed files with 338 additions and 186 deletions
				
			
		|  | @ -57,10 +57,10 @@ pub fn get_channels(connection: &mut Telnet, spacers: bool) -> Result<Vec<Channe | |||
|     } | ||||
| } | ||||
| 
 | ||||
| pub fn find_channel(connection: &mut Telnet, name: &str, strict: bool) -> Result<Option<Channel>, String> { | ||||
| pub fn find_channel(connection: &mut Telnet, key: &str, value: &str, strict: bool) -> Result<Option<Channel>, String> { | ||||
|     match commands::channellist(connection)? { | ||||
|         Response::DataList(parameter_lists) => { | ||||
|             match parameter::parameter_list_find(¶meter_lists, "channel_name", name, strict) { | ||||
|             match parameter::parameter_list_find(¶meter_lists, key, value, strict) { | ||||
|                 Some(params) => { | ||||
|                     Ok(Some(Channel::from(params))) | ||||
|                 } | ||||
|  | @ -88,10 +88,10 @@ pub fn get_clients(connection: &mut Telnet) -> Result<Vec<Client>, String> { | |||
|     } | ||||
| } | ||||
| 
 | ||||
| pub fn find_client(connection: &mut Telnet, name: &str, strict: bool) -> Result<Option<Client>, String> { | ||||
| pub fn find_client(connection: &mut Telnet, key: &str, value: &str, strict: bool) -> Result<Option<Client>, String> { | ||||
|     match commands::clientlist(connection)? { | ||||
|         Response::DataList(parameter_lists) => { | ||||
|             match parameter::parameter_list_find(¶meter_lists, "client_nickname", name, strict) { | ||||
|             match parameter::parameter_list_find(¶meter_lists, key, value, strict) { | ||||
|                 Some(params) => { | ||||
|                     Ok(Some(Client::from(params))) | ||||
|                 } | ||||
|  | @ -122,7 +122,7 @@ fn get_self_clid(connection: &mut Telnet) -> Result<String, String> { | |||
|         Response::Data(params) => { | ||||
|             match parameter::parameter_find(¶ms, "clid") { | ||||
|                 None => Err(String::from("Could not find clid in models from Teamspeak.")), | ||||
|                 Some(param) => Ok(param.value) | ||||
|                 Some(param) => Ok(param) | ||||
|             } | ||||
|         } | ||||
|         _ => Err(String::from("Received unexpected models from Teamspeak for whoami.")) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue