cpw.malu.xmpp.google_ft: 02a1680a: Show the file transfer request, does not...
malu at pidgin.im
malu at pidgin.im
Wed Sep 8 15:51:41 EDT 2010
----------------------------------------------------------------------
Revision: 02a1680a14e01e88dfd14ac2d344869f08d5458f
Parent: 6a2aa59aa13b77a298b91ab76fbdb4981020e31a
Author: malu at pidgin.im
Date: 09/08/10 15:48:23
Branch: im.pidgin.cpw.malu.xmpp.google_ft
URL: http://d.pidgin.im/viewmtn/revision/info/02a1680a14e01e88dfd14ac2d344869f08d5458f
Changelog:
Show the file transfer request, does not yet actually do anything, yet...
Changes against parent 6a2aa59aa13b77a298b91ab76fbdb4981020e31a
patched libpurple/protocols/jabber/google/google_session.c
patched libpurple/protocols/jabber/google/google_share.c
patched libpurple/protocols/jabber/google/google_share.h
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/google/google_session.c 214564f36d3f1cd5efde44fb1e4109ea9665eb76
+++ libpurple/protocols/jabber/google/google_session.c fb4aedbcae1eea6aa47be7c5833961fe7294a09f
@@ -22,6 +22,7 @@
#include "debug.h"
#include "google_session.h"
#include "google_av.h"
+#include "google_share.h"
#include "relay.h"
@@ -65,7 +66,7 @@ google_session_handle_initiate(JabberStr
} else if (purple_strequal(xmlns, NS_GOOGLE_SESSION_VIDEO)) {
google_av_handle_initiate(js, session, TRUE);
} else if (purple_strequal(xmlns, NS_GOOGLE_SESSION_SHARE)) {
- google_share_handle_inititate(js, session);
+ google_share_handle_initiate(js, session, desc_element);
} else {
purple_debug_error("jabber", "Received initiate with "
"invalid namespace %s.\n", xmlns);
============================================================
--- libpurple/protocols/jabber/google/google_share.c f299bfb0c77e438a1c2344cf14b3667b5ee3a56a
+++ libpurple/protocols/jabber/google/google_share.c 6f1676f0e50518b31f3a4a1149e4d32b8a04c81a
@@ -23,13 +23,65 @@
#include "google_share.h"
#include "relay.h"
+#ifdef USE_LIBNICE
+
+#include <nice/agent.h>
+
typedef struct {
PurpleXfer *xfer;
GList *remote_candidates; /* list of PurpleMediaCandidate */
gboolean got_relay; /* this indicates if gotten relay credentials */
-} GoogleAVSessionData;
+} GoogleShareSessionData;
-void google_share_handle_initiate(JabberStream *js, GoogleSession *session)
+static void
+google_share_init(PurpleXfer *xfer)
{
+ /* TODO: implement init here... */
+}
+
+static void
+google_relay_response_share_handle_initiate_cb(GoogleSession *session,
+ const gchar *relay_ip, guint relay_udp, guint relay_tcp, guint relay_ssltcp,
+ const gchar *relay_username, const gchar *relay_password)
+{
+ GoogleShareSessionData *session_data =
+ (GoogleShareSessionData *) session->session_data;
+
+ purple_xfer_request(session_data->xfer);
+}
+
+void google_share_handle_initiate(JabberStream *js, GoogleSession *session,
+ const xmlnode *description)
+{
+ PurpleAccount *account =
+ purple_connection_get_account(js->gc);
+ GoogleShareSessionData *session_data =
+ g_new0(GoogleShareSessionData, 1);
+ const xmlnode *manifest =
+ xmlnode_get_child(description, "manifest");
+ const xmlnode *file =
+ xmlnode_get_child(manifest, "file");
+ guint size = atoi(xmlnode_get_attrib(file, "size"));
+ gchar *name =
+ xmlnode_get_data(xmlnode_get_child(file, "name"));
+
purple_debug_info("google", "got file transfer offer\n");
+ session_data->xfer =
+ purple_xfer_new(account, PURPLE_XFER_RECEIVE,
+ session->remote_jid);
+ purple_xfer_set_filename(session_data->xfer, name);
+ purple_xfer_set_size(session_data->xfer, size);
+ purple_xfer_set_init_fnc(session_data->xfer, google_share_init);
+ session_data->xfer->data = session;
+ session->session_data = session_data;
+
+ if (js->google_relay_host && js->google_relay_token) {
+ jabber_google_do_relay_request(js, session,
+ google_relay_response_share_handle_initiate_cb);
+ } else {
+ google_relay_response_share_handle_initiate_cb(session, NULL,
+ 0, 0, 0, NULL, NULL);
+ }
}
+
+#endif /* USE_LIBNICE */
\ No newline at end of file
============================================================
--- libpurple/protocols/jabber/google/google_share.h 63d30b408970f3f6879e9d6f90bb0d2261310513
+++ libpurple/protocols/jabber/google/google_share.h aadcd40f9bd4ee8001dedd46f5fc10202976349b
@@ -23,6 +23,7 @@
#include "google_session.h"
-void google_share_handle_initiate(JabberStream *js, GoogleSession *session);
+void google_share_handle_initiate(JabberStream *js,
+ GoogleSession *session, const xmlnode *sess);
#endif /* PURPLE_JABBER_GOOGLE_SHARE_H_ */
\ No newline at end of file
More information about the Commits
mailing list