mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 02:46:29 +03:00
Fixed clippy errors and formatting
This commit is contained in:
@@ -204,7 +204,6 @@ impl CommandApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn check_qr(&self, account_id: u32, qr_content: String) -> Result<QrObject> {
|
async fn check_qr(&self, account_id: u32, qr_content: String) -> Result<QrObject> {
|
||||||
println!("HELLO FROM CHECK_QR");
|
|
||||||
let ctx = self.get_context(account_id).await?;
|
let ctx = self.get_context(account_id).await?;
|
||||||
let qr = qr::check_qr(&ctx, &qr_content).await?;
|
let qr = qr::check_qr(&ctx, &qr_content).await?;
|
||||||
let qr_object = QrObject::from(qr);
|
let qr_object = QrObject::from(qr);
|
||||||
|
|||||||
@@ -137,16 +137,10 @@ impl From<Qr> for QrObject {
|
|||||||
QrObject::FprOk { contact_id }
|
QrObject::FprOk { contact_id }
|
||||||
}
|
}
|
||||||
Qr::FprMismatch { contact_id } => {
|
Qr::FprMismatch { contact_id } => {
|
||||||
let contact_id = match contact_id {
|
let contact_id = contact_id.map(|contact_id| contact_id.to_u32());
|
||||||
Some(contact_id) => Some(contact_id.to_u32()),
|
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
QrObject::FprMismatch { contact_id }
|
QrObject::FprMismatch { contact_id }
|
||||||
}
|
}
|
||||||
Qr::FprWithoutAddr { fingerprint } => {
|
Qr::FprWithoutAddr { fingerprint } => QrObject::FprWithoutAddr { fingerprint },
|
||||||
let fingerprint = fingerprint.to_string();
|
|
||||||
QrObject::FprWithoutAddr { fingerprint }
|
|
||||||
}
|
|
||||||
Qr::Account { domain } => QrObject::Account { domain },
|
Qr::Account { domain } => QrObject::Account { domain },
|
||||||
Qr::WebrtcInstance {
|
Qr::WebrtcInstance {
|
||||||
domain,
|
domain,
|
||||||
|
|||||||
@@ -1,98 +1,385 @@
|
|||||||
// AUTO-GENERATED by typescript-type-def
|
// AUTO-GENERATED by typescript-type-def
|
||||||
|
|
||||||
export type U32=number;
|
export type U32 = number;
|
||||||
export type Account=(({"type":"Configured";}&{"id":U32;"displayName":(string|null);"addr":(string|null);"profileImage":(string|null);"color":string;})|({"type":"Unconfigured";}&{"id":U32;}));
|
export type Account =
|
||||||
export type ProviderInfo={"beforeLoginHint":string;"overviewPage":string;"status":U32;};
|
| ({ type: "Configured" } & {
|
||||||
export type Qr=(({"type":"askVerifyContact";}&{"contact_id":U32;"fingerprint":string;"invitenumber":string;"authcode":string;})|({"type":"askVerifyGroup";}&{"grpname":string;"grpid":string;"contact_id":U32;"fingerprint":string;"invitenumber":string;"authcode":string;})|({"type":"fprOk";}&{"contact_id":U32;})|({"type":"fprMismatch";}&{"contact_id":(U32|null);})|({"type":"fprWithoutAddr";}&{"fingerprint":string;})|({"type":"account";}&{"domain":string;})|({"type":"webrtcInstance";}&{"domain":string;"instance_pattern":string;})|({"type":"addr";}&{"contact_id":U32;})|({"type":"url";}&{"url":string;})|({"type":"text";}&{"text":string;})|({"type":"withdrawVerifyContact";}&{"contact_id":U32;"fingerprint":string;"invitenumber":string;"authcode":string;})|({"type":"withdrawVerifyGroup";}&{"grpname":string;"grpid":string;"contact_id":U32;"fingerprint":string;"invitenumber":string;"authcode":string;})|({"type":"reviveVerifyContact";}&{"contact_id":U32;"fingerprint":string;"invitenumber":string;"authcode":string;})|({"type":"reviveVerifyGroup";}&{"grpname":string;"grpid":string;"contact_id":U32;"fingerprint":string;"invitenumber":string;"authcode":string;}));
|
id: U32;
|
||||||
export type Usize=number;
|
displayName: string | null;
|
||||||
export type ChatListEntry=[U32,U32];
|
addr: string | null;
|
||||||
export type I64=number;
|
profileImage: string | null;
|
||||||
export type ChatListItemFetchResult=(({"type":"ChatListItem";}&{"id":U32;"name":string;"avatarPath":(string|null);"color":string;"lastUpdated":(I64|null);"summaryText1":string;"summaryText2":string;"summaryStatus":U32;"isProtected":boolean;"isGroup":boolean;"freshMessageCounter":Usize;"isSelfTalk":boolean;"isDeviceTalk":boolean;"isSendingLocation":boolean;"isSelfInGroup":boolean;"isArchived":boolean;"isPinned":boolean;"isMuted":boolean;"isContactRequest":boolean;
|
color: string;
|
||||||
/**
|
})
|
||||||
* contact id if this is a dm chat (for view profile entry in context menu)
|
| ({ type: "Unconfigured" } & { id: U32 });
|
||||||
*/
|
export type ProviderInfo = {
|
||||||
"dmChatContact":(U32|null);})|{"type":"ArchiveLink";}|({"type":"Error";}&{"id":U32;"error":string;}));
|
beforeLoginHint: string;
|
||||||
export type Contact={"address":string;"color":string;"authName":string;"status":string;"displayName":string;"id":U32;"name":string;"profileImage":(string|null);"nameAndAddr":string;"isBlocked":boolean;"isVerified":boolean;};
|
overviewPage: string;
|
||||||
export type FullChat={"id":U32;"name":string;"isProtected":boolean;"profileImage":(string|null);"archived":boolean;"chatType":U32;"isUnpromoted":boolean;"isSelfTalk":boolean;"contacts":(Contact)[];"contactIds":(U32)[];"color":string;"freshMessageCounter":Usize;"isContactRequest":boolean;"isDeviceChat":boolean;"selfInGroup":boolean;"isMuted":boolean;"ephemeralTimer":U32;"canSend":boolean;};
|
status: U32;
|
||||||
export type Viewtype=("Unknown"|
|
};
|
||||||
/**
|
export type Qr =
|
||||||
* Text message.
|
| ({ type: "askVerifyContact" } & {
|
||||||
*/
|
contact_id: U32;
|
||||||
"Text"|
|
fingerprint: string;
|
||||||
/**
|
invitenumber: string;
|
||||||
* Image message.
|
authcode: string;
|
||||||
* If the image is an animated GIF, the type `Viewtype.Gif` should be used.
|
})
|
||||||
*/
|
| ({ type: "askVerifyGroup" } & {
|
||||||
"Image"|
|
grpname: string;
|
||||||
/**
|
grpid: string;
|
||||||
* Animated GIF message.
|
contact_id: U32;
|
||||||
*/
|
fingerprint: string;
|
||||||
"Gif"|
|
invitenumber: string;
|
||||||
/**
|
authcode: string;
|
||||||
* Message containing a sticker, similar to image.
|
})
|
||||||
* If possible, the ui should display the image without borders in a transparent way.
|
| ({ type: "fprOk" } & { contact_id: U32 })
|
||||||
* A click on a sticker will offer to install the sticker set in some future.
|
| ({ type: "fprMismatch" } & { contact_id: U32 | null })
|
||||||
*/
|
| ({ type: "fprWithoutAddr" } & { fingerprint: string })
|
||||||
"Sticker"|
|
| ({ type: "account" } & { domain: string })
|
||||||
/**
|
| ({ type: "webrtcInstance" } & { domain: string; instance_pattern: string })
|
||||||
* Message containing an Audio file.
|
| ({ type: "addr" } & { contact_id: U32 })
|
||||||
*/
|
| ({ type: "url" } & { url: string })
|
||||||
"Audio"|
|
| ({ type: "text" } & { text: string })
|
||||||
/**
|
| ({ type: "withdrawVerifyContact" } & {
|
||||||
* A voice message that was directly recorded by the user.
|
contact_id: U32;
|
||||||
* For all other audio messages, the type `Viewtype.Audio` should be used.
|
fingerprint: string;
|
||||||
*/
|
invitenumber: string;
|
||||||
"Voice"|
|
authcode: string;
|
||||||
/**
|
})
|
||||||
* Video messages.
|
| ({ type: "withdrawVerifyGroup" } & {
|
||||||
*/
|
grpname: string;
|
||||||
"Video"|
|
grpid: string;
|
||||||
/**
|
contact_id: U32;
|
||||||
* Message containing any file, eg. a PDF.
|
fingerprint: string;
|
||||||
*/
|
invitenumber: string;
|
||||||
"File"|
|
authcode: string;
|
||||||
/**
|
})
|
||||||
* Message is an invitation to a videochat.
|
| ({ type: "reviveVerifyContact" } & {
|
||||||
*/
|
contact_id: U32;
|
||||||
"VideochatInvitation"|
|
fingerprint: string;
|
||||||
/**
|
invitenumber: string;
|
||||||
* Message is an webxdc instance.
|
authcode: string;
|
||||||
*/
|
})
|
||||||
"Webxdc");
|
| ({ type: "reviveVerifyGroup" } & {
|
||||||
export type I32=number;
|
grpname: string;
|
||||||
export type U64=number;
|
grpid: string;
|
||||||
export type Message={"id":U32;"chatId":U32;"fromId":U32;"quotedText":(string|null);"quotedMessageId":(U32|null);"text":(string|null);"hasLocation":boolean;"hasHtml":boolean;"viewType":Viewtype;"state":U32;"timestamp":I64;"sortTimestamp":I64;"receivedTimestamp":I64;"hasDeviatingTimestamp":boolean;"subject":string;"showPadlock":boolean;"isSetupmessage":boolean;"isInfo":boolean;"isForwarded":boolean;"duration":I32;"dimensionsHeight":I32;"dimensionsWidth":I32;"videochatType":(U32|null);"videochatUrl":(string|null);"overrideSenderName":(string|null);"sender":Contact;"setupCodeBegin":(string|null);"file":(string|null);"fileMime":(string|null);"fileBytes":U64;"fileName":(string|null);};
|
contact_id: U32;
|
||||||
export type WebxdcMessageInfo={
|
fingerprint: string;
|
||||||
/**
|
invitenumber: string;
|
||||||
* The name of the app.
|
authcode: string;
|
||||||
*
|
});
|
||||||
* Defaults to the filename if not set in the manifest.
|
export type Usize = number;
|
||||||
*/
|
export type ChatListEntry = [U32, U32];
|
||||||
"name":string;
|
export type I64 = number;
|
||||||
/**
|
export type ChatListItemFetchResult =
|
||||||
* App icon file name.
|
| ({ type: "ChatListItem" } & {
|
||||||
* Defaults to an standard icon if nothing is set in the manifest.
|
id: U32;
|
||||||
*
|
name: string;
|
||||||
* To get the file, use dc_msg_get_webxdc_blob(). (not yet in jsonrpc, use rust api or cffi for it)
|
avatarPath: string | null;
|
||||||
*
|
color: string;
|
||||||
* App icons should should be square,
|
lastUpdated: I64 | null;
|
||||||
* the implementations will add round corners etc. as needed.
|
summaryText1: string;
|
||||||
*/
|
summaryText2: string;
|
||||||
"icon":string;
|
summaryStatus: U32;
|
||||||
/**
|
isProtected: boolean;
|
||||||
* if the Webxdc represents a document, then this is the name of the document
|
isGroup: boolean;
|
||||||
*/
|
freshMessageCounter: Usize;
|
||||||
"document":(string|null);
|
isSelfTalk: boolean;
|
||||||
/**
|
isDeviceTalk: boolean;
|
||||||
* short string describing the state of the app,
|
isSendingLocation: boolean;
|
||||||
* sth. as "2 votes", "Highscore: 123",
|
isSelfInGroup: boolean;
|
||||||
* can be changed by the apps
|
isArchived: boolean;
|
||||||
*/
|
isPinned: boolean;
|
||||||
"summary":(string|null);
|
isMuted: boolean;
|
||||||
/**
|
isContactRequest: boolean;
|
||||||
* URL where the source code of the Webxdc and other information can be found;
|
/**
|
||||||
* defaults to an empty string.
|
* contact id if this is a dm chat (for view profile entry in context menu)
|
||||||
* Implementations may offer an menu or a button to open this URL.
|
*/
|
||||||
*/
|
dmChatContact: U32 | null;
|
||||||
"sourceCodeUrl":(string|null);};
|
})
|
||||||
export type __AllTyps=[string,boolean,Record<string,string>,U32,U32,null,(U32)[],U32,null,(U32|null),(Account)[],U32,Account,U32,string,(ProviderInfo|null),U32,boolean,U32,Record<string,string>,U32,string,(string|null),null,U32,Record<string,(string|null)>,null,U32,string,null,U32,string,Qr,U32,string,(string|null),U32,(string)[],Record<string,(string|null)>,U32,null,U32,null,U32,(U32)[],U32,U32,Usize,U32,string,U32,U32,string,null,U32,(U32|null),(string|null),(U32|null),(ChatListEntry)[],U32,(ChatListEntry)[],Record<U32,ChatListItemFetchResult>,U32,U32,FullChat,U32,U32,null,U32,U32,null,U32,string,string,U32,U32,U32,U32,(U32)[],U32,U32,Message,U32,(U32)[],Record<U32,Message>,U32,U32,Contact,U32,string,(string|null),U32,U32,U32,U32,U32,U32,null,U32,U32,null,U32,(Contact)[],U32,U32,(string|null),(U32)[],U32,U32,(string|null),(Contact)[],U32,(U32)[],Record<U32,Contact>,U32,U32,Viewtype,(Viewtype|null),(Viewtype|null),(U32)[],U32,U32,string,string,null,U32,U32,U32,string,U32,U32,WebxdcMessageInfo,U32,string,U32,U32];
|
| { type: "ArchiveLink" }
|
||||||
|
| ({ type: "Error" } & { id: U32; error: string });
|
||||||
|
export type Contact = {
|
||||||
|
address: string;
|
||||||
|
color: string;
|
||||||
|
authName: string;
|
||||||
|
status: string;
|
||||||
|
displayName: string;
|
||||||
|
id: U32;
|
||||||
|
name: string;
|
||||||
|
profileImage: string | null;
|
||||||
|
nameAndAddr: string;
|
||||||
|
isBlocked: boolean;
|
||||||
|
isVerified: boolean;
|
||||||
|
};
|
||||||
|
export type FullChat = {
|
||||||
|
id: U32;
|
||||||
|
name: string;
|
||||||
|
isProtected: boolean;
|
||||||
|
profileImage: string | null;
|
||||||
|
archived: boolean;
|
||||||
|
chatType: U32;
|
||||||
|
isUnpromoted: boolean;
|
||||||
|
isSelfTalk: boolean;
|
||||||
|
contacts: Contact[];
|
||||||
|
contactIds: U32[];
|
||||||
|
color: string;
|
||||||
|
freshMessageCounter: Usize;
|
||||||
|
isContactRequest: boolean;
|
||||||
|
isDeviceChat: boolean;
|
||||||
|
selfInGroup: boolean;
|
||||||
|
isMuted: boolean;
|
||||||
|
ephemeralTimer: U32;
|
||||||
|
canSend: boolean;
|
||||||
|
};
|
||||||
|
export type Viewtype =
|
||||||
|
| "Unknown"
|
||||||
|
/**
|
||||||
|
* Text message.
|
||||||
|
*/
|
||||||
|
| "Text"
|
||||||
|
/**
|
||||||
|
* Image message.
|
||||||
|
* If the image is an animated GIF, the type `Viewtype.Gif` should be used.
|
||||||
|
*/
|
||||||
|
| "Image"
|
||||||
|
/**
|
||||||
|
* Animated GIF message.
|
||||||
|
*/
|
||||||
|
| "Gif"
|
||||||
|
/**
|
||||||
|
* Message containing a sticker, similar to image.
|
||||||
|
* If possible, the ui should display the image without borders in a transparent way.
|
||||||
|
* A click on a sticker will offer to install the sticker set in some future.
|
||||||
|
*/
|
||||||
|
| "Sticker"
|
||||||
|
/**
|
||||||
|
* Message containing an Audio file.
|
||||||
|
*/
|
||||||
|
| "Audio"
|
||||||
|
/**
|
||||||
|
* A voice message that was directly recorded by the user.
|
||||||
|
* For all other audio messages, the type `Viewtype.Audio` should be used.
|
||||||
|
*/
|
||||||
|
| "Voice"
|
||||||
|
/**
|
||||||
|
* Video messages.
|
||||||
|
*/
|
||||||
|
| "Video"
|
||||||
|
/**
|
||||||
|
* Message containing any file, eg. a PDF.
|
||||||
|
*/
|
||||||
|
| "File"
|
||||||
|
/**
|
||||||
|
* Message is an invitation to a videochat.
|
||||||
|
*/
|
||||||
|
| "VideochatInvitation"
|
||||||
|
/**
|
||||||
|
* Message is an webxdc instance.
|
||||||
|
*/
|
||||||
|
| "Webxdc";
|
||||||
|
export type I32 = number;
|
||||||
|
export type U64 = number;
|
||||||
|
export type Message = {
|
||||||
|
id: U32;
|
||||||
|
chatId: U32;
|
||||||
|
fromId: U32;
|
||||||
|
quotedText: string | null;
|
||||||
|
quotedMessageId: U32 | null;
|
||||||
|
text: string | null;
|
||||||
|
hasLocation: boolean;
|
||||||
|
hasHtml: boolean;
|
||||||
|
viewType: Viewtype;
|
||||||
|
state: U32;
|
||||||
|
timestamp: I64;
|
||||||
|
sortTimestamp: I64;
|
||||||
|
receivedTimestamp: I64;
|
||||||
|
hasDeviatingTimestamp: boolean;
|
||||||
|
subject: string;
|
||||||
|
showPadlock: boolean;
|
||||||
|
isSetupmessage: boolean;
|
||||||
|
isInfo: boolean;
|
||||||
|
isForwarded: boolean;
|
||||||
|
duration: I32;
|
||||||
|
dimensionsHeight: I32;
|
||||||
|
dimensionsWidth: I32;
|
||||||
|
videochatType: U32 | null;
|
||||||
|
videochatUrl: string | null;
|
||||||
|
overrideSenderName: string | null;
|
||||||
|
sender: Contact;
|
||||||
|
setupCodeBegin: string | null;
|
||||||
|
file: string | null;
|
||||||
|
fileMime: string | null;
|
||||||
|
fileBytes: U64;
|
||||||
|
fileName: string | null;
|
||||||
|
};
|
||||||
|
export type WebxdcMessageInfo = {
|
||||||
|
/**
|
||||||
|
* The name of the app.
|
||||||
|
*
|
||||||
|
* Defaults to the filename if not set in the manifest.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* App icon file name.
|
||||||
|
* Defaults to an standard icon if nothing is set in the manifest.
|
||||||
|
*
|
||||||
|
* To get the file, use dc_msg_get_webxdc_blob(). (not yet in jsonrpc, use rust api or cffi for it)
|
||||||
|
*
|
||||||
|
* App icons should should be square,
|
||||||
|
* the implementations will add round corners etc. as needed.
|
||||||
|
*/
|
||||||
|
icon: string;
|
||||||
|
/**
|
||||||
|
* if the Webxdc represents a document, then this is the name of the document
|
||||||
|
*/
|
||||||
|
document: string | null;
|
||||||
|
/**
|
||||||
|
* short string describing the state of the app,
|
||||||
|
* sth. as "2 votes", "Highscore: 123",
|
||||||
|
* can be changed by the apps
|
||||||
|
*/
|
||||||
|
summary: string | null;
|
||||||
|
/**
|
||||||
|
* URL where the source code of the Webxdc and other information can be found;
|
||||||
|
* defaults to an empty string.
|
||||||
|
* Implementations may offer an menu or a button to open this URL.
|
||||||
|
*/
|
||||||
|
sourceCodeUrl: string | null;
|
||||||
|
};
|
||||||
|
export type __AllTyps = [
|
||||||
|
string,
|
||||||
|
boolean,
|
||||||
|
Record<string, string>,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
null,
|
||||||
|
U32[],
|
||||||
|
U32,
|
||||||
|
null,
|
||||||
|
U32 | null,
|
||||||
|
Account[],
|
||||||
|
U32,
|
||||||
|
Account,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
ProviderInfo | null,
|
||||||
|
U32,
|
||||||
|
boolean,
|
||||||
|
U32,
|
||||||
|
Record<string, string>,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
string | null,
|
||||||
|
null,
|
||||||
|
U32,
|
||||||
|
Record<string, string | null>,
|
||||||
|
null,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
null,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
Qr,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
string | null,
|
||||||
|
U32,
|
||||||
|
string[],
|
||||||
|
Record<string, string | null>,
|
||||||
|
U32,
|
||||||
|
null,
|
||||||
|
U32,
|
||||||
|
null,
|
||||||
|
U32,
|
||||||
|
U32[],
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
Usize,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
null,
|
||||||
|
U32,
|
||||||
|
U32 | null,
|
||||||
|
string | null,
|
||||||
|
U32 | null,
|
||||||
|
ChatListEntry[],
|
||||||
|
U32,
|
||||||
|
ChatListEntry[],
|
||||||
|
Record<U32, ChatListItemFetchResult>,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
FullChat,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
null,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
null,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
string,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
U32[],
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
Message,
|
||||||
|
U32,
|
||||||
|
U32[],
|
||||||
|
Record<U32, Message>,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
Contact,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
string | null,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
null,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
null,
|
||||||
|
U32,
|
||||||
|
Contact[],
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
string | null,
|
||||||
|
U32[],
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
string | null,
|
||||||
|
Contact[],
|
||||||
|
U32,
|
||||||
|
U32[],
|
||||||
|
Record<U32, Contact>,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
Viewtype,
|
||||||
|
Viewtype | null,
|
||||||
|
Viewtype | null,
|
||||||
|
U32[],
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
string,
|
||||||
|
null,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
U32,
|
||||||
|
U32,
|
||||||
|
WebxdcMessageInfo,
|
||||||
|
U32,
|
||||||
|
string,
|
||||||
|
U32,
|
||||||
|
U32
|
||||||
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user