-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 | ||||
-rw-r--r-- | noncore/net/mail/mailwrapper.cpp | 50 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.cpp | 52 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.h | 1 |
6 files changed, 104 insertions, 102 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 | |||
@@ -194,13 +194,13 @@ mailmime *MailWrapper::buildTxtPart( QString str ) | |||
194 | strdup( "iso-8859-1" ) ); | 194 | strdup( "iso-8859-1" ) ); |
195 | if ( param == NULL ) goto err_free; | 195 | if ( param == NULL ) goto err_free; |
196 | 196 | ||
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 ); |
204 | if ( fields == NULL ) goto err_free_content; | 204 | if ( fields == NULL ) goto err_free_content; |
205 | 205 | ||
206 | txtPart = mailmime_new_empty( content, fields ); | 206 | txtPart = mailmime_new_empty( content, fields ); |
@@ -250,13 +250,13 @@ mailmime *MailWrapper::buildFilePart( QString filename, QString mimetype ) | |||
250 | 250 | ||
251 | if ( mimetype.compare( "text/plain" ) == 0 ) { | 251 | if ( mimetype.compare( "text/plain" ) == 0 ) { |
252 | param = mailmime_parameter_new( strdup( "charset" ), | 252 | param = mailmime_parameter_new( strdup( "charset" ), |
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 | ||
260 | filePart = mailmime_new_empty( content, fields ); | 260 | filePart = mailmime_new_empty( content, fields ); |
261 | if ( filePart == NULL ) goto err_free_param; | 261 | if ( filePart == NULL ) goto err_free_param; |
262 | 262 | ||
@@ -344,40 +344,40 @@ err_free: | |||
344 | 344 | ||
345 | mailimf_field *MailWrapper::getField( mailimf_fields *fields, int type ) | 345 | mailimf_field *MailWrapper::getField( mailimf_fields *fields, int type ) |
346 | { | 346 | { |
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; |
357 | } | 357 | } |
358 | 358 | ||
359 | return NULL; | 359 | return NULL; |
360 | } | 360 | } |
361 | 361 | ||
362 | static void addRcpts( clist *list, mailimf_address_list *addr_list ) | 362 | 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 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | clist *MailWrapper::createRcptList( mailimf_fields *fields ) | 383 | clist *MailWrapper::createRcptList( mailimf_fields *fields ) |
@@ -385,45 +385,45 @@ clist *MailWrapper::createRcptList( mailimf_fields *fields ) | |||
385 | clist *rcptList; | 385 | clist *rcptList; |
386 | mailimf_field *field; | 386 | mailimf_field *field; |
387 | 387 | ||
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; |
409 | } | 409 | } |
410 | 410 | ||
411 | char *MailWrapper::getFrom( mailmime *mail ) | 411 | char *MailWrapper::getFrom( mailmime *mail ) |
412 | { | 412 | { |
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 | ||
427 | return from; | 427 | return from; |
428 | } | 428 | } |
429 | 429 | ||
@@ -539,13 +539,13 @@ void MailWrapper::smtpSend( mailmime *mail ) | |||
539 | free(from); | 539 | free(from); |
540 | return; | 540 | return; |
541 | } | 541 | } |
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 ); |
549 | readFromFile( file, &data, &size ); | 549 | readFromFile( file, &data, &size ); |
550 | QFile f( file ); | 550 | QFile f( file ); |
551 | f.remove(); | 551 | f.remove(); |
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 | |||
@@ -30,20 +30,20 @@ void POP3wrapper::listMessages( QList<RecMail> &target ) | |||
30 | if (!m_pop3) return; | 30 | if (!m_pop3) return; |
31 | mailpop3_list( m_pop3, &messages ); | 31 | mailpop3_list( m_pop3, &messages ); |
32 | 32 | ||
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 | ||
47 | logout(); | 47 | logout(); |
48 | } | 48 | } |
49 | 49 | ||
@@ -52,32 +52,32 @@ RecMail *POP3wrapper::parseHeader( const char *header ) | |||
52 | int err = MAILIMF_NO_ERROR; | 52 | int err = MAILIMF_NO_ERROR; |
53 | size_t curTok; | 53 | size_t curTok; |
54 | RecMail *mail = new RecMail(); | 54 | RecMail *mail = new RecMail(); |
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; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
@@ -86,43 +86,43 @@ RecMail *POP3wrapper::parseHeader( const char *header ) | |||
86 | 86 | ||
87 | QString *POP3wrapper::parseDateTime( mailimf_date_time *date ) | 87 | QString *POP3wrapper::parseDateTime( mailimf_date_time *date ) |
88 | { | 88 | { |
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 | ||
96 | return result; | 96 | return result; |
97 | } | 97 | } |
98 | 98 | ||
99 | QString *POP3wrapper::parseAddressList( mailimf_address_list *list ) | 99 | QString *POP3wrapper::parseAddressList( mailimf_address_list *list ) |
100 | { | 100 | { |
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 ) { |
108 | result->append( "," ); | 108 | result->append( "," ); |
109 | } else { | 109 | } else { |
110 | first = false; | 110 | first = false; |
111 | } | 111 | } |
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; |
126 | default: | 126 | default: |
127 | qDebug( "POP3: unkown mailimf address type" ); | 127 | qDebug( "POP3: unkown mailimf address type" ); |
128 | break; | 128 | break; |
@@ -133,17 +133,17 @@ QString *POP3wrapper::parseAddressList( mailimf_address_list *list ) | |||
133 | } | 133 | } |
134 | 134 | ||
135 | QString *POP3wrapper::parseGroup( mailimf_group *group ) | 135 | 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 | } |
147 | 147 | ||
148 | result->append( ";" ); | 148 | result->append( ";" ); |
149 | 149 | ||
@@ -151,30 +151,30 @@ QString *POP3wrapper::parseGroup( mailimf_group *group ) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | QString *POP3wrapper::parseMailbox( mailimf_mailbox *box ) | 153 | 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 | ||
166 | return result; | 166 | return result; |
167 | } | 167 | } |
168 | 168 | ||
169 | QString *POP3wrapper::parseMailboxList( mailimf_mailbox_list *list ) | 169 | QString *POP3wrapper::parseMailboxList( mailimf_mailbox_list *list ) |
170 | { | 170 | { |
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 ) { |
178 | result->append( "," ); | 178 | result->append( "," ); |
179 | } else { | 179 | } else { |
180 | first = false; | 180 | first = false; |
@@ -209,24 +209,24 @@ void POP3wrapper::login() | |||
209 | } else { | 209 | } else { |
210 | err = mailpop3_socket_connect( m_pop3, (char*)server, port ); | 210 | err = mailpop3_socket_connect( m_pop3, (char*)server, port ); |
211 | } | 211 | } |
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; |
219 | } | 219 | } |
220 | qDebug( "POP3: connected!" ); | 220 | qDebug( "POP3: connected!" ); |
221 | 221 | ||
222 | // login | 222 | // 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 | } |
230 | 230 | ||
231 | qDebug( "POP3: logged in!" ); | 231 | qDebug( "POP3: logged in!" ); |
232 | } | 232 | } |
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 | |||
@@ -1,12 +1,13 @@ | |||
1 | #ifndef __POP3WRAPPER | 1 | #ifndef __POP3WRAPPER |
2 | #define __POP3WRAPPER | 2 | #define __POP3WRAPPER |
3 | 3 | ||
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 | { |
10 | Q_OBJECT | 11 | Q_OBJECT |
11 | 12 | ||
12 | public: | 13 | public: |
diff --git a/noncore/net/mail/mailwrapper.cpp b/noncore/net/mail/mailwrapper.cpp index 898e9d6..3ffc274 100644 --- a/noncore/net/mail/mailwrapper.cpp +++ b/noncore/net/mail/mailwrapper.cpp | |||
@@ -194,13 +194,13 @@ mailmime *MailWrapper::buildTxtPart( QString str ) | |||
194 | strdup( "iso-8859-1" ) ); | 194 | strdup( "iso-8859-1" ) ); |
195 | if ( param == NULL ) goto err_free; | 195 | if ( param == NULL ) goto err_free; |
196 | 196 | ||
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 ); |
204 | if ( fields == NULL ) goto err_free_content; | 204 | if ( fields == NULL ) goto err_free_content; |
205 | 205 | ||
206 | txtPart = mailmime_new_empty( content, fields ); | 206 | txtPart = mailmime_new_empty( content, fields ); |
@@ -250,13 +250,13 @@ mailmime *MailWrapper::buildFilePart( QString filename, QString mimetype ) | |||
250 | 250 | ||
251 | if ( mimetype.compare( "text/plain" ) == 0 ) { | 251 | if ( mimetype.compare( "text/plain" ) == 0 ) { |
252 | param = mailmime_parameter_new( strdup( "charset" ), | 252 | param = mailmime_parameter_new( strdup( "charset" ), |
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 | ||
260 | filePart = mailmime_new_empty( content, fields ); | 260 | filePart = mailmime_new_empty( content, fields ); |
261 | if ( filePart == NULL ) goto err_free_param; | 261 | if ( filePart == NULL ) goto err_free_param; |
262 | 262 | ||
@@ -344,40 +344,40 @@ err_free: | |||
344 | 344 | ||
345 | mailimf_field *MailWrapper::getField( mailimf_fields *fields, int type ) | 345 | mailimf_field *MailWrapper::getField( mailimf_fields *fields, int type ) |
346 | { | 346 | { |
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; |
357 | } | 357 | } |
358 | 358 | ||
359 | return NULL; | 359 | return NULL; |
360 | } | 360 | } |
361 | 361 | ||
362 | static void addRcpts( clist *list, mailimf_address_list *addr_list ) | 362 | 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 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | clist *MailWrapper::createRcptList( mailimf_fields *fields ) | 383 | clist *MailWrapper::createRcptList( mailimf_fields *fields ) |
@@ -385,45 +385,45 @@ clist *MailWrapper::createRcptList( mailimf_fields *fields ) | |||
385 | clist *rcptList; | 385 | clist *rcptList; |
386 | mailimf_field *field; | 386 | mailimf_field *field; |
387 | 387 | ||
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; |
409 | } | 409 | } |
410 | 410 | ||
411 | char *MailWrapper::getFrom( mailmime *mail ) | 411 | char *MailWrapper::getFrom( mailmime *mail ) |
412 | { | 412 | { |
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 | ||
427 | return from; | 427 | return from; |
428 | } | 428 | } |
429 | 429 | ||
@@ -539,13 +539,13 @@ void MailWrapper::smtpSend( mailmime *mail ) | |||
539 | free(from); | 539 | free(from); |
540 | return; | 540 | return; |
541 | } | 541 | } |
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 ); |
549 | readFromFile( file, &data, &size ); | 549 | readFromFile( file, &data, &size ); |
550 | QFile f( file ); | 550 | QFile f( file ); |
551 | f.remove(); | 551 | f.remove(); |
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp index 72f3c36..633faf6 100644 --- a/noncore/net/mail/pop3wrapper.cpp +++ b/noncore/net/mail/pop3wrapper.cpp | |||
@@ -30,20 +30,20 @@ void POP3wrapper::listMessages( QList<RecMail> &target ) | |||
30 | if (!m_pop3) return; | 30 | if (!m_pop3) return; |
31 | mailpop3_list( m_pop3, &messages ); | 31 | mailpop3_list( m_pop3, &messages ); |
32 | 32 | ||
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 | ||
47 | logout(); | 47 | logout(); |
48 | } | 48 | } |
49 | 49 | ||
@@ -52,32 +52,32 @@ RecMail *POP3wrapper::parseHeader( const char *header ) | |||
52 | int err = MAILIMF_NO_ERROR; | 52 | int err = MAILIMF_NO_ERROR; |
53 | size_t curTok; | 53 | size_t curTok; |
54 | RecMail *mail = new RecMail(); | 54 | RecMail *mail = new RecMail(); |
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; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
@@ -86,43 +86,43 @@ RecMail *POP3wrapper::parseHeader( const char *header ) | |||
86 | 86 | ||
87 | QString *POP3wrapper::parseDateTime( mailimf_date_time *date ) | 87 | QString *POP3wrapper::parseDateTime( mailimf_date_time *date ) |
88 | { | 88 | { |
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 | ||
96 | return result; | 96 | return result; |
97 | } | 97 | } |
98 | 98 | ||
99 | QString *POP3wrapper::parseAddressList( mailimf_address_list *list ) | 99 | QString *POP3wrapper::parseAddressList( mailimf_address_list *list ) |
100 | { | 100 | { |
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 ) { |
108 | result->append( "," ); | 108 | result->append( "," ); |
109 | } else { | 109 | } else { |
110 | first = false; | 110 | first = false; |
111 | } | 111 | } |
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; |
126 | default: | 126 | default: |
127 | qDebug( "POP3: unkown mailimf address type" ); | 127 | qDebug( "POP3: unkown mailimf address type" ); |
128 | break; | 128 | break; |
@@ -133,17 +133,17 @@ QString *POP3wrapper::parseAddressList( mailimf_address_list *list ) | |||
133 | } | 133 | } |
134 | 134 | ||
135 | QString *POP3wrapper::parseGroup( mailimf_group *group ) | 135 | 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 | } |
147 | 147 | ||
148 | result->append( ";" ); | 148 | result->append( ";" ); |
149 | 149 | ||
@@ -151,30 +151,30 @@ QString *POP3wrapper::parseGroup( mailimf_group *group ) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | QString *POP3wrapper::parseMailbox( mailimf_mailbox *box ) | 153 | 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 | ||
166 | return result; | 166 | return result; |
167 | } | 167 | } |
168 | 168 | ||
169 | QString *POP3wrapper::parseMailboxList( mailimf_mailbox_list *list ) | 169 | QString *POP3wrapper::parseMailboxList( mailimf_mailbox_list *list ) |
170 | { | 170 | { |
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 ) { |
178 | result->append( "," ); | 178 | result->append( "," ); |
179 | } else { | 179 | } else { |
180 | first = false; | 180 | first = false; |
@@ -209,24 +209,24 @@ void POP3wrapper::login() | |||
209 | } else { | 209 | } else { |
210 | err = mailpop3_socket_connect( m_pop3, (char*)server, port ); | 210 | err = mailpop3_socket_connect( m_pop3, (char*)server, port ); |
211 | } | 211 | } |
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; |
219 | } | 219 | } |
220 | qDebug( "POP3: connected!" ); | 220 | qDebug( "POP3: connected!" ); |
221 | 221 | ||
222 | // login | 222 | // 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 | } |
230 | 230 | ||
231 | qDebug( "POP3: logged in!" ); | 231 | qDebug( "POP3: logged in!" ); |
232 | } | 232 | } |
diff --git a/noncore/net/mail/pop3wrapper.h b/noncore/net/mail/pop3wrapper.h index a8937fb..4e4abad 100644 --- a/noncore/net/mail/pop3wrapper.h +++ b/noncore/net/mail/pop3wrapper.h | |||
@@ -1,12 +1,13 @@ | |||
1 | #ifndef __POP3WRAPPER | 1 | #ifndef __POP3WRAPPER |
2 | #define __POP3WRAPPER | 2 | #define __POP3WRAPPER |
3 | 3 | ||
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 | { |
10 | Q_OBJECT | 11 | Q_OBJECT |
11 | 12 | ||
12 | public: | 13 | public: |