mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-06 03:50:08 +02:00
cli checks for qr code generation errors
This commit is contained in:
parent
fd9bc71475
commit
f9236479f7
2 changed files with 9 additions and 6 deletions
|
@ -1224,6 +1224,7 @@ char* mrmailbox_cmdline(mrmailbox_t* mailbox, const char* cmdline)
|
||||||
else if( strcmp(cmd, "getqr")==0 )
|
else if( strcmp(cmd, "getqr")==0 )
|
||||||
{
|
{
|
||||||
ret = mrmailbox_get_securejoin_qr(mailbox, arg1? atoi(arg1) : 0);
|
ret = mrmailbox_get_securejoin_qr(mailbox, arg1? atoi(arg1) : 0);
|
||||||
|
if( ret == NULL || ret[0]==0 ) { free(ret); ret = COMMAND_FAILED; }
|
||||||
}
|
}
|
||||||
else if( strcmp(cmd, "checkqr")==0 )
|
else if( strcmp(cmd, "checkqr")==0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -166,13 +166,15 @@ int main(int argc, char ** argv)
|
||||||
{
|
{
|
||||||
mrmailbox_connect(mailbox);
|
mrmailbox_connect(mailbox);
|
||||||
char* qrstr = mrmailbox_get_securejoin_qr(mailbox, arg1? atoi(arg1) : 0);
|
char* qrstr = mrmailbox_get_securejoin_qr(mailbox, arg1? atoi(arg1) : 0);
|
||||||
if( strcmp(cmd, "getbadqr")==0 && strlen(qrstr)>40 ) {
|
if( qrstr && qrstr[0] ) {
|
||||||
for( int i = 12; i < 22; i++ ) { qrstr[i] = '0'; }
|
if( strcmp(cmd, "getbadqr")==0 && strlen(qrstr)>40 ) {
|
||||||
|
for( int i = 12; i < 22; i++ ) { qrstr[i] = '0'; }
|
||||||
|
}
|
||||||
|
printf("%s\n", qrstr);
|
||||||
|
char* syscmd = mr_mprintf("qrencode -t ansiutf8 \"%s\" -o -", qrstr); /* `-t ansiutf8`=use back/write, `-t utf8`=use terminal colors */
|
||||||
|
system(syscmd);
|
||||||
|
free(syscmd);
|
||||||
}
|
}
|
||||||
printf("%s\n", qrstr);
|
|
||||||
char* syscmd = mr_mprintf("qrencode -t ansiutf8 \"%s\" -o -", qrstr); /* `-t ansiutf8`=use back/write, `-t utf8`=use terminal colors */
|
|
||||||
system(syscmd);
|
|
||||||
free(syscmd);
|
|
||||||
free(qrstr);
|
free(qrstr);
|
||||||
}
|
}
|
||||||
else if( strcmp(cmd, "exit")==0 )
|
else if( strcmp(cmd, "exit")==0 )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue