]> err.no Git - scalable-opengroupware.org/blob - SOPE/sope-patchset-r1546.diff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1193 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / SOPE / sope-patchset-r1546.diff
1 Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.h
2 ===================================================================
3 --- sope-gdl1/PostgreSQL/PostgreSQL72Channel.h  (révision 1546)
4 +++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.h  (copie de travail)
5 @@ -28,6 +28,7 @@
6  #define ___PostgreSQL72_Channel_H___
7  
8  #include <GDLAccess/EOAdaptorChannel.h>
9 +#include <GDLContentStore/EOAdaptorChannel+GCS.h>
10  #include <libpq-fe.h>
11  
12  @class NSArray, NSString, NSMutableDictionary;
13 @@ -40,7 +41,7 @@
14    int        modification;
15  } PostgreSQL72FieldInfo;
16  
17 -@interface PostgreSQL72Channel : EOAdaptorChannel
18 +@interface PostgreSQL72Channel : EOAdaptorChannel <GCSEOAdaptorChannel>
19  {
20    // connection is valid after an openChannel call
21    PGConnection *connection;
22 Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m
23 ===================================================================
24 --- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m  (révision 1546)
25 +++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m  (copie de travail)
26 @@ -713,6 +713,39 @@
27    return ms;
28  }
29  
30 +/* GCSEOAdaptorChannel protocol */
31 +static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n"     \
32 +                                   @"  c_name VARCHAR (256) NOT NULL,\n"
33 +                                   @"  c_content VARCHAR (100000) NOT NULL,\n"
34 +                                   @"  c_creationdate INT4 NOT NULL,\n"
35 +                                   @"  c_lastmodified INT4 NOT NULL,\n"
36 +                                   @"  c_version INT4 NOT NULL,\n"
37 +                                   @"  c_deleted INT4 NULL\n"
38 +                                   @")");
39 +static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n"  \
40 +                                      @"  c_uid VARCHAR (256) NOT NULL,\n"
41 +                                      @"  c_object VARCHAR (256) NOT NULL,\n"
42 +                                      @"  c_role VARCHAR (80) NOT NULL\n"
43 +                                      @")");
44 +
45 +- (NSException *) createGCSFolderTableWithName: (NSString *) tableName
46 +{
47 +  NSString *sql;
48 +
49 +  sql = [NSString stringWithFormat: sqlFolderFormat, tableName];
50 +
51 +  return [self evaluateExpressionX: sql];
52 +}
53 +
54 +- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName
55 +{
56 +  NSString *sql;
57 +
58 +  sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName];
59 +
60 +  return [self evaluateExpressionX: sql];
61 +}
62 +
63  @end /* PostgreSQL72Channel */
64  
65  @implementation PostgreSQL72Channel(PrimaryKeyGeneration)
66 Index: sope-mime/NGImap4/NGImap4Connection.m
67 ===================================================================
68 --- sope-mime/NGImap4/NGImap4Connection.m       (révision 1546)
69 +++ sope-mime/NGImap4/NGImap4Connection.m       (copie de travail)
70 @@ -381,7 +381,7 @@
71    
72    if (debugCache) [self logWithFormat:@"  no folders cached yet .."];
73    
74 -  result = [[self client] list:(onlyFetchInbox ? @"INBOX" : @"*")
75 +  result = [[self client] list:(onlyFetchInbox ? @"INBOX" : @"")
76                           pattern:@"*"];
77    if (![[result valueForKey:@"result"] boolValue]) {
78      [self errorWithFormat:@"Could not list mailbox hierarchy!"];
79 Index: sope-mime/NGImap4/NGImap4ResponseNormalizer.m
80 ===================================================================
81 --- sope-mime/NGImap4/NGImap4ResponseNormalizer.m       (révision 1546)
82 +++ sope-mime/NGImap4/NGImap4ResponseNormalizer.m       (copie de travail)
83 @@ -648,14 +648,13 @@
84    enumerator = [_flags objectEnumerator];
85    cnt = 0;
86    while ((obj = [enumerator nextObject])) {
87 -    if (![obj isNotEmpty])
88 -      continue;
89 -    
90 -    if (![[obj substringToIndex:1] isEqualToString:@"\\"])
91 -      continue;
92 -
93 -    objs[cnt] = [obj substringFromIndex:1];
94 -    cnt++;
95 +    if ([obj isNotEmpty]) {
96 +      if ([obj hasPrefix:@"\\"])
97 +       objs[cnt] = [obj substringFromIndex:1];
98 +      else
99 +       objs[cnt] = obj;
100 +      cnt++;
101 +    }
102    }
103    result = [NSArray arrayWithObjects:objs count:cnt];
104    if (objs) free(objs);
105 Index: sope-mime/NGImap4/NGImap4ResponseParser.m
106 ===================================================================
107 --- sope-mime/NGImap4/NGImap4ResponseParser.m   (révision 1546)
108 +++ sope-mime/NGImap4/NGImap4ResponseParser.m   (copie de travail)
109 @@ -84,6 +84,8 @@
110  static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self,
111                                          BOOL isBodyStructure);
112  
113 +static NSArray *_parseLanguages();
114 +
115  static NSString *_parseBodyString(NGImap4ResponseParser *self,
116                                    BOOL _convertString);
117  static NSString *_parseBodyDecodeString(NGImap4ResponseParser *self,
118 @@ -1627,6 +1629,29 @@
119    return _parseBodyDecodeString(self, _convertString, NO /* no decode */);
120  }
121  
122 +static NSArray *_parseLanguages(NGImap4ResponseParser *self) {
123 +  NSMutableArray *languages;
124 +  NSString *language;
125 +
126 +  languages = [NSMutableArray array];
127 +  if (_la(self, 0) == '(') {
128 +    while (_la(self, 0) != ')') {
129 +      _consume(self,1);
130 +      language = _parseBodyString(self, YES);
131 +      if ([language length])
132 +       [languages addObject: language];
133 +    }
134 +    _consume(self,1);
135 +  }
136 +  else {
137 +    language = _parseBodyString(self, YES);
138 +    if ([language length])
139 +      [languages addObject: language];
140 +  }
141 +
142 +  return languages;
143 +}
144 +
145  static NSDictionary *_parseBodyParameterList(NGImap4ResponseParser *self)
146  {
147    NSMutableDictionary *list;
148 @@ -1734,10 +1759,11 @@
149                       *encoding, *bodysize;
150    NSDictionary        *parameterList;
151    NSMutableDictionary *dict;
152 +  NSArray            *languages;
153  
154    type = [_parseBodyString(self, YES) lowercaseString];
155    _consumeIfMatch(self, ' ');
156 -  subtype = _parseBodyString(self, YES);
157 +  subtype = [_parseBodyString(self, YES) lowercaseString];
158    _consumeIfMatch(self, ' ');
159    parameterList = _parseBodyParameterList(self);
160    _consumeIfMatch(self, ' ');
161 @@ -1762,7 +1788,8 @@
162      _consumeIfMatch(self, ' ');
163      [dict setObject:_parseBodyString(self, YES) forKey:@"lines"];
164    }
165 -  else if ([type isEqualToString:@"message"]) {
166 +  else if ([type isEqualToString:@"message"]
167 +          && [subtype isEqualToString:@"rfc822"]) {
168      if (_la(self, 0) != ')') {
169        _consumeIfMatch(self, ' ');
170        _consumeIfMatch(self, '(');
171 @@ -1805,14 +1832,9 @@
172               forKey: @"disposition"];
173         if (_la(self, 0) != ')') {
174           _consume(self,1);
175 -         if (_la(self, 0) == '(') {
176 -           [dict setObject: _parseBodyParameterList(self)
177 -                 forKey: @"language"];
178 -         }
179 -         else {
180 -           [dict setObject: _parseBodyString(self, YES)
181 -                 forKey: @"language"];
182 -         }
183 +         languages = _parseLanguages(self);
184 +         if ([languages count])
185 +           [dict setObject: languages forKey: @"languages"];
186           if (_la(self, 0) != ')') {
187             _consume(self,1);
188             [dict setObject: _parseBodyString(self, YES)
189 @@ -1829,6 +1851,7 @@
190  static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self,
191                                          BOOL isBodyStructure) {
192    NSMutableArray *parts;
193 +  NSArray       *languages;
194    NSString       *kind;
195    NSMutableDictionary *dict;
196  
197 @@ -1854,14 +1877,9 @@
198               forKey: @"disposition"];
199         if (_la(self, 0) != ')') {
200           _consume(self,1);
201 -         if (_la(self, 0) == '(') {
202 -           [dict setObject: _parseBodyParameterList(self)
203 -                 forKey: @"language"];
204 -         }
205 -         else {
206 -           [dict setObject: _parseBodyString(self, YES)
207 -                 forKey: @"language"];
208 -         }
209 +         languages = _parseLanguages(self);
210 +         if ([languages count])
211 +           [dict setObject: languages forKey: @"languages"];
212           if (_la(self, 0) != ')') {
213             _consume(self,1);
214             [dict setObject: _parseBodyString(self, YES)
215 Index: sope-mime/NGMime/NGMimeBodyPart.m
216 ===================================================================
217 --- sope-mime/NGMime/NGMimeBodyPart.m   (révision 1546)
218 +++ sope-mime/NGMime/NGMimeBodyPart.m   (copie de travail)
219 @@ -31,18 +31,6 @@
220    return 2;
221  }
222  
223 -static NGMimeType *defaultType = nil;
224 -
225 -+ (void)initialize {
226 -  static BOOL isInitialized = NO;
227 -  if (!isInitialized) {
228 -    isInitialized = YES;
229 -    
230 -    defaultType =
231 -      [[NGMimeType mimeType:@"text/plain; charset=us-ascii"] retain];
232 -  }
233 -}
234 -  
235  + (id)bodyPartWithHeader:(NGHashMap *)_header {
236    return [[[self alloc] initWithHeader:_header] autorelease];
237  }
238 @@ -156,13 +144,12 @@
239    if (!Fields)
240      Fields = (NGMimeHeaderNames *)[NGMimePartParser headerFieldNames];
241    
242 -  
243    type = [self->header objectForKey:Fields->contentType];
244    
245    if (![type isKindOfClass:[NGMimeType class]])
246      type = [NGMimeType mimeType:[type stringValue]];
247    
248 -  return (type != nil ? type : (id)defaultType);
249 +  return type;
250  }
251  
252  - (NSString *)contentId {
253 Index: sope-mime/NGMime/NGMimeBodyParser.m
254 ===================================================================
255 --- sope-mime/NGMime/NGMimeBodyParser.m (révision 1546)
256 +++ sope-mime/NGMime/NGMimeBodyParser.m (copie de travail)
257 @@ -67,7 +67,10 @@
258    if (_data == nil) return nil;
259    
260    ctype = [_part contentType];
261 -  
262 +  if (!ctype
263 +      && [_d respondsToSelector: @selector(parser:contentTypeOfPart:)])
264 +    ctype = [_d parser: self contentTypeOfPart: _part];
265 +
266    if (![ctype isKindOfClass:[NGMimeType class]])
267      ctype = [NGMimeType mimeType:[ctype stringValue]];
268    
269 Index: sope-mime/NGMime/NGMimePartParser.h
270 ===================================================================
271 --- sope-mime/NGMime/NGMimePartParser.h (révision 1546)
272 +++ sope-mime/NGMime/NGMimePartParser.h (copie de travail)
273 @@ -117,6 +117,7 @@
274      BOOL parserParseRawBodyDataOfPart:1;
275      BOOL parserBodyParserForPart:1;
276      BOOL parserDecodeBodyOfPart:1;
277 +    BOOL parserContentTypeOfPart:1;
278    } delegateRespondsTo;
279  
280    
281 @@ -275,6 +276,9 @@
282  - (id<NGMimeBodyParser>)parser:(NGMimePartParser *)_parser
283    bodyParserForPart:(id<NGMimePart>)_part;
284  
285 +- (NGMimeType *)parser:(id)_parser
286 +  contentTypeOfPart:(id<NGMimePart>)_part;
287 +
288  @end /* NSObject(NGMimePartParserDelegate) */
289  
290  @interface NSObject(NGMimePartParser)
291 Index: sope-mime/NGMime/NGMimePartParser.m
292 ===================================================================
293 --- sope-mime/NGMime/NGMimePartParser.m (révision 1546)
294 +++ sope-mime/NGMime/NGMimePartParser.m (copie de travail)
295 @@ -1091,7 +1091,10 @@
296    id<NGMimeBodyParser> bodyParser   = nil;
297    
298    ctype = [_p contentType];
299 -  
300 +  if (!ctype
301 +      && self->delegateRespondsTo.parserContentTypeOfPart)
302 +    ctype = [self->delegate parser: self contentTypeOfPart: _p];
303 +
304    contentType = ([ctype isKindOfClass:[NGMimeType class]])
305      ? ctype
306      : [NGMimeType mimeType:[ctype stringValue]];
307 Index: sope-appserver/NGObjWeb/GNUmakefile.postamble
308 ===================================================================
309 --- sope-appserver/NGObjWeb/GNUmakefile.postamble       (révision 1546)
310 +++ sope-appserver/NGObjWeb/GNUmakefile.postamble       (copie de travail)
311 @@ -23,14 +23,20 @@
312  
313  # install makefiles
314  
315 -after-install ::
316 +after-install :: $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make
317 +
318 +ifneq ($(GNUSTEP_MAKE_VERSION),1.3.0)
319 +after-install :: $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make
320 +endif
321 +
322 +$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make: ngobjweb.make
323         $(MKDIRS) $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/
324         $(INSTALL_DATA) ngobjweb.make $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make
325  
326 -ifneq ($(GNUSTEP_MAKE_VERSION),1.3.0)
327 -after-install ::
328 +$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make: woapp-gs.make
329         $(INSTALL_DATA) woapp-gs.make    \
330                 $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make
331 +
332 +$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make: wobundle-gs.make
333         $(INSTALL_DATA) wobundle-gs.make \
334                 $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make
335 -endif
336 Index: sope-appserver/NGObjWeb/WOContext.m
337 ===================================================================
338 --- sope-appserver/NGObjWeb/WOContext.m (révision 1546)
339 +++ sope-appserver/NGObjWeb/WOContext.m (copie de travail)
340 @@ -64,11 +64,13 @@
341  static BOOL     testNSURLs           = NO;
342  static BOOL     newCURLStyle         = NO;
343  static NSString *WOApplicationSuffix = nil;
344 +static NSURL    *redirectURL         = nil;
345  
346  + (void)initialize {
347    static BOOL    didInit = NO;
348    NSUserDefaults *ud;
349    NSString       *cn;
350 +  NSString       *url;
351  
352    if (didInit) return;
353  
354 @@ -91,6 +93,9 @@
355    debugCursor         = [ud boolForKey:@"WODebugCursor"] ? 1 : 0;
356    debugComponentAwake = [ud boolForKey:@"WODebugComponentAwake"];
357    WOApplicationSuffix = [[ud stringForKey:@"WOApplicationSuffix"] copy];
358 +  url                 = [ud stringForKey:@"WOApplicationRedirectURL"];
359 +  if (url != nil)
360 +    redirectURL       = [NSURL URLWithString: url];
361  }
362  
363  + (id)contextWithRequest:(WORequest *)_r {
364 @@ -503,6 +508,11 @@
365      return nil;
366    }
367    
368 +  if (redirectURL) {
369 +    // Use URL from user defaults (WOApplicationRedirectURL)
370 +    return redirectURL;
371 +  }
372 +  
373    if ((serverURL = [rq headerForKey:@"x-webobjects-server-url"]) == nil) {
374      if ((host = [rq headerForKey:@"host"]))
375        serverURL = [@"http://" stringByAppendingString:host];
376 Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m
377 ===================================================================
378 --- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m   (révision 1546)
379 +++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m   (copie de travail)
380 @@ -216,6 +216,12 @@
381        assocCount++;
382      }
383    }
384 +  if (count > 0) {
385 +    if ((self->isAbsolute = OWGetProperty(_config, @"absolute"))) {
386 +      count--;
387 +      assocCount++;
388 +    }
389 +  }
390    
391    self->rest = _config;
392    
393 Index: sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m
394 ===================================================================
395 --- sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m       (révision 1546)
396 +++ sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m       (copie de travail)
397 @@ -40,6 +40,7 @@
398    WOAssociation *string;
399    WOAssociation *target;
400    WOAssociation *disabled;
401 +  WOAssociation *isAbsolute;
402    WOElement     *template;
403    
404    /* new in WO4: */
405 @@ -359,6 +360,7 @@
406  {
407    if ((self = [super initWithName:_name hyperlinkInfo:_info template:_t])) {
408      self->href = _info->href;
409 +    self->isAbsolute = _info->isAbsolute;
410    }
411    return self;
412  }
413 @@ -374,6 +376,9 @@
414    // TODO: we need a binding to disable rewriting!
415    NSRange  r;
416    
417 +  if ([[self->isAbsolute valueInContext:_ctx] boolValue] == YES)
418 +    return NO;
419 +
420    r = [_s rangeOfString:@":"];
421    if (r.length == 0) 
422      return YES;
423 Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h
424 ===================================================================
425 --- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h   (révision 1546)
426 +++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h   (copie de travail)
427 @@ -41,7 +41,8 @@
428    WOAssociation *pageName;
429    WOAssociation *actionClass;
430    WOAssociation *directActionName;
431 -  
432 +  WOAssociation *isAbsolute;
433 +
434    BOOL          sidInUrl;
435  
436    /* 'ivar' associations */
437 Index: sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m
438 ===================================================================
439 --- sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m   (révision 1546)
440 +++ sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m   (copie de travail)
441 @@ -31,6 +31,7 @@
442  #include <NGObjWeb/WOCookie.h>
443  #include <NGExtensions/NSData+gzip.h>
444  #include <NGHttp/NGHttp.h>
445 +#include <NGMime/NGMimeType.h>
446  #include "common.h"
447  
448  #include <string.h>
449 @@ -1016,6 +1017,12 @@
450  - (void)parser:(NGMimePartParser *)_parser didParseHeader:(NGHashMap *)_header {
451  }
452  
453 +- (NGMimeType *)parser:(id)_parser
454 +  contentTypeOfPart:(id<NGMimePart>)_part
455 +{
456 +  return [NGMimeType mimeType: @"text/plain; charset=utf-8"];
457 +}
458 +
459  @end /* WOHttpAdaptor */
460  
461  @implementation WOCoreApplication(SimpleParserSelection)