Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(517)

Unified Diff: ApplicationController.m

Issue 14081: Update for GData changes Base URL: http://calaboration.googlecode.com/svn/trunk/
Patch Set: Updated to construct UA correctly (and adding a missing CFBundleShortVersionString) Created 16 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Calaboration.xcodeproj/project.pbxproj » ('j') | Calaboration.xcodeproj/project.pbxproj » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ApplicationController.m
===================================================================
--- ApplicationController.m (revision 21)
+++ ApplicationController.m (working copy)
@@ -119,6 +119,9 @@
// configure our GData server
contactsService_ = [[GDataServiceGoogleCalendar alloc] init];
+ NSString *version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
+ NSString *userAgent = [NSString stringWithFormat:@"Google-Calaboration-%@", version];
+ [contactsService_ setUserAgent:userAgent];
[contactsService_ setServiceShouldFollowNextLinks:YES];
NSArray *modes =
[NSArray arrayWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode,
@@ -297,21 +300,20 @@
NSSet *configuredCals = [self calendarIDsAlreadyConfigured];
NSArray *entries = [feed entries];
for (GDataEntryCalendar *calendar in entries) {
- NSScanner *scanner = [NSScanner scannerWithString:[calendar identifier]];
- NSString *calID;
// GData for calendar doesn't vend the IDs in any useful way, so we have to
// use knowledge of the urls to scan it and get the actual ids off the end.
- if ([scanner scanString:kGDataGoogleCalendarDefaultAllCalendarsFeed
- intoString:NULL] &&
- [scanner scanString:@"/" intoString:NULL] &&
- [scanner scanUpToString:@"\n" intoString:&calID] && // use \n to get the rest
- ([calID length] > 0)) {
+ NSString *calURL = [calendar identifier];
+ NSRange finalSlashRange = [calURL rangeOfString:@"/" options:NSBackwardsSearch];
+ if (finalSlashRange.location == NSNotFound ||
+ (finalSlashRange.location + 1) >= [calURL length])
+ continue;
+ NSString *calID = [calURL substringFromIndex:(finalSlashRange.location + 1)];
+ if ([calID length] > 0) {
// is it already configured?
BOOL alreadyConfigured = [configuredCals containsObject:calID];
NSString *accessLevel = [[calendar accessLevel] stringValue];
BOOL isWritable = [accessLevel isEqualToString:kGDataCalendarAccessOwner] ||
[accessLevel isEqualToString:kGDataCalendarAccessEditor] ||
- [accessLevel isEqualToString:kGDataCalendarAccessContributor] ||
[accessLevel isEqualToString:kGDataCalendarAccessRoot];
// iCal doesn't currently check the permissions on calendars accessed via
// CalDAV, it just assumes they are all editable. if you only have R/O
@@ -792,7 +794,6 @@
gReadWriteLevels
= [[NSSet alloc] initWithObjects:kGDataCalendarAccessEditor,
kGDataCalendarAccessOwner,
- kGDataCalendarAccessContributor,
kGDataCalendarAccessRoot,
nil];
gReadOnlyImage = [[NSImage imageNamed:NSImageNameLockLockedTemplate] retain];
« no previous file with comments | « no previous file | Calaboration.xcodeproj/project.pbxproj » ('j') | Calaboration.xcodeproj/project.pbxproj » ('J')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b