Permalink
Browse files

List all email accounts, add call forward number

  • Loading branch information...
1 parent fc4f333 commit 0cfe43721813c23ed901f924009c01d247722b45 @sburlot sburlot committed Dec 27, 2009
View
5 Classes/SPEmailASAccount.m 100644 → 100755
@@ -17,10 +17,11 @@ + (SPEmailAccount *)accountWithDictionary:(NSDictionary *)d {
account.type = [d valueForKey:@"Short Type String"];
//account.fullname = nil;
- account.email = [d valueForKey:@"ASAccountEmailAddress"];
+ account.email = [NSArray arrayWithObject:[d valueForKey:@"ASAccountEmailAddress"]];
account.hostname = [d valueForKey:@"ASAccountHost"];
account.username = [d valueForKey:@"ASAccountUsername"];
-
+ account.displayName = [d valueForKey:@"DisplayName"];
+
return [account autorelease];
}
View
6 Classes/SPEmailAccount.h 100644 → 100755
@@ -13,17 +13,19 @@
@interface SPEmailAccount : NSObject {
NSString *fullname;
- NSString *email;
+ NSArray *email;
NSString *type;
NSString *hostname;
NSString *username;
+ NSString *displayName;
}
@property (nonatomic, retain) NSString *fullname;
-@property (nonatomic, retain) NSString *email;
+@property (nonatomic, retain) NSArray *email;
@property (nonatomic, retain) NSString *type;
@property (nonatomic, retain) NSString *hostname;
@property (nonatomic, retain) NSString *username;
+@property (nonatomic, retain) NSString *displayName;
+ (SPEmailAccount *)accountWithDictionary:(NSDictionary *)d;
- (NSArray *)infoArray;
View
6 Classes/SPEmailAccount.m 100644 → 100755
@@ -17,13 +17,15 @@ @implementation SPEmailAccount
@synthesize type;
@synthesize hostname;
@synthesize username;
+@synthesize displayName;
- (void)dealloc {
[fullname release];
[email release];
[type release];
[hostname release];
[username release];
+ [displayName release];
[super dealloc];
}
@@ -38,6 +40,10 @@ - (NSArray *)infoArray {
if(type) [a addObject:[NSString stringWithFormat:@"Type: %@", type]];
if(hostname) [a addObject:[NSString stringWithFormat:@"Host: %@", hostname]];
if(username) [a addObject:[NSString stringWithFormat:@"User: %@", username]];
+ if(email) {
+ for (id emailAddress in email)
+ [a addObject:[NSString stringWithFormat:@"Email: %@", emailAddress]];
+ }
return a;
}
View
5 Classes/SPEmailGmailAccount.m 100644 → 100755
@@ -19,12 +19,13 @@ + (SPEmailAccount *)accountWithDictionary:(NSDictionary *)d {
account.fullname = [d valueForKey:@"FullUserName"];
account.hostname = [d valueForKey:@"Hostname"];
account.username = [d valueForKey:@"Username"];
-
+ account.displayName = [d valueForKey:@"DisplayName"];
+
NSString *theEmail = [d valueForKey:@"Username"];
if(![[theEmail lowercaseString] hasSuffix:@"@gmail.com"]) {
theEmail = [theEmail stringByAppendingString:@"@gmail.com"];
}
- account.email = theEmail;
+ account.email = [NSArray arrayWithObject:theEmail];
return [account autorelease];
}
View
3 Classes/SPEmailIMAPAccount.m 100644 → 100755
@@ -17,9 +17,10 @@ + (SPEmailAccount *)accountWithDictionary:(NSDictionary *)d {
account.type = [d valueForKey:@"Short Type String"];
account.fullname = [d valueForKey:@"FullUserName"];
- account.email = [[d valueForKey:@"EmailAddresses"] lastObject];
+ account.email = [d valueForKey:@"EmailAddresses"];
account.hostname = [d valueForKey:@"Hostname"];
account.username = [d valueForKey:@"Username"];
+ account.displayName = [d valueForKey:@"DisplayName"];
return [account autorelease];
}
View
11 Classes/SPEmailIToolsAccount.m 100644 → 100755
@@ -17,10 +17,17 @@ + (SPEmailAccount *)accountWithDictionary:(NSDictionary *)d {
account.type = [d valueForKey:@"Short Type String"];
account.fullname = [d valueForKey:@"FullUserName"];
- account.email = [[[d valueForKey:@"EmailAddresses"] lastObject] stringByAppendingString:@"@me.com"];
+ NSArray *theEmailAddresses = [d valueForKey:@"EmailAddresses"];
+ NSMutableArray *a = [NSMutableArray array];
+ if(theEmailAddresses) {
+ for (id emailAddress in theEmailAddresses)
+ [a addObject:[NSString stringWithFormat:@"%@@me.com", emailAddress]];
+ }
+ account.email = a;
//account.hostname = nil;
account.username = [d valueForKey:@"Username"];
-
+ account.displayName = [d valueForKey:@"DisplayName"];
+
return [account autorelease];
}
View
5 Classes/SPEmailPOPAccount.m 100644 → 100755
@@ -17,10 +17,11 @@ + (SPEmailAccount *)accountWithDictionary:(NSDictionary *)d {
account.type = [d valueForKey:@"Short Type String"];
account.fullname = [d valueForKey:@"FullUserName"];
- account.email = [[d valueForKey:@"EmailAddresses"] lastObject];
+ account.email = [d valueForKey:@"EmailAddresses"];
account.hostname = [d valueForKey:@"Hostname"];
account.username = [d valueForKey:@"Username"];
-
+ account.displayName = [d valueForKey:@"DisplayName"];
+
return [account autorelease];
}
View
2 Classes/SPSourceEmailTVC.m 100644 → 100755
@@ -54,7 +54,7 @@ - (void)loadData {
for(SPEmailAccount *account in accountsFound) {
if(!account.email) continue;
[emails addObject:account.email];
- [contentsDictionaries addObject:[NSDictionary dictionaryWithObject:[account infoArray] forKey:account.email]];
+ [contentsDictionaries addObject:[NSDictionary dictionaryWithObject:[account infoArray] forKey:account.displayName]];
}
}
View
4 Classes/SPSourcePhoneTVC.h 100644 → 100755
@@ -17,7 +17,8 @@
NSString *phone;
NSString *UUID;
NSString *lastDialed;
- NSString *lastContact;
+ NSString *lastContact;
+ NSString *lastForwardNumber;
}
@property (nonatomic, retain) NSString *ICCID;
@@ -27,5 +28,6 @@
@property (nonatomic, retain) NSString *UUID;
@property (nonatomic, retain) NSString *lastDialed;
@property (nonatomic, retain) NSString *lastContact;
+@property (nonatomic, retain) NSString *lastForwardNumber;
@end
View
11 Classes/SPSourcePhoneTVC.m 100644 → 100755
@@ -20,6 +20,7 @@ @implementation SPSourcePhoneTVC
@synthesize UUID;
@synthesize lastDialed;
@synthesize lastContact;
+@synthesize lastForwardNumber;
- (NSString *)nameOfABPersonWithID:(NSUInteger)recordID {
ABAddressBookRef addressBook = ABAddressBookCreate();
@@ -72,6 +73,10 @@ - (void)loadData {
}
if(!self.IMEI) self.IMEI = @"";
*/
+ path = @"/var/mobile/Library/Preferences/com.apple.mobilephone.settings.plist";
+ d = [NSDictionary dictionaryWithContentsOfFile:path];
+ self.lastForwardNumber = [NSString stringWithFormat:@"%@", [d valueForKey:@"call-forwarding-number"]];
+
path = @"/var/mobile/Library/Preferences/com.apple.mobilephone.plist";
d = [NSDictionary dictionaryWithContentsOfFile:path];
self.lastDialed = [NSString stringWithFormat:@"%@", [d valueForKey:@"DialerSavedNumber"]];
@@ -82,6 +87,11 @@ - (void)loadData {
NSString *fullName = [self nameOfABPersonWithID:abId];
self.lastContact = fullName;
+ if(self.lastForwardNumber) {
+ NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObject:self.lastForwardNumber], @"Call forwarding number", nil];
+ [self.contentsDictionaries addObject:dict];
+ }
+
if(self.phone) {
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObject:self.phone], @"Phone number", nil];
[self.contentsDictionaries addObject:dict];
@@ -126,6 +136,7 @@ - (void)dealloc {
[IMSI release];
[phone release];
[UUID release];
+ [lastForwardNumber release];
[lastDialed release];
[lastContact release];
[super dealloc];

0 comments on commit 0cfe437

Please sign in to comment.