/soc/2013/ashmew2/filetransferX: d4e73329738e: gtalk_get_tempora...
Ashish Gupta
ashmew2 at gmail.com
Mon Aug 5 20:40:58 EDT 2013
Changeset: d4e73329738e030b7be80b87b0098c75d438a5b2
Author: Ashish Gupta <ashmew2 at gmail.com>
Date: 2013-08-06 06:10 +0530
Branch: filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferX/rev/d4e73329738e
Description:
gtalk_get_temporary_url() added
diffstat:
libpurple/protocols/jabber/google/google_session.c | 37 ++++++++++++++++++++-
1 files changed, 34 insertions(+), 3 deletions(-)
diffs (63 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
@@ -1072,6 +1072,33 @@ gtalk_xfer_send(PurpleConnection *gc, co
}
+char*
+gtalk_get_temporary_url(void)
+{
+/*According to GTalk data, the length of temporary URL must be 44.*/
+ char *temporary_url = g_malloc(45);
+ int i = 11;
+ char *alpha = "abcdefghijklmnopqrstuvwxyz";
+ char *num = "0123456789";
+ srandom(time(NULL));
+
+ strcpy(temporary_url, "/temporary/");
+ for(;i<43;i++) {
+ int j=random()%2;
+
+ if(j==0)
+ temporary_url[i] = alpha[random()%26];
+ else
+ temporary_url[i] = num[random()%10];
+ }
+ temporary_url[i]='/';
+ ++i;
+ temporary_url[i]='\0';
+
+ purple_debug_info("google_session","temporary_url : %s\n",temporary_url);
+ return temporary_url;
+}
+
void gtalk_xfer_session_initiate(PurpleXfer *xfer)
{
GoogleSession *session = xfer->data;
@@ -1121,8 +1148,8 @@ void gtalk_xfer_session_initiate(PurpleX
xmlnode_set_attrib(session_node, "type", "initiate");
xmlnode_set_attrib(session_node, "id", session->id.id);
-/*TODO: Check if initiator attrib is optional*/
-/* xmlnode_set_attrib(session_node, "initiator", me);*/
+
+ xmlnode_set_attrib(session_node, "initiator", me);
xmlnode_set_namespace(session_node, NS_GOOGLE_SESSION);
description_node = xmlnode_new_child(session_node, "description");
@@ -1138,9 +1165,13 @@ void gtalk_xfer_session_initiate(PurpleX
protocol_node = xmlnode_new_child(description_node, "protocol");
http_node = xmlnode_new_child(protocol_node, "http");
url_source_node = xmlnode_new_child(http_node, "url");
+
+ xmlnode_insert_data(url_source_node, gtalk_get_temporary_url(), -1);
url_preview_node = xmlnode_new_child(http_node, "url");
+ xmlnode_insert_data(url_preview_node, gtalk_get_temporary_url(), -1);
+
+ jabber_iq_send(iq);
- /* xmlnode_set_attrib(file_node, "size", FILE_SIZE); */
}
void
More information about the Commits
mailing list