changeset 196:3042e11c1902

[gaim-migrate @ 206] Figured out some UUID's, and prepared for their eventual implementation. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 30 Apr 2000 00:34:14 +0000
parents a82e9f91a6fc
children 24f0fef56a73
files ChangeLog gaim.spec src/dialogs.c src/gaim.h src/toc.c
diffstat 5 files changed, 65 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Apr 29 23:30:52 2000 +0000
+++ b/ChangeLog	Sun Apr 30 00:34:14 2000 +0000
@@ -4,6 +4,7 @@
 	* Plugin support enabled by default (oops)
 	* Some plugins built/installed by default
 	* Option to automagically check for new releases
+	* Ability to receive files (one-way file transfer)
 
 version 0.9.14:
 	* Numerous Fixes by G. Sumner Hayes (buffer over flow patches,
--- a/gaim.spec	Sat Apr 29 23:30:52 2000 +0000
+++ b/gaim.spec	Sun Apr 30 00:34:14 2000 +0000
@@ -31,7 +31,7 @@
 %setup
 
 %build
-CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --enable-plugins
+CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix}
 make
 
 %install
--- a/src/dialogs.c	Sat Apr 29 23:30:52 2000 +0000
+++ b/src/dialogs.c	Sun Apr 30 00:34:14 2000 +0000
@@ -2207,7 +2207,7 @@
 		return;
 	}
 	
-	g_snprintf(send, 255, "toc_rvous_cancel %s %s %s", ft->user, ft->cookie, FILETRANS_UID);
+	g_snprintf(send, 255, "toc_rvous_cancel %s %s %s", ft->user, ft->cookie, FILE_GET_UID);
 	sflap_send(send, strlen(send), TYPE_DATA);
 	g_free(send);
 	destroy_dialog(NULL, ft->window);
@@ -2296,7 +2296,7 @@
 	ft->accepted = 1;
 	
 	destroy_dialog(NULL, ft->window);
-	g_snprintf(send, 255, "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILETRANS_UID);
+	g_snprintf(send, 255, "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILE_GET_UID);
 	sflap_send(send, strlen(send), TYPE_DATA);
 	g_free(send);
 
@@ -2420,7 +2420,6 @@
 			gtk_main_iteration();
 	}
 
-	gtk_widget_destroy(fw);
 	fclose(ft->f);
 	memset(header + 18, 0, 4);
 	header[94] = 0;
@@ -2433,6 +2432,7 @@
 
 	g_free(buf);
 	g_free(header);
+	gtk_widget_destroy(fw);
 }
 
 
--- a/src/gaim.h	Sat Apr 29 23:30:52 2000 +0000
+++ b/src/gaim.h	Sun Apr 30 00:34:14 2000 +0000
@@ -268,7 +268,11 @@
 #define CONVERSATION_TITLE "Gaim - Conversation with %s"
 #define LOG_CONVERSATION_TITLE "Gaim - Conversation with %s (logged)"
 
-#define FILETRANS_UID "09461343-4C7F-11D1-8222-444553540000"
+#define VOICE_UID     "09461341-4C7F-11D1-8222-444553540000"
+#define FILE_GET_UID  "09461343-4C7F-11D1-8222-444553540000"
+#define IMAGE_UID     "09461345-4C7F-11D1-8222-444553540000"
+#define B_ICON_UID    "09461346-4C7F-11D1-8222-444553540000"
+#define FILE_SEND_UID "09461348-4C7F-11D1-8222-444553540000"
 
 #define LAGOMETER_STR "123CHECKLAG456"
 
@@ -296,7 +300,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 190 $"
+#define REVISION "gaim:$Revision: 206 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
--- a/src/toc.c	Sat Apr 29 23:30:52 2000 +0000
+++ b/src/toc.c	Sun Apr 30 00:34:14 2000 +0000
@@ -172,8 +172,8 @@
 	g_snprintf(buf2, sizeof(buf2), "toc_init_done");
 	sflap_send(buf2, -1, TYPE_DATA);
 
