maiku.vv: b8dd0181: Added menu items to buddy list context m...

malu at pidgin.im malu at pidgin.im
Sun Nov 9 16:00:29 EST 2008


-----------------------------------------------------------------
Revision: b8dd01811111576c48cce1dbe5299f7422af4c2c
Ancestor: 4216641d02f3143f464cb1af6004df42f9317e5d
Author: malu at pidgin.im
Date: 2008-11-09T20:55:10
Branch: im.pidgin.maiku.vv
URL: http://d.pidgin.im/viewmtn/revision/info/b8dd01811111576c48cce1dbe5299f7422af4c2c

Modified files:
        pidgin/gtkblist.c

ChangeLog: 

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


-------------- next part --------------
============================================================
--- pidgin/gtkblist.c	aab61691ddea72258417c902df8d7cdee76a0503
+++ pidgin/gtkblist.c	c81880196883665da3ab2d38ef643eb017a989c2
@@ -337,6 +337,39 @@ static void gtk_blist_menu_im_cb(GtkWidg
 	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_blist_make_buddy_menu(GtkWidget *
 	}
 	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))


More information about the Commits mailing list