1
0
Fork 0
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:
B. Petersen 2018-04-30 02:16:15 +02:00
parent fd9bc71475
commit f9236479f7
2 changed files with 9 additions and 6 deletions

View file

@ -166,13 +166,15 @@ int main(int argc, char ** argv)
{
mrmailbox_connect(mailbox);
char* qrstr = mrmailbox_get_securejoin_qr(mailbox, arg1? atoi(arg1) : 0);
if( strcmp(cmd, "getbadqr")==0 && strlen(qrstr)>40 ) {
for( int i = 12; i < 22; i++ ) { qrstr[i] = '0'; }
if( qrstr && qrstr[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);
}
else if( strcmp(cmd, "exit")==0 )