View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001340 | SOGo | Web Calendar | public | 2011-06-21 13:37 | 2012-08-27 15:51 |
| Reporter | mra | Assigned To | francis | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | 1.3.7a | ||||
| Target Version | 1.3.18 | ||||
| Summary | 0001340: Calendar Invitiation with strange splitted Email-Sender | ||||
| Description |
Now:
I. E.: This behaviour can be seen in LDAP and Database-driven SOGos. | ||||
| Tags | invite | ||||
|
2011-06-21 13:37
|
|
|
2011-06-21 13:39
|
|
|
2011-06-21 13:43
|
|
|
Please consider the order of the screenshots which illustrate the issue.
|
|
|
The file 'NGMailAddressParser.m' in SOPE seems to be a little buggy and splits not correct. Will search a solution. |
|
|
I'm working on a patch. |
|
|
Any update on the patch? |
|
|
Sorry, had to make a break (private issue, newborn in house ;-) ), but is on my list. |
|
|
Any update? |
|
|
Want to make a solution on january, had found the error, but a possible solution could be a rewrite of the class (worst case) where the error is. |
|
|
Ok, studied the code, tried some hacks and did come to the opinion, its better to reimplement that class - too much old code in C what IMHO could be made nicer in OOP with objc. Some greps over SOPE/SOGo-src-tree showed me, there are relativly little dependencies on some methods (better: method calls) so the idea is to replace the old class with the new which only implements the called methods (public scope, I think). |
|
|
Hello, we have the same problem when the name contains brackets. esco |
|
|
New note: same problem in the list of mails (Inbox etc.). Sorry, so far I hadn't time to write the suggested code ... :-/ Still the best solution is IMHO a rewrite. |
|
|
Still in heavy work ... but thinking on the problem. |
|
|
Attached my patch for this issue, which works pretty well (created against SOGo-2.0-Code, but runs IMHO in 1.3.17|.18 ..., too) |
|
|
2012-08-02 10:05
|
patch_for_NGMailAddressParser.diff (4,863 bytes)
#
# old_revision [9fcf97eb10d5be9ee65cc8ce8bf5651e02b25534]
#
# patch "sope-mime/NGMail/NGMailAddressParser.h"
# from [24b3288dfb1dd3b55db39562b58c17f89760960c]
# to [7594a40e7152dc0dfe5f6e8fecb20fdce0895b4b]
#
# patch "sope-mime/NGMail/NGMailAddressParser.m"
# from [79eb483d27176206aaa9ec109fab7b99957ee30f]
# to [a9d54e0521c106939819dc163c2a08657ae22ad2]
#
============================================================
--- sope-mime/NGMail/NGMailAddressParser.h 24b3288dfb1dd3b55db39562b58c17f89760960c
+++ sope-mime/NGMail/NGMailAddressParser.h 7594a40e7152dc0dfe5f6e8fecb20fdce0895b4b
@@ -46,6 +46,7 @@
+ (id)mailAddressParserWithData:(NSData *)_data;
+ (id)mailAddressParserWithCString:(const char *)_cString;
- (id)initWithString:(NSString *)_str;
++ (id)sanitizeMailAddresses:(NSString *)_string;
/* parsing */
============================================================
--- sope-mime/NGMail/NGMailAddressParser.m 79eb483d27176206aaa9ec109fab7b99957ee30f
+++ sope-mime/NGMail/NGMailAddressParser.m a9d54e0521c106939819dc163c2a08657ae22ad2
@@ -362,12 +362,110 @@ static inline id parseDomainLiteral(NGMa
}
+ (id)mailAddressParserWithString:(NSString *)_string {
- return [[(NGMailAddressParser *)[self alloc] initWithString:_string]
+
+ return [[(NGMailAddressParser *)[self alloc] initWithString: [NGMailAddressParser sanitizeMailAddresses:_string]]
autorelease];
}
++ (id) sanitizeMailAddresses:(NSString *)_string {
+
+ // Before init ... full replacement of quotes and double quotes - we don't need them anymore ;-)
+ NSMutableString* _addr = [NSMutableString stringWithString:_string];
+ [_addr replaceString:@"'" withString:@""];
+ [_addr replaceString:@"\"" withString:@""];
+ NSString* addresses = (NSString *)_addr;
+
+ // Init
+ BOOL isDisplayNameEnd = NO;
+ BOOL hasAt = NO;
+ long lastPos = 0;
+ long displayNameEndPos = 0;
+ long mailEndPos = 0;
+ long len = [addresses length];
+ NSString* mailAdr= @"";
+ NSString* displayName = @"";
+ NSMutableArray* _addressList = [NSMutableArray arrayWithCapacity:1];
+
+
+ // step through the chars
+ long i;
+ for (i=0; i < len; i++) {
+ char cai = [addresses characterAtIndex:i]; // get every char
+
+ if(cai == ' ') continue; // skip spaces
+
+
+ if (cai == '@') {
+ hasAt = YES;
+ continue;
+ }
+
+ if(cai == '<')
+ {
+ isDisplayNameEnd = YES;
+ displayNameEndPos = i;
+ }
+
+ if(cai == '>')
+ {
+ mailEndPos = i;
+ }
+
+ if ((cai == ',' && hasAt) || ((i + 1) == len)) {
+
+ mailAdr = @"";
+ displayName = @"";
+
+ if(isDisplayNameEnd)
+ {
+ displayName = [[addresses substringWithRange: NSMakeRange(lastPos, displayNameEndPos - lastPos)] stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
+ }
+
+ // If there a displayname, get mailAdr on an other way
+ if([displayName length] > 0)
+ {
+ mailAdr = [[addresses stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]] substringWithRange: NSMakeRange(displayNameEndPos + 1, mailEndPos - displayNameEndPos - 1)];
+ }
+ else
+ {
+ mailAdr = [[addresses substringWithRange: NSMakeRange(lastPos, i-lastPos)] stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
+ }
+
+ // trim spaces of mailAdr
+ mailAdr = [mailAdr stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
+
+
+ // Format new mail string into an array
+ if([displayName length] == 0)
+ {
+ [_addressList addObject: [NSString stringWithFormat:@"%@",mailAdr]];
+ }
+ else
+ {
+ [_addressList addObject: [NSString stringWithFormat:@"\"%@\" <%@>",displayName,mailAdr]];
+ }
+
+
+ // Reset and set
+ lastPos = i+1;
+ hasAt = NO;
+ isDisplayNameEnd = NO;
+
+ // next step ;-)
+ continue;
+ }
+
+ }
+
+ // Concatenate the array items to a string by comma and returns it
+ return [_addressList componentsJoinedByString:@","];
+}
+
- (id)initWithString:(NSString *)_str {
if ((self = [super init])) {
+
+ _str = [NGMailAddressParser sanitizeMailAddresses:_str];
+
// TODO: remember some string encoding?
self->maxLength = [_str length];
self->data = malloc(self->maxLength*sizeof(unichar));
|
|
Fixed in 511791fc5bfb5cf1f56266a5c55753aa26f958b8. Thanks for the patch! |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2011-06-21 13:37 | mra | New Issue | |
| 2011-06-21 13:37 | mra | File Added: name-splitting-in-email-addresses01.png | |
| 2011-06-21 13:39 | mra | File Added: name-splitting-in-email-addresses02.png | |
| 2011-06-21 13:43 | mra | File Added: name-splitting-in-email-addresses03.png | |
| 2011-06-21 13:43 | mra | Note Added: 0002614 | |
| 2011-06-21 13:45 | mra | Note Edited: 0002614 | |
| 2011-06-21 13:46 | mra | Note Edited: 0002614 | |
| 2011-06-21 13:46 | mra | Tag Attached: invite | |
| 2011-07-28 20:43 | mra | Note Added: 0002754 | |
| 2011-08-18 05:39 | mra | Note Added: 0002808 | |
| 2011-11-24 20:39 | ludovic | Note Added: 0003070 | |
| 2011-11-24 22:47 | mra | Note Added: 0003078 | |
| 2011-12-30 16:55 | ludovic | Note Added: 0003229 | |
| 2011-12-30 21:06 | mra | Note Added: 0003244 | |
| 2012-01-20 13:56 | mra | Note Added: 0003299 | |
| 2012-04-13 13:34 | esco | Note Added: 0003731 | |
| 2012-04-19 13:08 | mra | Note Added: 0003775 | |
| 2012-07-10 17:15 | mra | Note Added: 0004119 | |
| 2012-08-02 10:04 | mra | Note Added: 0004244 | |
| 2012-08-02 10:05 | mra | File Added: patch_for_NGMailAddressParser.diff | |
| 2012-08-03 19:21 | francis | Target Version | => 1.3.18 |
| 2012-08-27 15:09 | francis | Status | new => assigned |
| 2012-08-27 15:09 | francis | Assigned To | => francis |
| 2012-08-27 15:51 | francis | Note Added: 0004381 | |
| 2012-08-27 15:51 | francis | Status | assigned => resolved |
| 2012-08-27 15:51 | francis | Resolution | open => fixed |