Mercurial > pidgin
comparison libpurple/protocols/jabber/si.c @ 26465:ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Fri, 13 Mar 2009 02:26:45 +0000 |
parents | 439f07ce4c8a |
children | 2d781c58a8a2 |
comparison
equal
deleted
inserted
replaced
26464:a4a5825fb1bb | 26465:ae41d8e827e3 |
---|---|
681 xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, | 681 xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, |
682 jabber_si_xfer_bytestreams_send_read_cb, xfer); | 682 jabber_si_xfer_bytestreams_send_read_cb, xfer); |
683 } | 683 } |
684 | 684 |
685 static void | 685 static void |
686 jabber_si_connect_proxy_cb(JabberStream *js, xmlnode *packet, | 686 jabber_si_connect_proxy_cb(JabberStream *js, const char *from, |
687 gpointer data) | 687 JabberIqType type, const char *id, |
688 xmlnode *packet, gpointer data) | |
688 { | 689 { |
689 PurpleXfer *xfer = data; | 690 PurpleXfer *xfer = data; |
690 JabberSIXfer *jsx; | 691 JabberSIXfer *jsx; |
691 xmlnode *query, *streamhost_used; | 692 xmlnode *query, *streamhost_used; |
692 const char *from, *type, *jid; | 693 const char *jid; |
693 GList *matched; | 694 GList *matched; |
694 | 695 |
695 /* TODO: This need to send errors if we don't see what we're looking for */ | 696 /* TODO: This need to send errors if we don't see what we're looking for */ |
696 | 697 |
697 /* Make sure that the xfer is actually still valid and we're not just receiving an old iq response */ | 698 /* Make sure that the xfer is actually still valid and we're not just receiving an old iq response */ |
704 if(!xfer->data) | 705 if(!xfer->data) |
705 return; | 706 return; |
706 | 707 |
707 jsx = xfer->data; | 708 jsx = xfer->data; |
708 | 709 |
709 if(!(type = xmlnode_get_attrib(packet, "type")) || strcmp(type, "result")) { | 710 if(type != JABBER_IQ_RESULT) { |
710 purple_debug_info("jabber", | 711 purple_debug_info("jabber", |
711 "jabber_si_xfer_connect_proxy_cb: type = %s\n", | 712 "jabber_si_xfer_connect_proxy_cb: type = error\n"); |
712 type); | 713 /* if IBB is available, open IBB session */ |
713 if (type && !strcmp(type, "error")) { | 714 purple_debug_info("jabber", |
714 /* if IBB is available, open IBB session */ | 715 "jabber_si_xfer_connect_proxy_cb: got error, method: %d\n", |
715 purple_debug_info("jabber", | 716 jsx->stream_method); |
716 "jabber_si_xfer_connect_proxy_cb: got error, method: %d\n", | 717 if (jsx->stream_method & STREAM_METHOD_IBB) { |
717 jsx->stream_method); | 718 purple_debug_info("jabber", "IBB is possible, try it\n"); |
718 if (jsx->stream_method & STREAM_METHOD_IBB) { | 719 /* if we are the sender and haven't already opened an IBB |
719 purple_debug_info("jabber", "IBB is possible, try it\n"); | 720 session, do so now (we might already have failed to open |
720 /* if we are the sender and haven't already opened an IBB | 721 the bytestream proxy ourselves when receiving this <iq/> */ |
721 session, do so now (we might already have failed to open | 722 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND |
722 the bytestream proxy ourselves when receiving this <iq/> */ | 723 && !jsx->ibb_session) { |
723 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND | 724 jabber_si_xfer_ibb_send_init(js, xfer); |
724 && !jsx->ibb_session) { | |
725 jabber_si_xfer_ibb_send_init(js, xfer); | |
726 } else { | |
727 jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, | |
728 jabber_si_bytestreams_ibb_timeout_cb, xfer); | |
729 } | |
730 /* if we are receiver, just wait for IBB open stanza, callback | |
731 is already set up */ | |
732 } else { | 725 } else { |
733 purple_xfer_cancel_remote(xfer); | 726 jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, |
727 jabber_si_bytestreams_ibb_timeout_cb, xfer); | |
734 } | 728 } |
735 } | 729 /* if we are receiver, just wait for IBB open stanza, callback |
736 return; | 730 is already set up */ |
737 } | 731 } else { |
738 | 732 purple_xfer_cancel_remote(xfer); |
739 if(!(from = xmlnode_get_attrib(packet, "from"))) | 733 } |
734 return; | |
735 } | |
736 | |
737 if (!from) | |
740 return; | 738 return; |
741 | 739 |
742 if(!(query = xmlnode_get_child(packet, "query"))) | 740 if(!(query = xmlnode_get_child(packet, "query"))) |
743 return; | 741 return; |
744 | 742 |
1178 "failed to initiate IBB session for file transfer\n"); | 1176 "failed to initiate IBB session for file transfer\n"); |
1179 purple_xfer_cancel_local(xfer); | 1177 purple_xfer_cancel_local(xfer); |
1180 } | 1178 } |
1181 } | 1179 } |
1182 | 1180 |
1183 static void jabber_si_xfer_send_method_cb(JabberStream *js, xmlnode *packet, | 1181 static void jabber_si_xfer_send_method_cb(JabberStream *js, const char *from, |
1184 gpointer data) | 1182 JabberIqType type, const char *id, |
1183 xmlnode *packet, gpointer data) | |
1185 { | 1184 { |
1186 PurpleXfer *xfer = data; | 1185 PurpleXfer *xfer = data; |
1187 xmlnode *si, *feature, *x, *field, *value; | 1186 xmlnode *si, *feature, *x, *field, *value; |
1188 gboolean found_method = FALSE; | 1187 gboolean found_method = FALSE; |
1189 | 1188 |