-	g_snprintf(buf2, sizeof(buf2), "toc_set_caps %s",
-		   FILETRANS_UID);
+	g_snprintf(buf2, sizeof(buf2), "toc_set_caps %s %s",
+		   FILE_SEND_UID, FILE_GET_UID);
 	sflap_send(buf2, -1, TYPE_DATA);
 
         serv_finish_login();
@@ -580,7 +580,6 @@
 
 
         } else if (!strcasecmp(c, "RVOUS_PROPOSE")) {
-                /* File trans.  Yummy. */
                 char *user;
                 char *uuid;
                 char *cookie;
@@ -614,46 +613,61 @@
                 
                 tmp = frombase64(strtok(NULL, ":"));
 
-                subtype = tmp[1];
-                files = tmp[3]; /* These are fine */
+		if (!strcmp(uuid, FILE_GET_UID)) {
+			/* we're getting a file */
+	                subtype = tmp[1];
+	                files = tmp[3]; /* These are fine */
+
+			totalsize = 0;
+			totalsize |= (tmp[4] << 24) & 0xff000000;
+			totalsize |= (tmp[5] << 16) & 0x00ff0000;
+			totalsize |= (tmp[6] <<  8) & 0x0000ff00;
+			totalsize |= (tmp[7] <<  0) & 0x000000ff;
+
+	                name = tmp + 8;
 
-		temp = tmp[4];
-		temp <<= 24;
-		temp &= 0xff000000;
-		totalsize = temp;
-		temp = tmp[5];
-		temp <<= 16;
-		temp &= 0x00ff0000;
-		totalsize |= temp;
-		temp = tmp[6];
-		temp <<= 8;
-		temp &= 0x0000ff00;
-		totalsize |= temp;
-		temp = tmp[7];
-		temp &= 0x000000ff;
-		totalsize |= temp;
+	                ft = g_new0(struct file_transfer, 1);
+
+	                ft->cookie = frombase64(cookie);
+	                ft->ip = g_strdup(pip);
+	                ft->port = port;
+	                if (i)
+	                        ft->message = g_strdup(messages[0]);
+	                else
+	                        ft->message = NULL;
+	                ft->filename = g_strdup(name);
+	                ft->user = g_strdup(user);
+	                ft->size = totalsize;
+                
+	                g_free(tmp);
 
-                name = tmp + 8;
-
-                ft = g_new0(struct file_transfer, 1);
+	                for (i--; i >= 0; i--)
+	                        g_free(messages[i]);
+                
+	                accept_file_dialog(ft);
+		} else if (!strcmp(uuid, FILE_SEND_UID)) {
+			/* we're sending a file */
+			/* FIXME */
+			/* here's what needs to happen:
+			 * 1. dialog to accept/reject transfer
+			 * 2. if cancel, toc_rvous_cancel
+			 * 3. if accept, first open a socket, then accept
+			 *    a. on connect, send header
+			 *    b. wait for header
+			 *    c. send file
+			 *    d. wait for info
+			 */
+		/*
+		} else if (!strcmp(uuid, VOICE_UID)) {
+		} else if (!strcmp(uuid, B_ICON_UID)) {
+		} else if (!strcmp(uuid, IMAGE_UID)) {
+		*/
 
-                ft->cookie = frombase64(cookie);
-                ft->ip = g_strdup(pip);
-                ft->port = port;
-                if (i)
-                        ft->message = g_strdup(messages[0]);
-                else
-                        ft->message = NULL;
-                ft->filename = g_strdup(name);
-                ft->user = g_strdup(user);
-                ft->size = totalsize;
-                
-                g_free(tmp);
-
-                for (i--; i >= 0; i--)
-                        g_free(messages[i]);
-                
-                accept_file_dialog(ft);
+		} else {
+			sprintf(debug_buff,"don't know what to do with %s\n",
+					uuid);
+			debug_print(debug_buff);
+		}
 	} else {
 		sprintf(debug_buff,"don't know what to do with %s\n", c);
 		debug_print(debug_buff);