~ubuntu-branches/ubuntu/oneiric/haxe/oneiric

« back to all changes in this revision

Viewing changes to haxe/std/mtwin/mail/imap/BodyStructure.hx

  • Committer: Bazaar Package Importer
  • Author(s): Jens Peter Secher
  • Date: 2008-06-15 11:04:09 UTC
  • mfrom: (2.1.6 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080615110409-7pyykgwmk5v0cues
Tags: 1:1.19-3
* Remove bashism in script.
  (Closes: #484390)
* Upgrade to Policy 3.8.0 by including a README.source explaining how to
  use dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
                params = new Hash();
48
48
        }
49
49
 
50
 
        public function getMainPart( ?level : Int, ?priority : Int, ?cpriority : Int ) : BodyStructure {
 
50
        public function getMainPart( ?preferHtml : Bool, ?level : Int, ?priority : Int, ?cpriority : Int ) : BodyStructure {
51
51
                if( level == null ) level = 0;
52
52
                if( priority == null ) priority = 0;
53
53
                if( cpriority == null ) cpriority = 0;
 
54
                if( preferHtml == null ) preferHtml = true;
54
55
 
55
56
                if( ctype0 != "multipart" || (level == 0 && parts.length == 0) ){
56
57
                        if( level == 0 ) return this;
57
 
                        if( ctype1 == "html" ) return this;
58
 
                        if( ctype1 == "plain" && cpriority > 0 ) return this;
 
58
                        if( preferHtml ){
 
59
                                if( ctype1 == "html" ) return this;
 
60
                                if( ctype1 == "plain" && cpriority > 0 ) return this;
 
61
                        }else{
 
62
                                if( ctype1 == "plain" ) return this;
 
63
                                if( ctype1 == "html" && cpriority > 0 ) return this;
 
64
                        }
59
65
                }else{
60
66
                        if( level == 0 ){
61
67
                                // multipart !
64
70
                                        do {
65
71
                                                var r = null;
66
72
                                                for( part in parts ){
67
 
                                                        r = part.getMainPart( level + 1, priority, cpriority );
 
73
                                                        r = part.getMainPart( preferHtml, level + 1, priority, cpriority );
68
74
                                                        if( r != null ) break;
69
75
                                                }
70
76
                                                if( r != null ) return r;
77
83
                                if( ctype1 == "alternative" || priority > 0 ){
78
84
                                        var r = null;
79
85
                                        for( part in parts ){
80
 
                                                r = part.getMainPart( level + 1, priority, cpriority );
 
86
                                                r = part.getMainPart( preferHtml, level + 1, priority, cpriority );
81
87
                                                if( r != null ) return r;
82
88
                                        }
83
89
                                }
141
147
                                                        if( tmp.pName == null ) 
142
148
                                                                tmp.pName = e;
143
149
                                                        else{
144
 
                                                                ret.params.set(tmp.pName,e);
 
150
                                                                ret.params.set(tmp.pName.toLowerCase(),e);
145
151
                                                                tmp.pName = null;
146
152
                                                        }
147
153
                                                case 4:
153
159
                                                        if( tmp.pName == null ) 
154
160
                                                                tmp.pName = e;
155
161
                                                        else{
156
 
                                                                ret.params.set(tmp.pName,e);
 
162
                                                                ret.params.set(tmp.pName.toLowerCase(),e);
157
163
                                                                tmp.pName = null;
158
164
                                                        }
159
165
                                                case 2: