author | alwin <alwin> | 2003-12-10 20:33:31 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-10 20:33:31 (UTC) |
commit | 7dc6ff83f138c78b6bd5e8a4d922a6e60c533a1f (patch) (unidiff) | |
tree | c3f53894691dd71cbdf05e69603f7ac55ea2474c /noncore/net/mail/libmailwrapper | |
parent | 66aa51039689ab2dab153469d7f6527bcedd9318 (diff) | |
download | opie-7dc6ff83f138c78b6bd5e8a4d922a6e60c533a1f.zip opie-7dc6ff83f138c78b6bd5e8a4d922a6e60c533a1f.tar.gz opie-7dc6ff83f138c78b6bd5e8a4d922a6e60c533a1f.tar.bz2 |
changes to work with libetpan 0.3.1
Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.cpp | 50 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 52 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 1 |
3 files changed, 52 insertions, 51 deletions
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index 898e9d6..3ffc274 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp | |||
@@ -197,7 +197,7 @@ mailmime *MailWrapper::buildTxtPart( QString str ) | |||
197 | content = mailmime_content_new_with_str( "text/plain" ); | 197 | content = mailmime_content_new_with_str( "text/plain" ); |
198 | if ( content == NULL ) goto err_free_param; | 198 | if ( content == NULL ) goto err_free_param; |
199 | 199 | ||
200 | err = clist_append( content->parameters, param ); | 200 | err = clist_append( content->ct_parameters, param ); |
201 | if ( err != MAILIMF_NO_ERROR ) goto err_free_content; | 201 | if ( err != MAILIMF_NO_ERROR ) goto err_free_content; |
202 | 202 | ||
203 | fields = mailmime_fields_new_encoding( MAILMIME_MECHANISM_8BIT ); | 203 | fields = mailmime_fields_new_encoding( MAILMIME_MECHANISM_8BIT ); |
@@ -253,7 +253,7 @@ mailmime *MailWrapper::buildFilePart( QString filename, QString mimetype ) | |||
253 | strdup( "iso-8859-1" ) ); | 253 | strdup( "iso-8859-1" ) ); |
254 | if ( param == NULL ) goto err_free_content; | 254 | if ( param == NULL ) goto err_free_content; |
255 | 255 | ||
256 | err = clist_append( content->parameters, param ); | 256 | err = clist_append( content->ct_parameters, param ); |
257 | if ( err != MAILIMF_NO_ERROR ) goto err_free_param; | 257 | if ( err != MAILIMF_NO_ERROR ) goto err_free_param; |
258 | } | 258 | } |
259 | 259 | ||
@@ -347,10 +347,10 @@ mailimf_field *MailWrapper::getField( mailimf_fields *fields, int type ) | |||
347 | mailimf_field *field; | 347 | mailimf_field *field; |
348 | clistiter *it; | 348 | clistiter *it; |
349 | 349 | ||
350 | it = clist_begin( fields->list ); | 350 | it = clist_begin( fields->fld_list ); |
351 | while ( it ) { | 351 | while ( it ) { |
352 | field = (mailimf_field *) it->data; | 352 | field = (mailimf_field *) it->data; |
353 | if ( field->type == type ) { | 353 | if ( field->fld_type == type ) { |
354 | return field; | 354 | return field; |
355 | } | 355 | } |
356 | it = it->next; | 356 | it = it->next; |
@@ -363,18 +363,18 @@ static void addRcpts( clist *list, mailimf_address_list *addr_list ) | |||
363 | { | 363 | { |
364 | clistiter *it, *it2; | 364 | clistiter *it, *it2; |
365 | 365 | ||
366 | for ( it = clist_begin( addr_list->list ); it; it = it->next ) { | 366 | for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) { |
367 | mailimf_address *addr; | 367 | mailimf_address *addr; |
368 | addr = (mailimf_address *) it->data; | 368 | addr = (mailimf_address *) it->data; |
369 | 369 | ||
370 | if ( addr->type == MAILIMF_ADDRESS_MAILBOX ) { | 370 | if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) { |
371 | esmtp_address_list_add( list, addr->mailbox->addr_spec, 0, NULL ); | 371 | esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL ); |
372 | } else if ( addr->type == MAILIMF_ADDRESS_GROUP ) { | 372 | } else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) { |
373 | clist *l = addr->group->mb_list->list; | 373 | clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list; |
374 | for ( it2 = clist_begin( l ); it2; it2 = it2->next ) { | 374 | for ( it2 = clist_begin( l ); it2; it2 = it2->next ) { |
375 | mailimf_mailbox *mbox; | 375 | mailimf_mailbox *mbox; |
376 | mbox = (mailimf_mailbox *) it2->data; | 376 | mbox = (mailimf_mailbox *) it2->data; |
377 | esmtp_address_list_add( list, mbox->addr_spec, 0, NULL ); | 377 | esmtp_address_list_add( list, mbox->mb_addr_spec, 0, NULL ); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | } | 380 | } |
@@ -388,21 +388,21 @@ clist *MailWrapper::createRcptList( mailimf_fields *fields ) | |||
388 | rcptList = esmtp_address_list_new(); | 388 | rcptList = esmtp_address_list_new(); |
389 | 389 | ||
390 | field = getField( fields, MAILIMF_FIELD_TO ); | 390 | field = getField( fields, MAILIMF_FIELD_TO ); |
391 | if ( field && (field->type == MAILIMF_FIELD_TO) | 391 | if ( field && (field->fld_type == MAILIMF_FIELD_TO) |
392 | && field->field.to->addr_list ) { | 392 | && field->fld_data.fld_to->to_addr_list ) { |
393 | addRcpts( rcptList, field->field.to->addr_list ); | 393 | addRcpts( rcptList, field->fld_data.fld_to->to_addr_list ); |
394 | } | 394 | } |
395 | 395 | ||
396 | field = getField( fields, MAILIMF_FIELD_CC ); | 396 | field = getField( fields, MAILIMF_FIELD_CC ); |
397 | if ( field && (field->type == MAILIMF_FIELD_CC) | 397 | if ( field && (field->fld_type == MAILIMF_FIELD_CC) |
398 | && field->field.cc->addr_list ) { | 398 | && field->fld_data.fld_cc->cc_addr_list ) { |
399 | addRcpts( rcptList, field->field.cc->addr_list ); | 399 | addRcpts( rcptList, field->fld_data.fld_cc->cc_addr_list ); |
400 | } | 400 | } |
401 | 401 | ||
402 | field = getField( fields, MAILIMF_FIELD_BCC ); | 402 | field = getField( fields, MAILIMF_FIELD_BCC ); |
403 | if ( field && (field->type == MAILIMF_FIELD_BCC) | 403 | if ( field && (field->fld_type == MAILIMF_FIELD_BCC) |
404 | && field->field.bcc->addr_list ) { | 404 | && field->fld_data.fld_bcc->bcc_addr_list ) { |
405 | addRcpts( rcptList, field->field.bcc->addr_list ); | 405 | addRcpts( rcptList, field->fld_data.fld_bcc->bcc_addr_list ); |
406 | } | 406 | } |
407 | 407 | ||
408 | return rcptList; | 408 | return rcptList; |
@@ -413,14 +413,14 @@ char *MailWrapper::getFrom( mailmime *mail ) | |||
413 | char *from = NULL; | 413 | char *from = NULL; |
414 | 414 | ||
415 | mailimf_field *ffrom; | 415 | mailimf_field *ffrom; |
416 | ffrom = getField( mail->fields, MAILIMF_FIELD_FROM ); | 416 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); |
417 | if ( ffrom && (ffrom->type == MAILIMF_FIELD_FROM) | 417 | if ( ffrom && (ffrom->fld_type == MAILIMF_FIELD_FROM) |
418 | && ffrom->field.from->mb_list && ffrom->field.from->mb_list->list ) { | 418 | && ffrom->fld_data.fld_from->frm_mb_list && ffrom->fld_data.fld_from->frm_mb_list->mb_list ) { |
419 | clist *cl = ffrom->field.from->mb_list->list; | 419 | clist *cl = ffrom->fld_data.fld_from->frm_mb_list->mb_list; |
420 | clistiter *it; | 420 | clistiter *it; |
421 | for ( it = clist_begin( cl ); it; it = it->next ) { | 421 | for ( it = clist_begin( cl ); it; it = it->next ) { |
422 | mailimf_mailbox *mb = (mailimf_mailbox *) it->data; | 422 | mailimf_mailbox *mb = (mailimf_mailbox *) it->data; |
423 | from = strdup( mb->addr_spec ); | 423 | from = strdup( mb->mb_addr_spec ); |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
@@ -542,7 +542,7 @@ void MailWrapper::smtpSend( mailmime *mail ) | |||
542 | server = strdup( smtp->getServer().latin1() ); | 542 | server = strdup( smtp->getServer().latin1() ); |
543 | ssl = smtp->getSSL(); | 543 | ssl = smtp->getSSL(); |
544 | port = smtp->getPort().toUInt(); | 544 | port = smtp->getPort().toUInt(); |
545 | rcpts = createRcptList( mail->fields ); | 545 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); |
546 | 546 | ||
547 | QString file = getTmpFile(); | 547 | QString file = getTmpFile(); |
548 | writeToFile( file, mail ); | 548 | writeToFile( file, mail ); |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 72f3c36..633faf6 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -33,14 +33,14 @@ void POP3wrapper::listMessages( QList<RecMail> &target ) | |||
33 | for ( int i = carray_count( messages ); i > 0; i-- ) { | 33 | for ( int i = carray_count( messages ); i > 0; i-- ) { |
34 | mailpop3_msg_info *info = (mailpop3_msg_info *) carray_get( messages, i - 1 ); | 34 | mailpop3_msg_info *info = (mailpop3_msg_info *) carray_get( messages, i - 1 ); |
35 | 35 | ||
36 | err = mailpop3_header( m_pop3, info->index, &header, &length ); | 36 | err = mailpop3_header( m_pop3, info->msg_index, &header, &length ); |
37 | if ( err != MAILPOP3_NO_ERROR ) { | 37 | if ( err != MAILPOP3_NO_ERROR ) { |
38 | qDebug( "POP3: error retrieving header msgid: %i", info->index ); | 38 | qDebug( "POP3: error retrieving header msgid: %i", info->msg_index ); |
39 | logout(); | 39 | logout(); |
40 | return; | 40 | return; |
41 | } | 41 | } |
42 | RecMail *mail = parseHeader( header ); | 42 | RecMail *mail = parseHeader( header ); |
43 | mail->setNumber( info->index ); | 43 | mail->setNumber( info->msg_index ); |
44 | target.append( mail ); | 44 | target.append( mail ); |
45 | } | 45 | } |
46 | 46 | ||
@@ -55,26 +55,26 @@ RecMail *POP3wrapper::parseHeader( const char *header ) | |||
55 | mailimf_fields *fields; | 55 | mailimf_fields *fields; |
56 | 56 | ||
57 | err = mailimf_fields_parse( (char *) header, strlen( header ), &curTok, &fields ); | 57 | err = mailimf_fields_parse( (char *) header, strlen( header ), &curTok, &fields ); |
58 | for ( clistiter *current = clist_begin( fields->list ); current != NULL; current = current->next ) { | 58 | for ( clistiter *current = clist_begin( fields->fld_list ); current != NULL; current = current->next ) { |
59 | mailimf_field *field = (mailimf_field *) current->data; | 59 | mailimf_field *field = (mailimf_field *) current->data; |
60 | switch ( field->type ) { | 60 | switch ( field->fld_type ) { |
61 | case MAILIMF_FIELD_FROM: | 61 | case MAILIMF_FIELD_FROM: |
62 | mail->setFrom( *parseMailboxList( field->field.from->mb_list ) ); | 62 | mail->setFrom( *parseMailboxList( field->fld_data.fld_from->frm_mb_list ) ); |
63 | break; | 63 | break; |
64 | case MAILIMF_FIELD_TO: | 64 | case MAILIMF_FIELD_TO: |
65 | mail->setTo( *parseAddressList( field->field.to->addr_list ) ); | 65 | mail->setTo( *parseAddressList( field->fld_data.fld_to->to_addr_list ) ); |
66 | break; | 66 | break; |
67 | case MAILIMF_FIELD_CC: | 67 | case MAILIMF_FIELD_CC: |
68 | mail->setCC( *parseAddressList( field->field.cc->addr_list ) ); | 68 | mail->setCC( *parseAddressList( field->fld_data.fld_cc->cc_addr_list ) ); |
69 | break; | 69 | break; |
70 | case MAILIMF_FIELD_BCC: | 70 | case MAILIMF_FIELD_BCC: |
71 | mail->setBcc( *parseAddressList( field->field.bcc->addr_list ) ); | 71 | mail->setBcc( *parseAddressList( field->fld_data.fld_bcc->bcc_addr_list ) ); |
72 | break; | 72 | break; |
73 | case MAILIMF_FIELD_SUBJECT: | 73 | case MAILIMF_FIELD_SUBJECT: |
74 | mail->setSubject( QString( field->field.subject->value ) ); | 74 | mail->setSubject( QString( field->fld_data.fld_subject->sbj_value ) ); |
75 | break; | 75 | break; |
76 | case MAILIMF_FIELD_ORIG_DATE: | 76 | case MAILIMF_FIELD_ORIG_DATE: |
77 | mail->setDate( *parseDateTime( field->field.orig_date->date_time ) ); | 77 | mail->setDate( *parseDateTime( field->fld_data.fld_orig_date->dt_date_time ) ); |
78 | break; | 78 | break; |
79 | default: | 79 | default: |
80 | break; | 80 | break; |
@@ -89,7 +89,7 @@ QString *POP3wrapper::parseDateTime( mailimf_date_time *date ) | |||
89 | char tmp[23]; | 89 | char tmp[23]; |
90 | 90 | ||
91 | snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", | 91 | snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", |
92 | date->day, date->month, date->year, date->hour, date->min, date->sec, date->zone ); | 92 | date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); |
93 | 93 | ||
94 | QString *result = new QString( tmp ); | 94 | QString *result = new QString( tmp ); |
95 | 95 | ||
@@ -101,7 +101,7 @@ QString *POP3wrapper::parseAddressList( mailimf_address_list *list ) | |||
101 | QString *result = new QString( "" ); | 101 | QString *result = new QString( "" ); |
102 | 102 | ||
103 | bool first = true; | 103 | bool first = true; |
104 | for ( clistiter *current = clist_begin( list->list ); current != NULL; current = current->next ) { | 104 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { |
105 | mailimf_address *addr = (mailimf_address *) current->data; | 105 | mailimf_address *addr = (mailimf_address *) current->data; |
106 | 106 | ||
107 | if ( !first ) { | 107 | if ( !first ) { |
@@ -112,14 +112,14 @@ QString *POP3wrapper::parseAddressList( mailimf_address_list *list ) | |||
112 | 112 | ||
113 | QString *tmp; | 113 | QString *tmp; |
114 | 114 | ||
115 | switch ( addr->type ) { | 115 | switch ( addr->ad_type ) { |
116 | case MAILIMF_ADDRESS_MAILBOX: | 116 | case MAILIMF_ADDRESS_MAILBOX: |
117 | tmp = parseMailbox( addr->mailbox ); | 117 | tmp = parseMailbox( addr->ad_data.ad_mailbox ); |
118 | result->append( *tmp ); | 118 | result->append( *tmp ); |
119 | delete tmp; | 119 | delete tmp; |
120 | break; | 120 | break; |
121 | case MAILIMF_ADDRESS_GROUP: | 121 | case MAILIMF_ADDRESS_GROUP: |
122 | tmp = parseGroup( addr->group ); | 122 | tmp = parseGroup( addr->ad_data.ad_group ); |
123 | result->append( *tmp ); | 123 | result->append( *tmp ); |
124 | delete tmp; | 124 | delete tmp; |
125 | break; | 125 | break; |
@@ -136,11 +136,11 @@ QString *POP3wrapper::parseGroup( mailimf_group *group ) | |||
136 | { | 136 | { |
137 | QString *result = new QString( "" ); | 137 | QString *result = new QString( "" ); |
138 | 138 | ||
139 | result->append( group->display_name ); | 139 | result->append( group->grp_display_name ); |
140 | result->append( ": " ); | 140 | result->append( ": " ); |
141 | 141 | ||
142 | if ( group->mb_list != NULL ) { | 142 | if ( group->grp_mb_list != NULL ) { |
143 | QString *tmp = parseMailboxList( group->mb_list ); | 143 | QString *tmp = parseMailboxList( group->grp_mb_list ); |
144 | result->append( *tmp ); | 144 | result->append( *tmp ); |
145 | delete tmp; | 145 | delete tmp; |
146 | } | 146 | } |
@@ -154,12 +154,12 @@ QString *POP3wrapper::parseMailbox( mailimf_mailbox *box ) | |||
154 | { | 154 | { |
155 | QString *result = new QString( "" ); | 155 | QString *result = new QString( "" ); |
156 | 156 | ||
157 | if ( box->display_name == NULL ) { | 157 | if ( box->mb_display_name == NULL ) { |
158 | result->append( box->addr_spec ); | 158 | result->append( box->mb_addr_spec ); |
159 | } else { | 159 | } else { |
160 | result->append( box->display_name ); | 160 | result->append( box->mb_display_name ); |
161 | result->append( " <" ); | 161 | result->append( " <" ); |
162 | result->append( box->addr_spec ); | 162 | result->append( box->mb_addr_spec ); |
163 | result->append( ">" ); | 163 | result->append( ">" ); |
164 | } | 164 | } |
165 | 165 | ||
@@ -171,7 +171,7 @@ QString *POP3wrapper::parseMailboxList( mailimf_mailbox_list *list ) | |||
171 | QString *result = new QString( "" ); | 171 | QString *result = new QString( "" ); |
172 | 172 | ||
173 | bool first = true; | 173 | bool first = true; |
174 | for ( clistiter *current = clist_begin( list->list ); current != NULL; current = current->next ) { | 174 | for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { |
175 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; | 175 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; |
176 | 176 | ||
177 | if ( !first ) { | 177 | if ( !first ) { |
@@ -212,7 +212,7 @@ void POP3wrapper::login() | |||
212 | 212 | ||
213 | if ( err != MAILPOP3_NO_ERROR ) { | 213 | if ( err != MAILPOP3_NO_ERROR ) { |
214 | qDebug( "pop3: error connecting to %s\n reason: %s", server, | 214 | qDebug( "pop3: error connecting to %s\n reason: %s", server, |
215 | m_pop3->response ); | 215 | m_pop3->pop3_response ); |
216 | mailpop3_free( m_pop3 ); | 216 | mailpop3_free( m_pop3 ); |
217 | m_pop3 = NULL; | 217 | m_pop3 = NULL; |
218 | return; | 218 | return; |
@@ -223,7 +223,7 @@ void POP3wrapper::login() | |||
223 | // TODO: decide if apop or plain login should be used | 223 | // TODO: decide if apop or plain login should be used |
224 | err = mailpop3_login( m_pop3, (char *) user, (char *) pass ); | 224 | err = mailpop3_login( m_pop3, (char *) user, (char *) pass ); |
225 | if ( err != MAILPOP3_NO_ERROR ) { | 225 | if ( err != MAILPOP3_NO_ERROR ) { |
226 | qDebug( "pop3: error logging in: %s", m_pop3->response ); | 226 | qDebug( "pop3: error logging in: %s", m_pop3->pop3_response ); |
227 | logout(); | 227 | logout(); |
228 | return; | 228 | return; |
229 | } | 229 | } |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index a8937fb..4e4abad 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include "mailwrapper.h" | 4 | #include "mailwrapper.h" |
5 | 5 | ||
6 | class RecMail; | 6 | class RecMail; |
7 | struct mailpop3; | ||
7 | 8 | ||
8 | class POP3wrapper : public QObject | 9 | class POP3wrapper : public QObject |
9 | { | 10 | { |