comparison src/protocols/jabber/si.c @ 12143:cbebda5f019c

[gaim-migrate @ 14444] SF Patch #1360399 from Evan Schoenberg (evands) "I discussed this previously with Mark and he said it'd be fine. This factors out the part of the send_file function which creates a new GaimXfer into a separate prpl function, new_xfer. It's called in each of the existing send_file functions. This is needed so that another client (okay, Adium) can get a new outgoing GaimXfer from a prpl without depending upon the specific ft.c logic of send_file; previously I was adding a duplicate method to each prpl and then calling it directly." I fixed a couple small bugs in this. Otherwise, it looks good, and seems like a reasonable libgaim request. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sat, 19 Nov 2005 00:26:12 +0000
parents f9c5480ad0ce
children d5b8f4dc1622
comparison
equal deleted inserted replaced
12142:0c672be21798 12143:cbebda5f019c
653 653
654 jabber_iq_send(iq); 654 jabber_iq_send(iq);
655 } 655 }
656 } 656 }
657 657
658 void jabber_si_xfer_send(GaimConnection *gc, const char *who, const char *file) 658 GaimXfer *jabber_si_new_xfer(GaimConnection *gc, const char *who)
659 { 659 {
660 JabberStream *js; 660 JabberStream *js;
661 661
662 GaimXfer *xfer; 662 GaimXfer *xfer;
663 JabberSIXfer *jsx; 663 JabberSIXfer *jsx;
664 664
665 js = gc->proto_data; 665 js = gc->proto_data;
666
667 if(!gaim_find_buddy(gc->account, who) || !jabber_buddy_find(js, who, FALSE))
668 return;
669 666
670 xfer = gaim_xfer_new(gc->account, GAIM_XFER_SEND, who); 667 xfer = gaim_xfer_new(gc->account, GAIM_XFER_SEND, who);
671 668
672 xfer->data = jsx = g_new0(JabberSIXfer, 1); 669 xfer->data = jsx = g_new0(JabberSIXfer, 1);
673 jsx->js = js; 670 jsx->js = js;
674 671
675 gaim_xfer_set_init_fnc(xfer, jabber_si_xfer_init); 672 gaim_xfer_set_init_fnc(xfer, jabber_si_xfer_init);
676 gaim_xfer_set_cancel_send_fnc(xfer, jabber_si_xfer_cancel_send); 673 gaim_xfer_set_cancel_send_fnc(xfer, jabber_si_xfer_cancel_send);
677 gaim_xfer_set_end_fnc(xfer, jabber_si_xfer_end); 674 gaim_xfer_set_end_fnc(xfer, jabber_si_xfer_end);
678 675
679 js->file_transfers = g_list_append(js->file_transfers, xfer); 676 js->file_transfers = g_list_append(js->file_transfers, xfer);
677
678 return xfer;
679 }
680
681 void jabber_si_xfer_send(GaimConnection *gc, const char *who, const char *file)
682 {
683 JabberStream *js;
684
685 GaimXfer *xfer;
686
687 js = gc->proto_data;
688
689 if(!gaim_find_buddy(gc->account, who) || !jabber_buddy_find(js, who, FALSE))
690 return;
691
692 xfer = jabber_si_new_xfer(gc, who);
680 693
681 if (file) 694 if (file)
682 gaim_xfer_request_accepted(xfer, file); 695 gaim_xfer_request_accepted(xfer, file);
683 else 696 else
684 gaim_xfer_request(xfer); 697 gaim_xfer_request(xfer);