/soc/2013/ashmew2/filetransferX: 6bb500950b48: Added GoogleXferS...
Ashish Gupta
ashmew2 at gmail.com
Sun Jul 28 23:31:48 EDT 2013
Changeset: 6bb500950b481981fd5a7e97e24b01130b0a1cf1
Author: Ashish Gupta <ashmew2 at gmail.com>
Date: 2013-07-29 09:01 +0530
Branch: filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferX/rev/6bb500950b48
Description:
Added GoogleXferSessionData struct
diffstat:
libpurple/protocols/jabber/google/google_session.c | 101 ++++++++++++--------
1 files changed, 58 insertions(+), 43 deletions(-)
diffs (128 lines):
diff --git a/libpurple/protocols/jabber/google/google_session.c b/libpurple/protocols/jabber/google/google_session.c
--- a/libpurple/protocols/jabber/google/google_session.c
+++ b/libpurple/protocols/jabber/google/google_session.c
@@ -37,6 +37,18 @@ typedef struct {
to media (ie. after getting relay credentials */
} GoogleAVSessionData;
+/*typedef struct {
+
+ } GoogleShareManifest;
+*/
+
+typedef struct {
+ gchar *filename;
+ guint64 filesize;
+ gchar *preview_url;
+ gchar *source_url;
+} GoogleXferSessionData;
+
static gboolean
google_session_id_equal(gconstpointer a, gconstpointer b)
{
@@ -623,59 +635,62 @@ google_session_handle_initiate(JabberStr
}
}
else {
- purple_debug_info("google_session", "\nTrying to grab protocol\n");
xmlnode *description = xmlnode_get_child(sess, "description");
xmlnode *manifest,*file,*filename,*protocol,*http,*url_source_path,*url_preview_path,*transport;
char *filesize;
+ GoogleXferSessionData *IncomingXfer = g_new0(GoogleXferSessionData, 1);
if( description ) {
- purple_debug_info("google_session", "\ndescription is not NULL");
- manifest = xmlnode_get_child(description, "manifest");
- if( manifest ) {
- purple_debug_info("google_session", "\nmanifest not NULL");
- file = xmlnode_get_child(manifest, "file");
- if( file ) {
- purple_debug_info("google_session", "\nfile is not NULL");
- filename = xmlnode_get_child(file, "name");
- filesize = xmlnode_get_attrib(file, "size");
- purple_debug_info("google_session", "File size : %s",filesize);
+ purple_debug_info("google_session", "\ndescription is not NULL");
+ manifest = xmlnode_get_child(description, "manifest");
+ if( manifest ) {
+ purple_debug_info("google_session", "\nmanifest not NULL");
+ file = xmlnode_get_child(manifest, "file");
+ if( file ) {
+ purple_debug_info("google_session", "\nfile is not NULL");
+ filename = xmlnode_get_child(file, "name");
+ filesize = xmlnode_get_attrib(file, "size");
+ purple_debug_info("google_session", "File size : %s",filesize);
+ IncomingXfer->filesize = g_ascii_strtoull((gchar *)xmlnode_get_attrib(file, "size"),NULL,10);
- if( filename ) {
- purple_debug_info("google_session", "Filename : %s",xmlnode_get_data(filename));
- }
- else
- purple_debug_info("google_session", "Filename is NULL");
- }
- }
- protocol = xmlnode_get_child(description, "protocol");
- if( protocol ) {
- purple_debug_info("google_session", "\nprotocol is not NULL");
- http = xmlnode_get_child(protocol, "http");
- if( http ) {
- purple_debug_info("google_session", "\nhttp is not NULL");
- url_source_path = xmlnode_get_child(http, "url");
- if( url_source_path ) {
- purple_debug_info("google_session", "url_source_path is not NULL. Name : %s",xmlnode_get_data(url_source_path));
- }
- url_preview_path = xmlnode_get_next_twin(url_source_path);
- if(url_preview_path) {
- purple_debug_info("google_session", "url_source_preview is not NULL. Data : %s",xmlnode_get_data(url_preview_path));
- }
- }
- }
-
- transport = xmlnode_get_child(sess, "transport");
- if(transport)
- purple_debug_info("google_session", "\nTransport is not null : %s",xmlnode_get_attrib(transport, "xmlns"));
- else
- purple_debug_info("google_session", "\nTransport is NULL");
+ if( filename ) {
+ purple_debug_info("google_session", "Filename : %s",xmlnode_get_data(filename));
+ IncomingXfer->filename = xmlnode_get_data(filename);
+ }
+ else
+ purple_debug_info("google_session", "Filename is NULL");
+ }
+ }
+ protocol = xmlnode_get_child(description, "protocol");
+ if( protocol ) {
+ purple_debug_info("google_session", "\nprotocol is not NULL");
+ http = xmlnode_get_child(protocol, "http");
+ if( http ) {
+ purple_debug_info("google_session", "\nhttp is not NULL");
+ url_source_path = xmlnode_get_child(http, "url");
+ if( url_source_path ) {
+ purple_debug_info("google_session", "url_source_path is not NULL. Name : %s",xmlnode_get_data(url_source_path));
+ IncomingXfer->source_url = xmlnode_get_data(url_source_path);
+ }
+ url_preview_path = xmlnode_get_next_twin(url_source_path);
+ if(url_preview_path) {
+ purple_debug_info("google_session", "url_source_preview is not NULL. Data : %s",xmlnode_get_data(url_preview_path));
+ IncomingXfer->preview_url = xmlnode_get_data(url_preview_path);
+ }
+ }
+ }
+
+ transport = xmlnode_get_child(sess, "transport");
+ if( transport )
+ purple_debug_info("google_session", "\nTransport is not null : %s",xmlnode_get_attrib(transport, "xmlns"));
+ else
+ purple_debug_info("google_session", "\nTransport is NULL");
}
purple_debug_info("Jabber", "We have received a file request.");
return TRUE;
- }
- return TRUE;
-
+ }
+ return TRUE;
}
static void
More information about the Commits
mailing list