Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble-iphoneos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2010-09-21 22:45:32 +0400
committerMikkel Krautz <mikkel@krautz.dk>2010-09-21 22:45:32 +0400
commit5760ea5cc8dfe6e36c2f13ab991d502f1d318aca (patch)
treef0e72c9b0211528e823648800468b706421a6df7
parentbc678744c33bb95b7b9ff8ff7dfe1a474efbac23 (diff)
Re-add password field to FavouriteServerEditViewController. Authenticate via client cert for identities with certs.
-rwxr-xr-xMumble.xcodeproj/project.pbxproj2
m---------MumbleKit0
-rw-r--r--Source/Classes/FavouriteServerEditViewController.m51
-rw-r--r--Source/Classes/FavouriteServerListController.m6
-rw-r--r--Source/Classes/ServerRootViewController.h6
-rw-r--r--Source/Classes/ServerRootViewController.m32
6 files changed, 61 insertions, 36 deletions
diff --git a/Mumble.xcodeproj/project.pbxproj b/Mumble.xcodeproj/project.pbxproj
index 06d3a55..9fa108f 100755
--- a/Mumble.xcodeproj/project.pbxproj
+++ b/Mumble.xcodeproj/project.pbxproj
@@ -158,7 +158,7 @@
isa = PBXContainerItemProxy;
containerPortal = 2861C28E116BE91B002B8514 /* MumbleKit.xcodeproj */;
proxyType = 1;
- remoteGlobalIDString = 10099D33010099D33010099D;
+ remoteGlobalIDString = 10099D4E010099D4E010099D;
remoteInfo = MumbleKitCombined;
};
/* End PBXContainerItemProxy section */
diff --git a/MumbleKit b/MumbleKit
-Subproject 8d4c059141a673806145b65f8aec187704b9155
+Subproject d6a5f51bb2ca892b03cc4c3ab8c8f3ae640eb3b
diff --git a/Source/Classes/FavouriteServerEditViewController.m b/Source/Classes/FavouriteServerEditViewController.m
index 8ad2038..66f0cf7 100644
--- a/Source/Classes/FavouriteServerEditViewController.m
+++ b/Source/Classes/FavouriteServerEditViewController.m
@@ -109,7 +109,7 @@ static NSString *FavouriteServerPlaceholderPassword = @"Optional";
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Mumble Server
if (section == 0) {
- return 3;
+ return 4;
// Identity
} else if (section == 1) {
return 1;
@@ -165,30 +165,38 @@ static NSString *FavouriteServerPlaceholderPassword = @"Optional";
[cell setIntValue:[_favourite port]];
else
[cell setTextValue:nil];
+ } else if (row == 3) {
+ [cell setLabel:@"Password"];
+ [cell setPlaceholder:FavouriteServerPlaceholderPassword];
+ [cell setSecureTextEntry:YES];
+ [cell setValueChangedAction:@selector(passwordChanged:)];
+ [cell setTextValue:[_favourite password]];
}
return cell;
// Identity
- } else if (section == 1 && row == 0) {
- static NSString *CellIdentifier = @"FavouriteServerIdentityCell";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- if (cell == nil) {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
- }
-
- Identity *ident = [_favourite identity];
- if (ident) {
- [[cell textLabel] setText:[ident userName]];
- [[cell imageView] setImage:[ident avatar]];
- } else {
- [[cell textLabel] setText:@"None"];
- [[cell imageView] setImage:nil];
+ } else if (section == 1) {
+ if (row == 0) {
+ static NSString *CellIdentifier = @"FavouriteServerIdentityCell";
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (cell == nil) {
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
+ }
+
+ Identity *ident = [_favourite identity];
+ if (ident) {
+ [[cell textLabel] setText:[ident userName]];
+ [[cell imageView] setImage:[ident avatar]];
+ } else {
+ [[cell textLabel] setText:@"None"];
+ [[cell imageView] setImage:nil];
+ }
+
+ [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
+
+ return cell;
}
-
- [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
-
- return cell;
}
return nil;
@@ -236,11 +244,6 @@ static NSString *FavouriteServerPlaceholderPassword = @"Optional";
[_favourite setPort:(NSUInteger)[[cell textValue] intValue]];
}
-- (void) usernameChanged:(id)sender {
- TableViewTextFieldCell *cell = (TableViewTextFieldCell *)sender;
- [_favourite setUserName:[cell textValue]];
-}
-
- (void) passwordChanged:(id)sender {
TableViewTextFieldCell *cell = (TableViewTextFieldCell *)sender;
[_favourite setPassword:[cell textValue]];
diff --git a/Source/Classes/FavouriteServerListController.m b/Source/Classes/FavouriteServerListController.m
index 5e20fb6..8c94073 100644
--- a/Source/Classes/FavouriteServerListController.m
+++ b/Source/Classes/FavouriteServerListController.m
@@ -86,8 +86,9 @@
FavouriteServer *favServ = [_favouriteServers objectAtIndex:[indexPath row]];
cell.textLabel.text = [favServ displayName];
+ Identity *ident = [favServ identity];
NSString *hostName = [favServ hostName];
- NSString *userName = [favServ userName];
+ NSString *userName = [ident userName];
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ on %@:%u",
userName ? userName : @"MumbleUser",
hostName ? hostName : @"(no server)", [favServ port]];
@@ -135,11 +136,12 @@
// Connect
if (index == 0) {
UINavigationController *navCtrl = [[UINavigationController alloc] init];
- ServerRootViewController *serverRoot = [[ServerRootViewController alloc] initWithHostname:[favServ hostName] port:[favServ port] username:[favServ userName] password:[favServ password]];
+ ServerRootViewController *serverRoot = [[ServerRootViewController alloc] initWithHostname:[favServ hostName] port:[favServ port] identity:[favServ identity] password:[favServ password]];
[navCtrl pushViewController:serverRoot animated:NO];
[[self navigationController] presentModalViewController:navCtrl animated:YES];
[serverRoot release];
[navCtrl release];
+
// Edit
} else if (index == 1) {
[self presentEditDialogForFavourite:favServ];
diff --git a/Source/Classes/ServerRootViewController.h b/Source/Classes/ServerRootViewController.h
index eea726c..652abc0 100644
--- a/Source/Classes/ServerRootViewController.h
+++ b/Source/Classes/ServerRootViewController.h
@@ -28,6 +28,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "Identity.h"
+
#import <MumbleKit/MKUser.h>
#import <MumbleKit/MKChannel.h>
#import <MumbleKit/MKConnection.h>
@@ -40,11 +42,11 @@
MKServerModel *_model;
NSMutableArray *_channelUsers;
MKChannel *_currentChannel;
- NSString *_username;
+ Identity *_identity;
NSString *_password;
}
-- (id) initWithHostname:(NSString *)host port:(NSUInteger)port username:(NSString *)username password:(NSString *)password;
+- (id) initWithHostname:(NSString *)host port:(NSUInteger)port identity:(Identity *)identity password:(NSString *)password;
- (void) dealloc;
@end
diff --git a/Source/Classes/ServerRootViewController.m b/Source/Classes/ServerRootViewController.m
index c3fc2b1..c50de00 100644
--- a/Source/Classes/ServerRootViewController.m
+++ b/Source/Classes/ServerRootViewController.m
@@ -30,6 +30,7 @@
#import <MumbleKit/MKAudio.h>
#import <MumbleKit/MKCertificate.h>
+#import <MumbleKit/MKConnection.h>
#import "ServerRootViewController.h"
#import "ChannelViewController.h"
@@ -40,12 +41,12 @@
@implementation ServerRootViewController
-- (id) initWithHostname:(NSString *)host port:(NSUInteger)port username:(NSString *)username password:(NSString *)password {
+- (id) initWithHostname:(NSString *)host port:(NSUInteger)port identity:(Identity *)identity password:(NSString *)password {
self = [super init];
if (! self)
return nil;
- _username = [username copy];
+ _identity = [identity retain];
_password = [password copy];
_connection = [[MKConnection alloc] init];
@@ -54,6 +55,19 @@
_model = [[MKServerModel alloc] initWithConnection:_connection];
[_model addDelegate:self];
+ // Try to fetch our given identity's SecIdentityRef by its persistent reference.
+ // If we're able to fetch it, set it as the connection's client certificate.
+ SecIdentityRef secIdentity = NULL;
+ NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys:
+ [identity persistent], kSecValuePersistentRef,
+ kCFBooleanTrue, kSecReturnRef,
+ kSecMatchLimitOne, kSecMatchLimit,
+ nil];
+ if (SecItemCopyMatching((CFDictionaryRef)query, (CFTypeRef *)&secIdentity) == noErr && secIdentity != NULL) {
+ [_connection setClientIdentity:secIdentity];
+ CFRelease(secIdentity);
+ }
+
[_connection connectToHost:host port:port];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userTalkStateChanged:) name:@"MKUserTalkStateChanged" object:nil];
@@ -64,7 +78,7 @@
}
- (void) dealloc {
- [_username release];
+ [_identity release];
[_password release];
[_model release];
[_connection release];
@@ -162,11 +176,15 @@
[[self navigationController] dismissModalViewControllerAnimated:YES];
}
-//
-// An SSL connection has been opened to the server. We should authenticate ourselves.
-//
+// Connection established...
- (void) connectionOpened:(MKConnection *)conn {
- [conn authenticateWithUsername:_username password:_password];
+ NSLog(@"ServerRootViewController: Connection established");
+ [conn authenticateWithUsername:[_identity userName] password:_password];
+}
+
+// Connection closed...
+- (void) connectionClosed:(MKConnection *)conn {
+ NSLog(@"ServerRootViewController: Connection closed");
}
#pragma mark MKServerModel Delegate