Commits

Thijs Alkemade  committed a28e7d7

Allow calling meta-contacts.

  • Participants
  • Parent commits 9e4c6a7

Comments (0)

Files changed (1)

File Source/AV/AIVoiceController.m

 //
 
 #import "AIVoiceController.h"
+#import "AIMetaContact.h"
+#import <Adium/AIAccountControllerProtocol.h>
+
 #define VOICE_WINDOW_NIB_NAME        @"AIVVPluginWindow"
 
 
 
 - (void)startVoiceCallWithBuddyContact:(AIListContact *)contact {
 	PurpleAccount *account = [(CBPurpleAccount *)contact.account purpleAccount];
-	PurpleBuddy *buddy = (account ? purple_find_buddy(account, [contact.UID UTF8String]) : nil);
+	AIListContact *preferredContact;
+	if ([contact isKindOfClass:[AIMetaContact class]]) {
+		preferredContact = [((AIMetaContact *)contact) preferredContactWithCompatibleService:[adium.accountController firstServiceWithServiceID:@"Jabber"]];
+	} else {
+		preferredContact = contact;
+	}
+	PurpleBuddy *buddy = (account ? purple_find_buddy(account, [preferredContact.UID UTF8String]) : nil);
 	[self startVoiceCallWithBuddy:buddy];
 }
 
 
 - (void)startVideoCallWithBuddyContact:(AIListContact *)contact {
 	PurpleAccount *account = [(CBPurpleAccount *)contact.account purpleAccount];
-	PurpleBuddy *buddy = (account ? purple_find_buddy(account, [contact.UID UTF8String]) : nil);
+	AIListContact *preferredContact;
+	if ([contact isKindOfClass:[AIMetaContact class]]) {
+		preferredContact = [((AIMetaContact *)contact) preferredContactWithCompatibleService:[adium.accountController firstServiceWithServiceID:@"Jabber"]];
+	} else {
+		preferredContact = contact;
+	}
+	PurpleBuddy *buddy = (account ? purple_find_buddy(account, [preferredContact.UID UTF8String]) : nil);
 	[self startVideoCallWithBuddy:buddy];
 }