X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=daemon%2Fui.c;h=87818bba7ab3b1155d4e108f61dbe9fe2df0d30f;hb=267c4a93c208c648c2b7a433e525b3608c7d7b01;hp=09a6dcff409f4cdfdb98005bf227d867ae0bd118;hpb=ba86d49ad5c856e4a56ec092ca554d81bee9ab67;p=doldaconnect.git diff --git a/daemon/ui.c b/daemon/ui.c index 09a6dcf..87818bb 100644 --- a/daemon/ui.c +++ b/daemon/ui.c @@ -558,6 +558,7 @@ static void cmd_fnetconnect(struct socket *sk, struct uidata *data, int argc, wc char *buf; int err; struct fnetnode *fn; + struct wcspair *args; haveargs(3); havepriv(PERM_FNETCTL); @@ -566,7 +567,10 @@ static void cmd_fnetconnect(struct socket *sk, struct uidata *data, int argc, wc sq(sk, 0, L"504", L"Could not convert data to locale charset", NULL); return; } - fn = fnetinitconnect(argv[1], buf); + args = NULL; + for(i = 3; i < argc - 1; i += 2) + newwcspair(argv[i], argv[i + 1], &args); + fn = fnetinitconnect(argv[1], buf, args); err = errno; free(buf); if(fn == NULL) @@ -577,11 +581,6 @@ static void cmd_fnetconnect(struct socket *sk, struct uidata *data, int argc, wc sq(sk, 0, L"509", L"Could not parse the address", L"%%s", strerror(err), NULL); return; } - for(i = 3; i < argc - 1; i += 2) - { - if(!wcscmp(argv[i], L"nick")) - fnetsetnick(fn, argv[i + 1]); - } linkfnetnode(fn); fnetsetname(fn, argv[2]); putfnetnode(fn); @@ -745,7 +744,7 @@ static void cmd_download(struct socket *sk, struct uidata *data, int argc, wchar { transfersethash(transfer, parsehash(argv[i + 1])); } else { - transferaddarg(transfer, argv[i], argv[i + 1]); + newwcspair(argv[i], argv[i + 1], &transfer->args); } } } @@ -1164,7 +1163,7 @@ static void cmd_filtercmd(struct socket *sk, struct uidata *data, int argc, wcha static void cmd_lstrarg(struct socket *sk, struct uidata *data, int argc, wchar_t **argv) { struct transfer *transfer; - struct transarg *ta; + struct wcspair *ta; haveargs(2); havepriv(PERM_TRANS); @@ -1183,7 +1182,7 @@ static void cmd_lstrarg(struct socket *sk, struct uidata *data, int argc, wchar_ sq(sk, 0, L"201", L"Transfer has no arguments", NULL); } else { for(ta = transfer->args; ta != NULL; ta = ta->next) - sq(sk, ta->next != NULL, L"200", L"%%ls", ta->rec, L"%%ls", ta->val, NULL); + sq(sk, ta->next != NULL, L"200", L"%%ls", ta->key, L"%%ls", ta->val, NULL); } } @@ -1205,6 +1204,18 @@ static void cmd_hashstatus(struct socket *sk, struct uidata *data, int argc, wch sq(sk, 0, L"200", L"%%i", total, L"tth", L"%%i", hashed, NULL); } +static void cmd_transstatus(struct socket *sk, struct uidata *data, int argc, wchar_t **argv) +{ + wchar_t *buf1, *buf2; + + havepriv(PERM_TRANS); + buf1 = swprintf2(L"%lli", bytesdownload); + buf2 = swprintf2(L"%lli", bytesupload); + sq(sk, 0, L"200", L"%%ls", buf1, L"%%ls", buf2, NULL); + free(buf1); + free(buf2); +} + #undef haveargs #undef havepriv @@ -1240,6 +1251,7 @@ static struct command commands[] = {L"filtercmd", cmd_filtercmd}, {L"lstrarg", cmd_lstrarg}, {L"hashstatus", cmd_hashstatus}, + {L"transstatus", cmd_transstatus}, {NULL, NULL} };