Mercurial > pidgin
diff src/protocols/jabber/buddy.c @ 7395:b250288fa948
[gaim-migrate @ 7990]
this would be the non-working start of file transfer (the real way) for jabber
also approximately eleventy billion jabber tweaks
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Fri, 31 Oct 2003 02:43:58 +0000 |
parents | 7c12dab8e513 |
children | 85cd2e71bff7 |
line wrap: on
line diff
--- a/src/protocols/jabber/buddy.c Fri Oct 31 01:38:46 2003 +0000 +++ b/src/protocols/jabber/buddy.c Fri Oct 31 02:43:58 2003 +0000 @@ -25,13 +25,14 @@ #include "notify.h" #include "request.h" #include "util.h" +#include "xmlnode.h" #include "buddy.h" #include "chat.h" #include "jabber.h" #include "iq.h" #include "presence.h" -#include "xmlnode.h" +#include "si.h" void jabber_buddy_free(JabberBuddy *jb) @@ -530,7 +531,7 @@ ******/ -static void jabber_vcard_parse(JabberStream *js, xmlnode *packet) +static void jabber_vcard_parse(JabberStream *js, xmlnode *packet, gpointer data) { GList *resources; const char *from = xmlnode_get_attrib(packet, "from"); @@ -789,7 +790,7 @@ vcard = xmlnode_new_child(iq->node, "vCard"); xmlnode_set_attrib(vcard, "xmlns", "vcard-temp"); - jabber_iq_set_callback(iq, jabber_vcard_parse); + jabber_iq_set_callback(iq, jabber_vcard_parse, NULL); jabber_iq_send(iq); } @@ -809,6 +810,31 @@ g_free(full_jid); } + + +static void jabber_buddy_ask_send_file(GaimConnection *gc, const char *name) +{ + JabberStream *js = gc->proto_data; + GaimXfer *xfer; + JabberSIXfer *jsx; + + xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, name); + + xfer->data = jsx = g_new0(JabberSIXfer, 1); + jsx->js = js; + + gaim_xfer_set_init_fnc(xfer, jabber_si_xfer_init); + gaim_xfer_set_start_fnc(xfer, jabber_si_xfer_start); + gaim_xfer_set_end_fnc(xfer, jabber_si_xfer_end); + gaim_xfer_set_cancel_send_fnc(xfer, jabber_si_xfer_cancel_send); + gaim_xfer_set_cancel_recv_fnc(xfer, jabber_si_xfer_cancel_recv); + gaim_xfer_set_ack_fnc(xfer, jabber_si_xfer_ack); + + js->file_transfers = g_list_append(js->file_transfers, xfer); + + gaim_xfer_request(xfer); +} + static void jabber_buddy_set_invisibility(JabberStream *js, const char *who, gboolean invisible) { @@ -869,6 +895,25 @@ struct proto_buddy_menu *pbm; JabberStream *js = gc->proto_data; JabberBuddy *jb = jabber_buddy_find(js, name, TRUE); + GList *resources; + gboolean has_file_xfer = FALSE; + + if(!jb) + return m; + + for(resources = jb->resources; resources; resources = resources->next) { + JabberBuddyResource *jbr = resources->data; + if(jbr->capabilities & JABBER_CAP_SI_FILE_XFER) + has_file_xfer = TRUE; + } + + if(has_file_xfer) { + pbm = g_new0(struct proto_buddy_menu, 1); + pbm->label = _("Send File"); + pbm->callback = jabber_buddy_ask_send_file; + pbm->gc = gc; + m = g_list_append(m, pbm); + } pbm = g_new0(struct proto_buddy_menu, 1); if(jb->invisible & JABBER_INVIS_BUDDY) {