Fix frequency detection of recurrence rule

pull/195/merge
Francis Lachapelle 2016-02-04 09:20:11 -05:00
parent 7437ca1ab8
commit a8845d262f
2 changed files with 7 additions and 9 deletions

View File

@ -1,6 +1,6 @@
/*
Copyright (C) 2004-2005 SKYRIX Software AG
Copyright (C) 2006-2010 Inverse inc.
Copyright (C) 2006-2016 Inverse inc.
This file is part of SOPE.
@ -291,6 +291,8 @@ NSString *iCalWeekDayString[] = { @"SU", @"MO", @"TU", @"WE", @"TH", @"FR",
NSString *frequency;
iCalRecurrenceFrequency freq;
freq = 0;
if ([value length] > 0)
{
frequency = [value uppercaseString];
@ -308,11 +310,7 @@ NSString *iCalWeekDayString[] = { @"SU", @"MO", @"TU", @"WE", @"TH", @"FR",
freq = iCalRecurrenceFrequenceMinutely;
else if ([frequency isEqualToString:@"SECONDLY"])
freq = iCalRecurrenceFrequenceSecondly;
else
freq = (iCalRecurrenceFrequency) NSNotFound;
}
else
freq = (iCalRecurrenceFrequency) NSNotFound;
return freq;
}

View File

@ -1,6 +1,6 @@
/* iCalRepeatableEntityObject+SOGo.m - this file is part of SOGo
*
* Copyright (C) 2007-2015 Inverse inc.
* Copyright (C) 2007-2016 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -164,12 +164,12 @@
rule = [iCalRecurrenceRule new];
[rule setInterval: @"1"];
frequency = (int) NSNotFound;
frequency = 0;
o = [repeat objectForKey: @"frequency"];
if ([o isKindOfClass: [NSString class]])
{
frequency = [rule valueForFrequency: o];
if ((int) frequency == NSNotFound)
if (!frequency)
{
if ([o caseInsensitiveCompare: @"BI-WEEKLY"] == NSOrderedSame)
{
@ -223,7 +223,7 @@
[rule setValues: o atIndex: 0 forKey: @"bymonth"];
}
if ((int) frequency != NSNotFound)
if (frequency)
{
[rule setFrequency: frequency];
[self setRecurrenceRules: [NSArray arrayWithObject: rule]];