diff pidgin/gtkblist.c @ 26361:38238d41923b

propagate from branch 'im.pidgin.pidgin' (head 5573ab30de2e34d78f13bad8ae0b2ac5de6d1083) to branch 'im.pidgin.pidgin.vv' (head 6733a54a9c1b0ab68c8b924c82783cc4af588952)
author Mike Ruprecht <maiku@soc.pidgin.im>
date Mon, 16 Mar 2009 02:33:48 +0000
parents c0115655a94e ff4212a5268f
children f5f08111da52
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Sun Mar 15 20:22:28 2009 +0000
+++ b/pidgin/gtkblist.c	Mon Mar 16 02:33:48 2009 +0000
@@ -338,6 +338,30 @@
 	                            purple_buddy_get_name(b));
 }
 
+#ifdef USE_VV
+static void gtk_blist_menu_audio_call_cb(GtkWidget *w, PurpleBuddy *b)
+{
+	purple_prpl_initiate_media(purple_buddy_get_account(b),
+		purple_buddy_get_name(b), PURPLE_MEDIA_AUDIO);
+}
+
+static void gtk_blist_menu_video_call_cb(GtkWidget *w, PurpleBuddy *b)
+{
+	/* if the buddy supports both audio and video, start a combined call,
+	 otherwise start a pure video session */
+	if (purple_prpl_get_media_caps(purple_buddy_get_account(b),
+			purple_buddy_get_name(b)) &
+			PURPLE_MEDIA_CAPS_AUDIO_VIDEO) {
+		purple_prpl_initiate_media(purple_buddy_get_account(b),
+			purple_buddy_get_name(b), PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO);
+	} else {
+		purple_prpl_initiate_media(purple_buddy_get_account(b),
+			purple_buddy_get_name(b), PURPLE_MEDIA_VIDEO);
+	}
+}
+
+#endif
+
 static void gtk_blist_menu_send_file_cb(GtkWidget *w, PurpleBuddy *b)
 {
 	PurpleAccount *account = purple_buddy_get_account(b);
@@ -1476,6 +1500,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->get_media_caps) {
+		PurpleAccount *account = purple_buddy_get_account(buddy);
+		const gchar *who = purple_buddy_get_name(buddy);
+		PurpleMediaCaps caps = purple_prpl_get_media_caps(account, who);
+		if (caps & PURPLE_MEDIA_CAPS_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 (caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO) {
+			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 (caps & PURPLE_MEDIA_CAPS_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))