Update dependencies and remove futures-await example.
This commit is contained in:
		
							parent
							
								
									a01702093e
								
							
						
					
					
						commit
						dc6f35b143
					
				
							
								
								
									
										25
									
								
								Cargo.toml
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								Cargo.toml
									
									
									
									
									
								
							| @ -11,28 +11,27 @@ repository = "https://github.com/ruma/ruma-client" | ||||
| version = "0.1.0" | ||||
| 
 | ||||
| [dependencies] | ||||
| futures = "0.1.14" | ||||
| http = "0.1" | ||||
| hyper = "0.12" | ||||
| ruma-api = "0.4.0" | ||||
| ruma-client-api = "0.1.0" | ||||
| futures = "0.1.25" | ||||
| http = "0.1.14" | ||||
| hyper = "0.12.16" | ||||
| ruma-api = "0.6.0" | ||||
| ruma-client-api = "0.2.0" | ||||
| ruma-identifiers = "0.11.0" | ||||
| serde_json = "1.0.2" | ||||
| serde_urlencoded = "0.5.1" | ||||
| url = "1.5.1" | ||||
| serde_json = "1.0.33" | ||||
| serde_urlencoded = "0.5.4" | ||||
| url = "1.7.2" | ||||
| 
 | ||||
| [dependencies.hyper-tls] | ||||
| optional = true | ||||
| version = "0.3.0" | ||||
| version = "0.3.1" | ||||
| 
 | ||||
| [dependencies.native-tls] | ||||
| optional = true | ||||
| version = "0.2.1" | ||||
| version = "0.2.2" | ||||
| 
 | ||||
| [dev-dependencies] | ||||
| futures-await = { git = 'https://github.com/alexcrichton/futures-await' } | ||||
| ruma-events = "0.10" | ||||
| tokio-core = "0.1" | ||||
| ruma-events = "0.11.0" | ||||
| tokio-core = "0.1.17" | ||||
| 
 | ||||
| [features] | ||||
| default = ["tls"] | ||||
|  | ||||
| @ -1,80 +0,0 @@ | ||||
| #![feature(generators)] | ||||
| #![feature(proc_macro_non_items)] | ||||
| #![feature(try_from)] | ||||
| 
 | ||||
| extern crate futures_await as futures; | ||||
| extern crate ruma_client; | ||||
| extern crate ruma_events; | ||||
| extern crate ruma_identifiers; | ||||
| extern crate tokio_core; | ||||
| extern crate url; | ||||
| 
 | ||||
| use std::convert::TryFrom; | ||||
| use std::env; | ||||
| use std::process::exit; | ||||
| 
 | ||||
| use futures::prelude::{*, await}; | ||||
| use ruma_client::Client; | ||||
| use ruma_client::api::r0; | ||||
| use ruma_events::EventType; | ||||
| use ruma_events::room::message::{MessageEventContent, MessageType, TextMessageEventContent}; | ||||
| use ruma_identifiers::RoomAliasId; | ||||
| use tokio_core::reactor::Core; | ||||
| use url::Url; | ||||
| 
 | ||||
| fn hello_world( | ||||
|     homeserver_url: Url, | ||||
|     room: String, | ||||
| ) -> impl Future<Item = (), Error = ruma_client::Error> { | ||||
|     let client = Client::https(homeserver_url, None).unwrap(); | ||||
| 
 | ||||
|     async_block! { | ||||
|         await!(client.register_guest())?; | ||||
| 
 | ||||
|         let response = await!(r0::alias::get_alias::call( | ||||
|             client.clone(), | ||||
|             r0::alias::get_alias::Request { | ||||
|                 room_alias: RoomAliasId::try_from(&room[..]).unwrap(), | ||||
|             } | ||||
|         ))?; | ||||
| 
 | ||||
|         let room_id = response.room_id; | ||||
| 
 | ||||
|         await!(r0::membership::join_room_by_id::call( | ||||
|             client.clone(), | ||||
|             r0::membership::join_room_by_id::Request { | ||||
|                 room_id: room_id.clone(), | ||||
|                 third_party_signed: None, | ||||
|             } | ||||
|         ))?; | ||||
| 
 | ||||
|         await!(r0::send::send_message_event::call( | ||||
|             client.clone(), | ||||
|             r0::send::send_message_event::Request { | ||||
|                 room_id: room_id, | ||||
|                 event_type: EventType::RoomMessage, | ||||
|                 txn_id: "1".to_owned(), | ||||
|                 data: MessageEventContent::Text(TextMessageEventContent { | ||||
|                     body: "Hello World!".to_owned(), | ||||
|                     msgtype: MessageType::Text, | ||||
|                 }), | ||||
|             } | ||||
|         ))?; | ||||
| 
 | ||||
|         Ok(()) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| fn main() { | ||||
|     let (homeserver_url, room) = match (env::args().nth(1), env::args().nth(2)) { | ||||
|         (Some(a), Some(b)) => (a, b), | ||||
|         _ => { | ||||
|             eprintln!("Usage: {} <homeserver_url> <room>", env::args().next().unwrap()); | ||||
|             exit(1) | ||||
|         } | ||||
|     }; | ||||
| 
 | ||||
|     Core::new().unwrap() | ||||
|         .run(hello_world(homeserver_url.parse().unwrap(), room)) | ||||
|         .unwrap(); | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user