Compare commits
2 Commits
576fec63cd
...
1e481d4c9a
Author | SHA1 | Date | |
---|---|---|---|
1e481d4c9a | |||
e5e06c55f9 |
@@ -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<RwLock<dc::context::Context>>,
|
||||
actq: mpsc::Sender<DbusAction>,
|
||||
ctx: Arc<RwLock<dc::context::Context>>,
|
||||
path: dbus::Path<'static>,
|
||||
requested: bool,
|
||||
target_handle: u32, // Who we're talking to
|
||||
}
|
||||
|
||||
@@ -44,16 +45,18 @@ pub fn channel_interfaces() -> Vec<String> {
|
||||
|
||||
impl Channel {
|
||||
pub fn new(
|
||||
actq: mpsc::Sender<DbusAction>,
|
||||
ctx: Arc<RwLock<dc::context::Context>>,
|
||||
path: dbus::Path<'static>,
|
||||
requested: bool,
|
||||
target_handle: u32,
|
||||
actq: mpsc::Sender<DbusAction>,
|
||||
) -> Self {
|
||||
Channel {
|
||||
actq,
|
||||
ctx,
|
||||
path,
|
||||
requested,
|
||||
target_handle,
|
||||
actq,
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -77,7 +77,7 @@ impl telepathy::Channel for Channel {
|
||||
fn requested(&self) -> Result<bool> {
|
||||
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<u32> {
|
||||
|
@@ -32,26 +32,31 @@ impl telepathy::ChannelInterfaceMessages for Channel {
|
||||
|
||||
fn supported_content_types(&self) -> Result<Vec<String>> {
|
||||
println!("Channel::supported_content_types()");
|
||||
Err(MethodErr::no_arg())
|
||||
|
||||
Ok(vec!["text/plain".to_string()]) // TODO: image support
|
||||
}
|
||||
|
||||
fn message_types(&self) -> Result<Vec<u32>> {
|
||||
println!("Channel::message_types()");
|
||||
Err(MethodErr::no_arg())
|
||||
|
||||
Ok(vec![0]) // Normal messages. FIXME: MDNs too
|
||||
}
|
||||
|
||||
fn message_part_support_flags(&self) -> Result<u32> {
|
||||
println!("Channel::message_part_support_flags()");
|
||||
Err(MethodErr::no_arg())
|
||||
|
||||
Ok(0) // FIXME: support multipart messages
|
||||
}
|
||||
|
||||
fn pending_messages(&self) -> Result<Vec<Vec<HashMap<String, VarArg>>>> {
|
||||
println!("Channel::pending_messages()");
|
||||
Err(MethodErr::no_arg())
|
||||
|
||||
Ok(vec![]) // FIXME: check for pending messages
|
||||
}
|
||||
|
||||
fn delivery_reporting_support(&self) -> Result<u32> {
|
||||
println!("Channel::delivery_reporting_support()");
|
||||
Err(MethodErr::no_arg())
|
||||
|
||||
Ok(0) // FIXME: MDNs
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
use crate::telepathy;
|
||||
use crate::telepathy::ChannelInterfaceMessages;
|
||||
use dbus::tree::MethodErr;
|
||||
|
||||
use super::{Channel, Result};
|
||||
@@ -28,7 +29,8 @@ impl telepathy::ChannelTypeText for Channel {
|
||||
|
||||
fn get_message_types(&self) -> Result<Vec<u32>> {
|
||||
println!("Channel::get_message_types()");
|
||||
Err(MethodErr::no_arg())
|
||||
|
||||
self.message_types()
|
||||
}
|
||||
|
||||
fn list_pending_messages(&self, clear: bool) -> Result<Vec<PendingMessagesSpec>> {
|
||||
|
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user