diff src/protocols/yahoo/yahoo_filexfer.c @ 11475:7fab28c991f3

[gaim-migrate @ 13717] merging gaim-doodle/whiteboard/whatever you like to call it. Needs some cleanups and doxygen comments, but has basic functionality committer: Tailor Script <tailor@pidgin.im>
author Gary Kramlich <grim@reaperworld.com>
date Fri, 09 Sep 2005 04:40:21 +0000
parents bd8ac1d4b2f2
children f4e58e94ced3
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo_filexfer.c	Fri Sep 09 04:00:35 2005 +0000
+++ b/src/protocols/yahoo/yahoo_filexfer.c	Fri Sep 09 04:40:21 2005 +0000
@@ -30,6 +30,7 @@
 #include "yahoo.h"
 #include "yahoo_packet.h"
 #include "yahoo_filexfer.h"
+#include "yahoo_doodle.h"
 
 
 
@@ -351,6 +352,64 @@
 	xfer->data = NULL;
 }
 
+void yahoo_process_p2pfilexfer( GaimConnection *gc, struct yahoo_packet *pkt )
+{
+	GSList	*l		= pkt->hash;
+	
+	char	*me 		= NULL;
+	char	*from		= NULL;
+	char	*service	= NULL;
+	char	*message	= NULL;
+	char	*command	= NULL;
+	char	*imv		= NULL;
+	char	*unknown	= NULL;
+	
+	// Get all the necessary values from this new packet
+	while( l )
+	{
+		struct yahoo_pair *pair = l->data;
+		
+		if( pair->key == 5 )		// Get who the packet is for
+			me = pair->value;
+		
+		if( pair->key == 4 )		// Get who the packet is from
+			from = pair->value;
+		
+		if( pair->key == 49 )		// Get the type of service
+			service = pair->value;
+		
+		if( pair->key == 14 )		// Get the 'message' of the packet
+			message = pair->value;
+		
+		if( pair->key == 13 )		// Get the command associated with this packet
+			command = pair->value;
+		
+		if( pair->key == 63 )		// IMVironment name and version
+			imv = pair->value;
+
+		if( pair->key == 64 )		// Not sure, but it does vary with initialization of Doodle
+			unknown = pair->value;	// So, I'll keep it (for a little while atleast)
+		
+		l = l->next;
+	}
+	
+	// If this packet is an IMVIRONMENT, handle it accordingly
+	if( !strcmp( service, "IMVIRONMENT" ) )
+	{
+		// Check for a Doodle packet and handle it accordingly
+		if( !strcmp( imv, "doodle;11" ) )
+			yahoo_doodle_process( gc, me, from, command, message );
+		
+		// If an IMVIRONMENT packet comes without a specific imviroment name
+		if( !strcmp( imv, ";0" ) )
+		{
+			// It is unfortunately time to close all IMVironments with remote client
+			yahoo_doodle_command_got_shutdown( gc, from );
+		}
+			
+	}
+}
+
 void yahoo_process_filetransfer(GaimConnection *gc, struct yahoo_packet *pkt)
 {
 	char *from = NULL;