Mercurial > pidgin.yaz
comparison libgaim/ft.c @ 15261:5176a9f30ba3
[gaim-migrate @ 18050]
AIM/ICQ file transfer pausing an resuming. This should work, but
could use a little more testing. It's a patch from Graham Booker
with modifcations by me. Blame me if I broke file transfer for
anything.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 23 Dec 2006 19:32:10 +0000 |
parents | ec96d6d2fa6d |
children |
comparison
equal
deleted
inserted
replaced
15260:c7acd154bcb3 | 15261:5176a9f30ba3 |
---|---|
696 void | 696 void |
697 gaim_xfer_set_size(GaimXfer *xfer, size_t size) | 697 gaim_xfer_set_size(GaimXfer *xfer, size_t size) |
698 { | 698 { |
699 g_return_if_fail(xfer != NULL); | 699 g_return_if_fail(xfer != NULL); |
700 | 700 |
701 if (xfer->size == 0) | |
702 xfer->bytes_remaining = size - xfer->bytes_sent; | |
703 | |
704 xfer->size = size; | 701 xfer->size = size; |
702 xfer->bytes_remaining = xfer->size - gaim_xfer_get_bytes_sent(xfer); | |
703 } | |
704 | |
705 void | |
706 gaim_xfer_set_bytes_sent(GaimXfer *xfer, size_t bytes_sent) | |
707 { | |
708 g_return_if_fail(xfer != NULL); | |
709 | |
710 xfer->bytes_sent = bytes_sent; | |
711 xfer->bytes_remaining = gaim_xfer_get_size(xfer) - bytes_sent; | |
705 } | 712 } |
706 | 713 |
707 GaimXferUiOps * | 714 GaimXferUiOps * |
708 gaim_xfer_get_ui_ops(const GaimXfer *xfer) | 715 gaim_xfer_get_ui_ops(const GaimXfer *xfer) |
709 { | 716 { |
946 gaim_xfer_show_file_error(xfer, gaim_xfer_get_local_filename(xfer)); | 953 gaim_xfer_show_file_error(xfer, gaim_xfer_get_local_filename(xfer)); |
947 gaim_xfer_cancel_local(xfer); | 954 gaim_xfer_cancel_local(xfer); |
948 return; | 955 return; |
949 } | 956 } |
950 | 957 |
958 fseek(xfer->dest_fp, xfer->bytes_sent, SEEK_SET); | |
959 | |
951 xfer->watcher = gaim_input_add(xfer->fd, cond, transfer_cb, xfer); | 960 xfer->watcher = gaim_input_add(xfer->fd, cond, transfer_cb, xfer); |
952 | 961 |
953 xfer->start_time = time(NULL); | 962 xfer->start_time = time(NULL); |
954 | 963 |
955 if (xfer->ops.start != NULL) | 964 if (xfer->ops.start != NULL) |
975 | 984 |
976 g_return_if_fail(xfer != NULL); | 985 g_return_if_fail(xfer != NULL); |
977 g_return_if_fail(gaim_xfer_get_type(xfer) != GAIM_XFER_UNKNOWN); | 986 g_return_if_fail(gaim_xfer_get_type(xfer) != GAIM_XFER_UNKNOWN); |
978 | 987 |
979 type = gaim_xfer_get_type(xfer); | 988 type = gaim_xfer_get_type(xfer); |
980 | |
981 xfer->bytes_remaining = gaim_xfer_get_size(xfer); | |
982 xfer->bytes_sent = 0; | |
983 | 989 |
984 gaim_xfer_set_status(xfer, GAIM_XFER_STATUS_STARTED); | 990 gaim_xfer_set_status(xfer, GAIM_XFER_STATUS_STARTED); |
985 | 991 |
986 if (type == GAIM_XFER_RECEIVE) { | 992 if (type == GAIM_XFER_RECEIVE) { |
987 cond = GAIM_INPUT_READ; | 993 cond = GAIM_INPUT_READ; |