Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated send-msg and send-file to work with the 2 new API calls in jami-rs v0.3.0 #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
/target
# Generated by Cargo
# will have compiled files and executables
/target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
# send it to Github so that other people can have transparency
# Cargo.lock

Cargo.toml.*

# These are backup files generated by rustfmt
**/*.rs.bk

# To-do list
todo.txt

test.txt

README.md.*
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "jami-cli"
description = "Jami client for terminal"
version = "0.4.0"
version = "0.5.0"
authors = ["Sébastien Blin <amarok@enconn.fr>"]
edition = "2018"
keywords = ["jami", "tui"]
Expand Down Expand Up @@ -32,5 +32,5 @@ tokio = { version = "0.2.22", features = ["full"] }
toml = "0.5.6"
tui = { version = "0.12.0", default-features = false, features = ["crossterm"] }
unicode-width = "0.1.8"
jami-rs = "0.2.0"
#jami-rs = { git = "https://github.com/AmarOk1412/jami-rs", branch="main" }
#jami-rs = "0.3.0"
jami-rs = { git = "https://github.com/8go/jami-rs", branch="main" }
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ To run this project you will need:
+ Run `jami-cli`
+ Enjoy!

## Update August 2024

Many Dbus API calls are not up to date. But `send_message` and `send-file` have been updated to work with latest versions of Jami as of August 2024.

For example, on Fedora 40 do this to install:

+ `sudo dnf install dbus-devel pkgconf-pkg-config sqlite3 sqlite-devel # install as prerequisite for jami-cli jami-rs`
+ `sudo dnf-3 config-manager --add-repo https://dl.jami.net/stable/fedora_40/jami-stable.repo # add Jami repo to dnf`
+ `sudo dnf install jami-daemon # install the Jami daemon jamid`
+ `/usr/libexec/jamid -p & # start the daemon jamid`

To run:

+ clone `jami-rs` repo and `jami-cli` repo
+ compile with `cargo`
+ don't forget that the `jamid` daemon must be running, see above
+ run `jami-cli`

## Features

+ Manage accounts (add/remove/link/import/change settings)
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.5.0
14 changes: 8 additions & 6 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ impl App {
} else if message.starts_with("/send ") {
let parts: Vec<&str> = message.split(" ").collect();
let path = parts.get(1).unwrap_or(&"").to_string();
Jami::send_file(account_id.to_string(), channel.id.clone(), path);
Jami::send_file(&account_id.to_string(), &channel.id.clone(), &path, &path, &String::new());
show_msg = false;
} else if message.starts_with("/accept ") {
let parts: Vec<&str> = message.split(" ").collect();
Expand All @@ -341,7 +341,7 @@ impl App {
break;
}
idx += 1;
}
}
}
}
if !path.is_empty() {
Expand Down Expand Up @@ -386,7 +386,8 @@ impl App {
.push(Message::info(String::from("/exit: quit")));
} else {
show_msg = false;
Jami::send_conversation_message(&account_id, &channel.id, &message, &String::new());
let flag = 0; /* not a reply, not an edit, just a single msg */
Jami::send_message(&account_id, &channel.id, &message, &String::new(), &flag);
}
} else if is_invite || is_trust_request {
let account_id = &self.data.account.id;
Expand Down Expand Up @@ -522,7 +523,8 @@ impl App {
let tid = payloads.get("tid").unwrap_or(&String::new()).clone();
let display_name = payloads.get("displayName").unwrap_or(&String::new()).clone();

let mut status = String::from("not downloaded");
let mut status = String::from("sent");
/* Todo: data_transfer_info does not exist anymore in dbus API, will always return None */
let info = Jami::data_transfer_info(account_id.clone(), conversation_id.clone(), tid.parse::<u64>().unwrap_or(0));
if !info.is_none() {
status = match info.unwrap().last_event {
Expand All @@ -534,10 +536,10 @@ impl App {
8 => String::from("closed by peer"),
10 => String::from("unjoinable peer"),
11 => String::from("timeout expired"),
_ => String::from("not downaloaded"),
_ => String::from("not downloaded"),
};
}

let message = match self.data.transfer_manager.path(account_id.clone(), conversation_id.clone(), tid.clone()) {
None => format!("<New file transfer with id: {} - {} - {}>", tid, display_name, status),
Some(path) => format!("<file://{}>", path),
Expand Down