libpurple/protocols/msn/slplink.c

changeset 17089
b27c8579750b
parent 15884
4de1981757fc
child 17133
20a4a4077bba
child 20495
70a3c417091a
equal deleted inserted replaced
17088:1ecea6e2fd97 17089:b27c8579750b
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)

mercurial