pidgin.vv: 55aa623e: Use request API for a media invitation.

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Jan 30 04:05:33 EST 2009


-----------------------------------------------------------------
Revision: 55aa623e09a7429df54b4e068dcba4c67c5fe779
Ancestor: 6e31bddba10751269bd2e719d922626f4f1da909
Author: maiku at soc.pidgin.im
Date: 2009-01-30T08:52:27
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/55aa623e09a7429df54b4e068dcba4c67c5fe779

Modified files:
        pidgin/gtkmedia.c

ChangeLog: 

Use request API for a media invitation.

-------------- next part --------------
============================================================
--- pidgin/gtkmedia.c	2a740235e540f9eb033500e63b6fee01bd918caf
+++ pidgin/gtkmedia.c	0850a852589a2ff80d3f588d75536dc8b13a6073
@@ -30,6 +30,7 @@
 #include "media.h"
 #include "mediamanager.h"
 #include "pidgin.h"
+#include "request.h"
 
 #include "gtkmedia.h"
 
@@ -221,8 +222,6 @@ pidgin_media_init (PidginMedia *media)
 
 	g_signal_connect(G_OBJECT(media), "delete-event",
 			G_CALLBACK(pidgin_media_delete_event_cb), media);
-
-	gtk_widget_show(GTK_WIDGET(media));
 }
 
 static gboolean
@@ -389,6 +388,7 @@ pidgin_media_accepted_cb(PurpleMedia *me
 {
 	pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
 	pidgin_media_emit_message(gtkmedia, _("Call in progress."));
+	gtk_widget_show(GTK_WIDGET(gtkmedia));
 }
 
 static gboolean
@@ -732,8 +732,21 @@ pidgin_media_new_cb(PurpleMediaManager *
 {
 	PidginMedia *gtkmedia = PIDGIN_MEDIA(
 			pidgin_media_new(media, screenname));
+	gboolean initiator;
 	gtkmedia->priv->pc = pc;
 
+	g_object_get(G_OBJECT(media), "initiator", &initiator, NULL);
+	if (initiator == FALSE) {
+		gchar *message = g_strdup_printf("%s wishes to start a "
+				"media session with you\n", screenname);
+		purple_request_accept_cancel(media, "Media invitation",
+				message, NULL, 1, (void*)pc, screenname,
+				NULL, media, purple_media_accept,
+				purple_media_reject);
+		g_free(message);
+	} else
+		gtk_widget_show(GTK_WIDGET(gtkmedia));
+
 	return TRUE;
 }
 


More information about the Commits mailing list