refactor: rename dc_qr -> qr

This commit is contained in:
dignifiedquire
2019-08-18 00:40:08 +02:00
parent 8a49ae2361
commit d55f6ee7c7
5 changed files with 16 additions and 16 deletions

View File

@@ -991,7 +991,7 @@ pub unsafe extern "C" fn dc_check_qr(
assert!(!qr.is_null());
let context = &*context;
let lot = dc_qr::dc_check_qr(context, as_str(qr));
let lot = qr::check_qr(context, as_str(qr));
Box::into_raw(Box::new(lot))
}

View File

@@ -13,11 +13,11 @@ use deltachat::dc_imex::*;
use deltachat::dc_job::*;
use deltachat::dc_location::*;
use deltachat::dc_msg::*;
use deltachat::dc_qr::*;
use deltachat::dc_receive_imf::*;
use deltachat::dc_tools::*;
use deltachat::lot::LotState;
use deltachat::peerstate::*;
use deltachat::qr::*;
use deltachat::sql;
use deltachat::types::*;
use deltachat::x::*;
@@ -1048,7 +1048,7 @@ pub unsafe fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::E
}
"checkqr" => {
ensure!(!arg1.is_empty(), "Argument <qr-content> missing.");
let res = dc_check_qr(context, arg1);
let res = check_qr(context, arg1);
println!(
"state={}, id={}, text1={:?}, text2={:?}",
res.get_state(),

View File

@@ -10,13 +10,13 @@ use crate::dc_configure::*;
use crate::dc_e2ee::*;
use crate::dc_mimeparser::*;
use crate::dc_msg::*;
use crate::dc_qr::*;
use crate::dc_token::*;
use crate::dc_tools::*;
use crate::key::*;
use crate::lot::LotState;
use crate::param::*;
use crate::peerstate::*;
use crate::qr::check_qr;
use crate::stock::StockMessage;
use crate::types::*;
use crate::x::*;
@@ -143,7 +143,7 @@ pub unsafe fn dc_join_securejoin(context: &Context, qr: *const libc::c_char) ->
ongoing_allocated = dc_alloc_ongoing(context);
if !(ongoing_allocated == 0i32) {
let qr_scan = dc_check_qr(context, as_str(qr));
let qr_scan = check_qr(context, as_str(qr));
if qr_scan.state != LotState::QrAskVerifyContact
&& qr_scan.state != LotState::QrAskVerifyGroup
{

View File

@@ -37,6 +37,7 @@ pub mod oauth2;
mod param;
pub mod peerstate;
pub mod pgp;
pub mod qr;
mod smtp;
pub mod sql;
mod stock;
@@ -56,7 +57,6 @@ mod dc_mimefactory;
pub mod dc_mimeparser;
mod dc_move;
pub mod dc_msg;
pub mod dc_qr;
pub mod dc_receive_imf;
pub mod dc_securejoin;
mod dc_simplify;

View File

@@ -34,7 +34,7 @@ impl Into<Lot> for Error {
/// Check a scanned QR code.
/// The function should be called after a QR code is scanned.
/// The function takes the raw text scanned and checks what can be done with it.
pub fn dc_check_qr(context: &Context, qr: impl AsRef<str>) -> Lot {
pub fn check_qr(context: &Context, qr: impl AsRef<str>) -> Lot {
let qr = qr.as_ref();
info!(context, 0, "Scanned QR code: {}", qr);
@@ -335,7 +335,7 @@ mod tests {
fn test_decode_http() {
let ctx = dummy_context();
let res = dc_check_qr(&ctx.ctx, "http://www.hello.com");
let res = check_qr(&ctx.ctx, "http://www.hello.com");
assert_eq!(res.get_state(), LotState::QrUrl);
assert_eq!(res.get_id(), 0);
@@ -347,7 +347,7 @@ mod tests {
fn test_decode_https() {
let ctx = dummy_context();
let res = dc_check_qr(&ctx.ctx, "https://www.hello.com");
let res = check_qr(&ctx.ctx, "https://www.hello.com");
assert_eq!(res.get_state(), LotState::QrUrl);
assert_eq!(res.get_id(), 0);
@@ -359,7 +359,7 @@ mod tests {
fn test_decode_text() {
let ctx = dummy_context();
let res = dc_check_qr(&ctx.ctx, "I am so cool");
let res = check_qr(&ctx.ctx, "I am so cool");
assert_eq!(res.get_state(), LotState::QrText);
assert_eq!(res.get_id(), 0);
@@ -371,7 +371,7 @@ mod tests {
fn test_decode_vcard() {
let ctx = dummy_context();
let res = dc_check_qr(
let res = check_qr(
&ctx.ctx,
"BEGIN:VCARD\nVERSION:3.0\nN:Last;First\nEMAIL;TYPE=INTERNET:stress@test.local\nEND:VCARD"
);
@@ -389,7 +389,7 @@ mod tests {
fn test_decode_matmsg() {
let ctx = dummy_context();
let res = dc_check_qr(
let res = check_qr(
&ctx.ctx,
"MATMSG:TO:\n\nstress@test.local ; \n\nSUB:\n\nSubject here\n\nBODY:\n\nhelloworld\n;;",
);
@@ -406,7 +406,7 @@ mod tests {
fn test_decode_mailto() {
let ctx = dummy_context();
let res = dc_check_qr(
let res = check_qr(
&ctx.ctx,
"mailto:stress@test.local?subject=hello&body=world",
);
@@ -423,7 +423,7 @@ mod tests {
fn test_decode_smtp() {
let ctx = dummy_context();
let res = dc_check_qr(&ctx.ctx, "SMTP:stress@test.local:subjecthello:bodyworld");
let res = check_qr(&ctx.ctx, "SMTP:stress@test.local:subjecthello:bodyworld");
println!("{:?}", res);
assert_eq!(res.get_state(), LotState::QrAddr);
@@ -437,7 +437,7 @@ mod tests {
fn test_decode_openpgp_group() {
let ctx = dummy_context();
let res = dc_check_qr(
let res = check_qr(
&ctx.ctx,
"OPENPGP4FPR:79252762C34C5096AF57958F4FC3D21A81B0F0A7#a=cli%40deltachat.de&g=testtesttest&x=h-0oKQf2CDK&i=9JEXlxAqGM0&s=0V7LzL9cxRL"
);
@@ -454,7 +454,7 @@ mod tests {
fn test_decode_openpgp_secure_join() {
let ctx = dummy_context();
let res = dc_check_qr(
let res = check_qr(
&ctx.ctx,
"OPENPGP4FPR:79252762C34C5096AF57958F4FC3D21A81B0F0A7#a=cli%40deltachat.de&n=&i=TbnwJ6lSvD5&s=0ejvbdFSQxB"
);