/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: 2010-12-16 00:19:44 UTC
  • Revision ID: edam@waxworlds.org-20101216001944-qlco39lczyaijxhf
-  updated NEWS

Show diffs side-by-side

added added

removed removed

350
350
                        }
351
351
 
352
352
                        // ignore empty lines
353
 
                        if( line.trim().equals( "" ) ) return;
 
353
                        if( line.trim() == "" ) return;
354
354
 
355
355
                        // split line into name and value parts (this may turn out to be
356
356
                        // unwanted if the line is a subsequent line in a multi-line
431
431
                                }
432
432
                                else
433
433
                                {
 
434
                                        // ignore empty values
 
435
                                        if( string_value.length() < 1 ) return;
 
436
 
434
437
                                        // calculate how many chars to skip from beginning of line
435
438
                                        // so we skip the property "name:" part
436
439
                                        int pos = buffer.position() + name_and_params.length() + 1;
474
477
                                if( encoding != null && encoding.equals( "QUOTED-PRINTABLE" ) )
475
478
                                        unencoding_result = unencodeQuotedPrintable( value );
476
479
//                              else if( encoding != null && encoding.equals( "BASE64" ) )
477
 
//                                      unencoding_result = unencodeBase64( props[ 1 ], charset );
 
480
//                                      result = unencodeBase64( props[ 1 ], charset );
478
481
                                if( unencoding_result != null ) {
479
482
                                        value = unencoding_result.getBuffer();
480
483
                                        _parser_in_multiline =
482
485
                                }
483
486
 
484
487
                                // convert 8-bit ASCII charset to US-ASCII
485
 
                                if( charset == null || charset.equals( "ASCII" ) ) {
 
488
                                if( charset == null || charset == "ASCII" ) {
486
489
                                        value = transcodeAsciiToUtf8( value );
487
490
                                        charset = "UTF-8";
488
491
                                }
506
509
                                String complete_value =
507
510
                                        _parser_buffered_value_so_far + string_value;
508
511
 
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(
657
 
                                        "^" + name + "[ \\t]*=[ \\t]*(\"?)(.*)\\1$" );
 
656
                        Pattern p = Pattern.compile( "^" + name + "[ \\t]*=[ \\t]*(.*)$" );
658
657
                        for( int i = 0; i < params.length; i++ ) {
659
658
                                Matcher m = p.matcher( params[ i ] );
660
659
                                if( m.matches() )
661
 
                                        return m.group( 2 );
 
660
                                        return m.group( 1 );
662
661
                        }
663
662
                        return null;
664
663
                }