/android/import-contacts

To get this branch, use:
bzr branch http://bzr.ed.am/android/import-contacts

« back to all changes in this revision

Viewing changes to src/org/waxworlds/edam/importcontacts/VCFImporter.java

  • Committer: edam
  • Date: 2011-03-13 18:58:52 UTC
  • Revision ID: edam@waxworlds.org-20110313185852-s74kvkbv8k0v0lwc
- accept parameters that are quoted (this doesn't appear to be part of the standards AFAICT, but Evolution apparently quotes parameter values)

Show diffs side-by-side

added added

removed removed

431
431
                                }
432
432
                                else
433
433
                                {
434
 
                                        // ignore empty values
435
 
                                        if( string_value.length() < 1 ) return;
436
 
 
437
434
                                        // calculate how many chars to skip from beginning of line
438
435
                                        // so we skip the property "name:" part
439
436
                                        int pos = buffer.position() + name_and_params.length() + 1;
477
474
                                if( encoding != null && encoding.equals( "QUOTED-PRINTABLE" ) )
478
475
                                        unencoding_result = unencodeQuotedPrintable( value );
479
476
//                              else if( encoding != null && encoding.equals( "BASE64" ) )
480
 
//                                      result = unencodeBase64( props[ 1 ], charset );
 
477
//                                      unencoding_result = unencodeBase64( props[ 1 ], charset );
481
478
                                if( unencoding_result != null ) {
482
479
                                        value = unencoding_result.getBuffer();
483
480
                                        _parser_in_multiline =
509
506
                                String complete_value =
510
507
                                        _parser_buffered_value_so_far + string_value;
511
508
 
 
509
                                // ignore empty values
 
510
                                if( complete_value.length() < 1 ) return;
 
511
 
512
512
                                // parse some properties
513
513
                                if( name_param_parts[ 0 ].equals( "N" ) )
514
514
                                        parseN( name_param_parts, complete_value );
653
653
 
654
654
                private String checkParam( String[] params, String name )
655
655
                {
656
 
                        Pattern p = Pattern.compile( "^" + name + "[ \\t]*=[ \\t]*(.*)$" );
 
656
                        Pattern p = Pattern.compile(
 
657
                                        "^" + name + "[ \\t]*=[ \\t]*(\"?)(.*)\\1$" );
657
658
                        for( int i = 0; i < params.length; i++ ) {
658
659
                                Matcher m = p.matcher( params[ i ] );
659
660
                                if( m.matches() )
660
 
                                        return m.group( 1 );
 
661
                                        return m.group( 2 );
661
662
                        }
662
663
                        return null;
663
664
                }