From e5e06c55f9ea35f6742a5ac21959ecd41da91a46 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Sun, 17 May 2020 22:37:25 +0100 Subject: [PATCH] Reorder Channel::new args --- src/padfoot/channel.rs | 9 ++++++--- src/padfoot/channel/channel.rs | 2 +- src/padfoot/connection.rs | 8 +++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/padfoot/channel.rs b/src/padfoot/channel.rs index a90bc78..ca49e43 100644 --- a/src/padfoot/channel.rs +++ b/src/padfoot/channel.rs @@ -31,9 +31,10 @@ pub const HANDLE_TYPE_GROUP: HandleType = 4; // Deprecated // FIXME: I'm assuming that all channels will be of type text and 1-1 for now. #[derive(Debug)] pub struct Channel { - ctx: Arc>, actq: mpsc::Sender, + ctx: Arc>, path: dbus::Path<'static>, + requested: bool, target_handle: u32, // Who we're talking to } @@ -44,16 +45,18 @@ pub fn channel_interfaces() -> Vec { impl Channel { pub fn new( + actq: mpsc::Sender, ctx: Arc>, path: dbus::Path<'static>, + requested: bool, target_handle: u32, - actq: mpsc::Sender, ) -> Self { Channel { + actq, ctx, path, + requested, target_handle, - actq, } } diff --git a/src/padfoot/channel/channel.rs b/src/padfoot/channel/channel.rs index 0db0336..a116d93 100644 --- a/src/padfoot/channel/channel.rs +++ b/src/padfoot/channel/channel.rs @@ -77,7 +77,7 @@ impl telepathy::Channel for Channel { fn requested(&self) -> Result { println!("Channel::requested()"); - Ok(false) // FIXME: channels initiated by ourselves *will* be requested + Ok(true) // FIXME: channels initiated by ourselves *will* be requested } fn initiator_handle(&self) -> Result { diff --git a/src/padfoot/connection.rs b/src/padfoot/connection.rs index 074c504..528e1c6 100644 --- a/src/padfoot/connection.rs +++ b/src/padfoot/connection.rs @@ -403,7 +403,13 @@ impl Connection { } let handle = contacts.first().unwrap(); - let chan = Channel::new(ctx.clone(), chan_path, *handle, actq.clone()); + let chan = Channel::new( + actq.clone(), + ctx.clone(), + chan_path, + false, // FIXME: this needs to handle requested channels + *handle, + ); actq.send(DbusAction::NewChannel(chan)).unwrap(); actq.send(act).unwrap();