diff -c ../orig/hxd-0.1.38/./hotline.h ./hotline.h *** ../orig/hxd-0.1.38/./hotline.h Wed Jul 12 03:27:10 2000 --- ./hotline.h Mon Feb 26 00:20:08 2001 *************** *** 264,269 **** --- 264,270 ---- #define HTLS_HDR_CHAT_USER_CHANGE ((u_int32_t) 0x00000075) #define HTLS_HDR_CHAT_USER_PART ((u_int32_t) 0x00000076) #define HTLS_HDR_CHAT_SUBJECT ((u_int32_t) 0x00000077) + #define HTLS_HDR_QUEUEUPDATE ((u_int32_t) 0x000000d3) #define HTLS_HDR_USER_CHANGE ((u_int32_t) 0x0000012d) #define HTLS_HDR_USER_PART ((u_int32_t) 0x0000012e) #define HTLS_HDR_USER_SELFINFO ((u_int32_t) 0x00000162) *************** *** 288,293 **** --- 289,295 ---- #define HTLS_DATA_COLOUR ((u_int16_t) 0x0070) #define HTLS_DATA_CHAT_ID ((u_int16_t) 0x0072) #define HTLS_DATA_CHAT_SUBJECT ((u_int16_t) 0x0073) + #define HTLS_DATA_QUEUE_POSITION ((u_int16_t) 0x0074) #define HTLS_DATA_FILE_LIST ((u_int16_t) 0x00c8) #define HTLS_DATA_FILE_NAME ((u_int16_t) 0x00c9) #define HTLS_DATA_RFLT ((u_int16_t) 0x00cb) diff -c ../orig/hxd-0.1.38/./hx_commands.c ./hx_commands.c *** ../orig/hxd-0.1.38/./hx_commands.c Wed Feb 14 01:47:42 2001 --- ./hx_commands.c Mon Feb 26 21:00:48 2001 *************** *** 589,594 **** --- 589,598 ---- close(fd); } + // poorly placed prototype + static void + hx_rcv_queueupdate (struct htlc_conn *htlc); + static void hx_rcv_hdr (struct htlc_conn *htlc) { *************** *** 651,656 **** --- 655,663 ---- hx_printf_prefix(htlc, 0, INFOPREFIX, "polite quit\n"); htlc->rcv = hx_rcv_msg; break; + case HTLS_HDR_QUEUEUPDATE: + htlc->rcv = hx_rcv_queueupdate; + break; default: hx_printf_prefix(htlc, 0, INFOPREFIX, "unknown header type 0x%08x\n", type); *************** *** 3764,3769 **** --- 3771,3799 ---- static void rcv_task_file_get (struct htlc_conn *htlc, struct htxf_conn *htxf); static void rcv_task_file_put (struct htlc_conn *htlc, struct htxf_conn *htxf); + static void + hx_rcv_queueupdate (struct htlc_conn *htlc) + { + u_int32_t tmpint; + int i; + + dh_start(htlc) + dh_getint(tmpint); + switch (dh_type) { + case HTLS_DATA_HTXF_REF: + htlc->tmpref = tmpint; + break; + case HTLS_DATA_QUEUE_POSITION: + for (i=0; i < nxfers; i++) + if (xfers[i]->ref == htlc->tmpref) { + xfers[i]->queue_position = tmpint; + hx_printf_prefix(htlc, 0, INFOPREFIX, "queue position for '%s' changed to %d\n", xfers[i]->path, tmpint); + } + break; + } + dh_end() + } + void xfer_go (struct htxf_conn *htxf) { *************** *** 4058,4064 **** char humanbuf[LONGEST_HUMAN_READABLE*3+3], *posstr, *sizestr, *bpsstr; hx_output.mode_underline(); ! hx_printf(htlc, chat, " # type pid file\n"); hx_output.mode_clear(); LOCK_HTXF(&hx_htlc); for (i = 0; i < nxfers; i++) { --- 4088,4094 ---- char humanbuf[LONGEST_HUMAN_READABLE*3+3], *posstr, *sizestr, *bpsstr; hx_output.mode_underline(); ! hx_printf(htlc, chat, " # type pid queue file\n"); hx_output.mode_clear(); LOCK_HTXF(&hx_htlc); for (i = 0; i < nxfers; i++) { *************** *** 4086,4098 **** bpsstr = human_size(Bps, humanbuf+LONGEST_HUMAN_READABLE*2+2); eta = (htxfp->total_size - htxfp->total_pos) / Bps + ((htxfp->total_size - htxfp->total_pos) % Bps) / Bps; ! hx_printf(htlc, chat, "[%d] %s %5u %s/%s %s/s ETA: %lu s %s\n", i, htxfp->type == XFER_GET ? "get" : "put", #if defined(CONFIG_HTXF_PTHREAD) htxfp->tid, #else htxfp->pid, #endif posstr, sizestr, bpsstr, eta, htxfp->path); } UNLOCK_HTXF(&hx_htlc); --- 4116,4129 ---- bpsstr = human_size(Bps, humanbuf+LONGEST_HUMAN_READABLE*2+2); eta = (htxfp->total_size - htxfp->total_pos) / Bps + ((htxfp->total_size - htxfp->total_pos) % Bps) / Bps; ! hx_printf(htlc, chat, "[%d] %s %5u %5d %s/%s %s/s ETA: %lu s %s\n", i, htxfp->type == XFER_GET ? "get" : "put", #if defined(CONFIG_HTXF_PTHREAD) htxfp->tid, #else htxfp->pid, #endif + htxfp->queue_position, posstr, sizestr, bpsstr, eta, htxfp->path); } UNLOCK_HTXF(&hx_htlc); *************** *** 4582,4587 **** --- 4613,4619 ---- rcv_task_file_get (struct htlc_conn *htlc, struct htxf_conn *htxf) { u_int32_t ref = 0, size = 0; + u_int16_t queue_position = 0; struct hl_hdr *h = (struct hl_hdr *)htlc->in.buf; int i; *************** *** 4612,4623 **** --- 4644,4666 ---- case HTLS_DATA_HTXF_REF: dh_getint(ref); break; + case HTLS_DATA_QUEUE_POSITION: + dh_getint(queue_position); + break; } dh_end() if (!size || !ref) return; hx_printf_prefix(htlc, 0, INFOPREFIX, "get: %s; %u bytes\n", htxf->path, size, ref); + + if (queue_position > 0) + hx_printf_prefix(htlc, 0, INFOPREFIX, "queue position for '%s' is %d\n",htxf->path,queue_position); + else + hx_printf_prefix(htlc, 0, INFOPREFIX, "'%s' can begin immediately\n",htxf->path); + + htxf->queue_position = queue_position; + htxf->ref = ref; htxf->total_size = size; gettimeofday(&htxf->start, 0); diff -c ../orig/hxd-0.1.38/./hxd.h ./hxd.h *** ../orig/hxd-0.1.38/./hxd.h Thu Feb 8 21:35:25 2001 --- ./hxd.h Sun Feb 25 23:01:39 2001 *************** *** 197,202 **** --- 197,203 ---- u_int16_t preview; u_int8_t gone; u_int8_t type; + u_int16_t queue_position; #if defined(CONFIG_HTXF_PTHREAD) pthread_t tid; #else *************** *** 315,320 **** --- 316,322 ---- u_int32_t news_len; u_int8_t *news_buf; #endif + u_int32_t tmpref; }; #if defined(CONFIG_NOSPAM)