comparison libpurple/protocols/msn/slplink.c @ 17065:21830d70709b

Patch from sourceforge tracker 1652005 from wabz to fix displaying file transfer progress for MSN transfers. Fixes #595.
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 12 May 2007 13:20:04 +0000
parents 32c366eeeb99
children acde78931954 522f618a44b4
comparison
equal deleted inserted replaced
17055:53e757c37e06 17065:21830d70709b
480 static void 480 static void
481 send_file_cb(MsnSlpSession *slpsession) 481 send_file_cb(MsnSlpSession *slpsession)
482 { 482 {
483 MsnSlpCall *slpcall; 483 MsnSlpCall *slpcall;
484 MsnSlpMessage *slpmsg; 484 MsnSlpMessage *slpmsg;
485 struct stat st;
486 PurpleXfer *xfer;
485 487
486 slpcall = slpsession->slpcall; 488 slpcall = slpsession->slpcall;
487 slpmsg = msn_slpmsg_new(slpcall->slplink); 489 slpmsg = msn_slpmsg_new(slpcall->slplink);
488 slpmsg->slpcall = slpcall; 490 slpmsg->slpcall = slpcall;
489 slpmsg->flags = 0x1000030; 491 slpmsg->flags = 0x1000030;
490 slpmsg->slpsession = slpsession; 492 slpmsg->slpsession = slpsession;
491 #ifdef MSN_DEBUG_SLP 493 #ifdef MSN_DEBUG_SLP
492 slpmsg->info = "SLP FILE"; 494 slpmsg->info = "SLP FILE";
493 #endif 495 #endif
494 msn_slpmsg_open_file(slpmsg, purple_xfer_get_local_filename(slpcall->xfer)); 496 xfer = (PurpleXfer *)slpcall->xfer;
497 purple_xfer_start(slpcall->xfer, 0, NULL, 0);
498 slpmsg->fp = xfer->dest_fp;
499 if (g_stat(purple_xfer_get_local_filename(xfer), &st) == 0)
500 slpmsg->size = st.st_size;
501 xfer->dest_fp = NULL; /* Disable double fclose() */
495 502
496 msn_slplink_send_slpmsg(slpcall->slplink, slpmsg); 503 msn_slplink_send_slpmsg(slpcall->slplink, slpmsg);
497 } 504 }
498 505
499 void 506 void
549 556
550 xfer = slpmsg->slpcall->xfer; 557 xfer = slpmsg->slpcall->xfer;
551 558
552 if (xfer != NULL) 559 if (xfer != NULL)
553 { 560 {
554 slpmsg->fp = 561 purple_xfer_start(slpmsg->slpcall->xfer,
555 g_fopen(purple_xfer_get_local_filename(slpmsg->slpcall->xfer), 562 0, NULL, 0);
556 "wb"); 563 slpmsg->fp = ((PurpleXfer *)slpmsg->slpcall->xfer)->dest_fp;
564 xfer->dest_fp = NULL; /* Disable double fclose() */
557 } 565 }
558 } 566 }
559 } 567 }
560 } 568 }
561 if (!slpmsg->fp && slpmsg->size) 569 if (!slpmsg->fp && slpmsg->size)