changeset 26035:e5da7110bec9

Added menu items to buddy list context menu to start voice and video sessions After discussing the matter with Maiku, we decided to have two choises. "Audio call" which will show up if audio sessions is possible with a buddy and the other item is either "Audio/Video" or "Video" depending on if the buddy supports both at the same time or not
author Marcus Lundblad <ml@update.uu.se>
date Sun, 09 Nov 2008 20:55:10 +0000
parents 6260a6192166
children a5f1804fcb4b
files pidgin/gtkblist.c
diffstat 1 files changed, 57 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Fri Nov 07 03:38:42 2008 +0000
+++ b/pidgin/gtkblist.c	Sun Nov 09 20:55:10 2008 +0000
@@ -337,6 +337,39 @@
 	pidgin_dialogs_im_with_user(b->account, b->name);
 }
 
+#ifdef USE_VV
+static void gtk_blist_menu_audio_call_cb(GtkWidget *w, PurpleBuddy *b)
+{
+	PurpleMedia *media = purple_prpl_initiate_media(purple_buddy_get_account(b),
+		purple_buddy_get_name(b), PURPLE_MEDIA_AUDIO);
+	
+	if (media) {
+		purple_media_wait(media);
+	}
+}
+
+static void gtk_blist_menu_video_call_cb(GtkWidget *w, PurpleBuddy *b)
+{
+	PurpleMedia *media = NULL;
+	
+	/* if the buddy supports both audio and video, start a combined call,
+	 otherwise start a pure video session */
+	if (purple_prpl_can_do_media(purple_buddy_get_account(b),
+		purple_buddy_get_name(b), PURPLE_MEDIA_AUDIO)) {
+		media = purple_prpl_initiate_media(purple_buddy_get_account(b),
+			purple_buddy_get_name(b), PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO);
+	} else {
+		media = purple_prpl_initiate_media(purple_buddy_get_account(b),
+			purple_buddy_get_name(b), PURPLE_MEDIA_VIDEO);
+	}
+	
+	if (media) {
+		purple_media_wait(media);
+	}
+}
+
+#endif
+
 static void gtk_blist_menu_send_file_cb(GtkWidget *w, PurpleBuddy *b)
 {
 	serv_send_file(b->account->gc, b->name, NULL);
@@ -1436,6 +1469,30 @@
 	}
 	pidgin_new_item_from_stock(menu, _("I_M"), PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW,
 			G_CALLBACK(gtk_blist_menu_im_cb), buddy, 0, 0, NULL);
+	
+#ifdef USE_VV
+	if (prpl_info && prpl_info->can_do_media) {
+		PurpleConnection *gc = 
+			purple_account_get_connection(purple_buddy_get_account(buddy));
+		const gchar *who = purple_buddy_get_name(buddy);
+		if (prpl_info->can_do_media(gc, who, PURPLE_MEDIA_AUDIO)) {
+			pidgin_new_item_from_stock(menu, _("_Audio Call"),
+				PIDGIN_STOCK_TOOLBAR_AUDIO_CALL,
+				G_CALLBACK(gtk_blist_menu_audio_call_cb), buddy, 0, 0, NULL);
+		}
+		if (prpl_info->can_do_media(gc, who, PURPLE_MEDIA_VIDEO | PURPLE_MEDIA_AUDIO)) {
+			pidgin_new_item_from_stock(menu, _("Audio/_Video Call"),
+				PIDGIN_STOCK_TOOLBAR_VIDEO_CALL,
+				G_CALLBACK(gtk_blist_menu_video_call_cb), buddy, 0, 0, NULL);
+		} else if (prpl_info->can_do_media(gc, who, PURPLE_MEDIA_VIDEO)) {
+			pidgin_new_item_from_stock(menu, _("_Video Call"),
+				PIDGIN_STOCK_TOOLBAR_VIDEO_CALL,
+				G_CALLBACK(gtk_blist_menu_video_call_cb), buddy, 0, 0, NULL);
+		}
+	}
+	
+#endif
+	
 	if (prpl_info && prpl_info->send_file) {
 		if (!prpl_info->can_receive_file ||
 			prpl_info->can_receive_file(buddy->account->gc, buddy->name))