changeset 260:325d9804df10

[gaim-migrate @ 270] Preparing for when libfaim can do rvous stuff committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 24 May 2000 22:47:09 +0000
parents e159ba2486fc
children aebbe6ca6919
files src/rvous.c src/server.c
diffstat 2 files changed, 25 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/src/rvous.c	Wed May 24 19:12:50 2000 +0000
+++ b/src/rvous.c	Wed May 24 22:47:09 2000 +0000
@@ -67,21 +67,12 @@
 
 static void cancel_callback(GtkWidget *widget, struct file_transfer *ft)
 {
-	char *send = g_malloc(256);
-
 	if (ft->accepted) {
-		g_free(send);
 		return;
 	}
 	
-#ifndef USE_OSCAR
-	g_snprintf(send, 255, "toc_rvous_cancel %s %s %s", normalize(ft->user),
-			ft->cookie, ft->UID);
-	sflap_send(send, strlen(send), TYPE_DATA);
-#else
-	/* FIXME : can we really do this? */
-#endif
-	g_free(send);
+	serv_rvous_cancel(ft->user, ft->cookie, ft->UID);
+
 	free_ft(ft);
 }
 
@@ -237,13 +228,7 @@
 	
 	gtk_widget_destroy(ft->window);
 	ft->window = NULL;
-#ifndef USE_OSCAR
-	g_snprintf(send, 255, "toc_rvous_accept %s %s %s", normalize(ft->user),
-			ft->cookie, ft->UID);
-	sflap_send(send, strlen(send), TYPE_DATA);
-#else
-	/* FIXME (?) */
-#endif
+	serv_rvous_accept(ft->user, ft->cookie, ft->UID);
 	g_free(send);
 
 	
@@ -346,12 +331,7 @@
 
 	if (!cont) {
 		char *tmp = frombase64(ft->cookie);
-#ifndef USE_OSCAR
-		sprintf(buf, "toc_rvous_cancel %s %s %s", ft->user, tmp, ft->UID);
-		sflap_send(buf, strlen(buf), TYPE_DATA);
-#else
-		/* FIXME (?) */
-#endif
+		serv_rvous_cancel(ft->user, tmp, ft->UID);
 		close(ft->fd);
 		free_ft(ft);
 		g_free(header);
@@ -405,13 +385,7 @@
 
 	gtk_widget_destroy(ft->window);
 	ft->window = NULL;
-#ifndef USE_OSCAR
-	g_snprintf(send, 255, "toc_rvous_accept %s %s %s", normalize(ft->user),
-			ft->cookie, ft->UID);
-	sflap_send(send, strlen(send), TYPE_DATA);
-#else
-	/* FIXME */
-#endif
+	serv_rvous_accept(ft->user, ft->cookie, ft->UID);
 	g_free(send);
 
 
@@ -622,12 +596,7 @@
 
 	if (!cont) {
 		char *tmp = frombase64(ft->cookie);
-#ifndef USE_OSCAR
-		sprintf(buf, "toc_rvous_cancel %s %s %s", ft->user, tmp, ft->UID);
-		sflap_send(buf, strlen(buf), TYPE_DATA);
-#else
-		/* FIXME */
-#endif
+		serv_rvous_cancel(ft->user, tmp, ft->UID);
 		g_free(buf);
 		close(ft->fd);
 		free_ft(ft);
--- a/src/server.c	Wed May 24 19:12:50 2000 +0000
+++ b/src/server.c	Wed May 24 22:47:09 2000 +0000
@@ -924,5 +924,23 @@
 
         chat_write(b, who, w, message);
 }
-        
 
+void serv_rvous_accept(char *name, char *cookie, char *uid)
+{
+	char buf[MSG_LEN];
+#ifndef USE_OSCAR
+	g_snprintf(buf, MSG_LEN, "toc_rvous_accept %s %s %s", normalize(name),
+			cookie, uid);
+	sflap_send(buf, strlen(buf), TYPE_DATA);
+#endif
+}
+
+void serv_rvous_cancel(char *name, char *cookie, char *uid)
+{
+	char buf[MSG_LEN];
+#ifndef USE_OSCAR
+	g_snprintf(buf, MSG_LEN, "toc_rvous_cancel %s %s %s", normalize(name),
+			cookie, uid);
+	sflap_send(buf, strlen(buf), TYPE_DATA);
+#endif
+}