author | alwin <alwin> | 2004-03-08 03:06:39 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-08 03:06:39 (UTC) |
commit | 38301e81221e7e51cc67a5e366498a71df288263 (patch) (unidiff) | |
tree | 47cfc2c2bf399c7f8bec3be4007d4f69a4d0b07a | |
parent | a3836842bfabc973f27f2686320f7a207c59b10a (diff) | |
download | opie-38301e81221e7e51cc67a5e366498a71df288263.zip opie-38301e81221e7e51cc67a5e366498a71df288263.tar.gz opie-38301e81221e7e51cc67a5e366498a71df288263.tar.bz2 |
when reply to a mail, a in-reply-to header will generated.
ToDo: setup the reference-list-header.
-rw-r--r-- | noncore/net/mail/composemail.cpp | 17 | ||||
-rw-r--r-- | noncore/net/mail/composemail.h | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.cpp | 13 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.h | 3 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 29 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 6 |
7 files changed, 61 insertions, 17 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index f8ac76f..b5cd75b 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp | |||
@@ -14,6 +14,7 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m | |||
14 | : ComposeMailUI( parent, name, modal, flags ) | 14 | : ComposeMailUI( parent, name, modal, flags ) |
15 | { | 15 | { |
16 | settings = s; | 16 | settings = s; |
17 | m_replyid = ""; | ||
17 | 18 | ||
18 | QString vfilename = Global::applicationFileName("addressbook", | 19 | QString vfilename = Global::applicationFileName("addressbook", |
19 | "businesscard.vcf"); | 20 | "businesscard.vcf"); |
@@ -84,14 +85,7 @@ void ComposeMail::pickAddress( QLineEdit *line ) | |||
84 | 85 | ||
85 | void ComposeMail::setTo( const QString & to ) | 86 | void ComposeMail::setTo( const QString & to ) |
86 | { | 87 | { |
87 | /* QString toline; | 88 | toLine->setText( to ); |
88 | QStringList toEntry = to; | ||
89 | for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) { | ||
90 | toline += (*it); | ||
91 | } | ||
92 | toLine->setText( toline ); | ||
93 | */ | ||
94 | toLine->setText( to ); | ||
95 | } | 89 | } |
96 | 90 | ||
97 | void ComposeMail::setSubject( const QString & subject ) | 91 | void ComposeMail::setSubject( const QString & subject ) |
@@ -101,7 +95,7 @@ void ComposeMail::setSubject( const QString & subject ) | |||
101 | 95 | ||
102 | void ComposeMail::setInReplyTo( const QString & messageId ) | 96 | void ComposeMail::setInReplyTo( const QString & messageId ) |
103 | { | 97 | { |
104 | 98 | m_replyid = messageId; | |
105 | } | 99 | } |
106 | 100 | ||
107 | void ComposeMail::setMessage( const QString & text ) | 101 | void ComposeMail::setMessage( const QString & text ) |
@@ -207,6 +201,11 @@ void ComposeMail::accept() | |||
207 | mail->setBCC( bccLine->text() ); | 201 | mail->setBCC( bccLine->text() ); |
208 | mail->setReply( replyLine->text() ); | 202 | mail->setReply( replyLine->text() ); |
209 | mail->setSubject( subjectLine->text() ); | 203 | mail->setSubject( subjectLine->text() ); |
204 | if (!m_replyid.isEmpty()) { | ||
205 | QStringList ids; | ||
206 | ids.append(m_replyid); | ||
207 | mail->setInreply(ids); | ||
208 | } | ||
210 | QString txt = message->text(); | 209 | QString txt = message->text(); |
211 | if ( !sigMultiLine->text().isEmpty() ) { | 210 | if ( !sigMultiLine->text().isEmpty() ) { |
212 | txt.append( "\n--\n" ); | 211 | txt.append( "\n--\n" ); |
diff --git a/noncore/net/mail/composemail.h b/noncore/net/mail/composemail.h index 604c862..886fb1d 100644 --- a/noncore/net/mail/composemail.h +++ b/noncore/net/mail/composemail.h | |||
@@ -54,12 +54,10 @@ private slots: | |||
54 | void addAttachment(); | 54 | void addAttachment(); |
55 | void removeAttachment(); | 55 | void removeAttachment(); |
56 | 56 | ||
57 | 57 | protected: | |
58 | |||
59 | private: | ||
60 | Settings *settings; | 58 | Settings *settings; |
61 | QList<SMTPaccount> smtpAccounts; | 59 | QList<SMTPaccount> smtpAccounts; |
62 | 60 | QString m_replyid; | |
63 | }; | 61 | }; |
64 | 62 | ||
65 | class AttachViewItem : public QListViewItem | 63 | class AttachViewItem : public QListViewItem |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index bf91c63..96e0fd5 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp | |||
@@ -34,6 +34,7 @@ void RecMail::copy_old(const RecMail&old) | |||
34 | cc = old.cc; | 34 | cc = old.cc; |
35 | bcc = old.bcc; | 35 | bcc = old.bcc; |
36 | wrapper = old.wrapper; | 36 | wrapper = old.wrapper; |
37 | in_reply_to = old.in_reply_to; | ||
37 | } | 38 | } |
38 | 39 | ||
39 | void RecMail::init() | 40 | void RecMail::init() |
@@ -41,6 +42,7 @@ void RecMail::init() | |||
41 | to.clear(); | 42 | to.clear(); |
42 | cc.clear(); | 43 | cc.clear(); |
43 | bcc.clear(); | 44 | bcc.clear(); |
45 | in_reply_to.clear(); | ||
44 | wrapper = 0; | 46 | wrapper = 0; |
45 | } | 47 | } |
46 | 48 | ||
@@ -84,6 +86,17 @@ const QStringList& RecMail::Bcc()const | |||
84 | return bcc; | 86 | return bcc; |
85 | } | 87 | } |
86 | 88 | ||
89 | void RecMail::setInreply(const QStringList&list) | ||
90 | { | ||
91 | in_reply_to = list; | ||
92 | } | ||
93 | |||
94 | const QStringList& RecMail::Inreply()const | ||
95 | { | ||
96 | return in_reply_to; | ||
97 | } | ||
98 | |||
99 | |||
87 | RecPart::RecPart() | 100 | RecPart::RecPart() |
88 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) | 101 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) |
89 | { | 102 | { |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index b2047cb..1420f79 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h | |||
@@ -59,6 +59,8 @@ public: | |||
59 | const QStringList&CC()const; | 59 | const QStringList&CC()const; |
60 | void setBcc(const QStringList&list); | 60 | void setBcc(const QStringList&list); |
61 | const QStringList&Bcc()const; | 61 | const QStringList&Bcc()const; |
62 | void setInreply(const QStringList&list); | ||
63 | const QStringList&Inreply()const; | ||
62 | const QBitArray&getFlags()const{return msg_flags;} | 64 | const QBitArray&getFlags()const{return msg_flags;} |
63 | void setFlags(const QBitArray&flags){msg_flags = flags;} | 65 | void setFlags(const QBitArray&flags){msg_flags = flags;} |
64 | 66 | ||
@@ -69,7 +71,7 @@ protected: | |||
69 | QString subject,date,from,mbox,msg_id,replyto; | 71 | QString subject,date,from,mbox,msg_id,replyto; |
70 | int msg_number,msg_size; | 72 | int msg_number,msg_size; |
71 | QBitArray msg_flags; | 73 | QBitArray msg_flags; |
72 | QStringList to,cc,bcc; | 74 | QStringList to,cc,bcc,in_reply_to; |
73 | AbstractMail*wrapper; | 75 | AbstractMail*wrapper; |
74 | void init(); | 76 | void init(); |
75 | void copy_old(const RecMail&old); | 77 | void copy_old(const RecMail&old); |
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.h b/noncore/net/mail/libmailwrapper/mailwrapper.h index caaa3a2..3a9f97b 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.h +++ b/noncore/net/mail/libmailwrapper/mailwrapper.h | |||
@@ -55,10 +55,13 @@ public: | |||
55 | void setSubject( const QString&s ) { subject = s; } | 55 | void setSubject( const QString&s ) { subject = s; } |
56 | const QString&getReply()const{ return reply; } | 56 | const QString&getReply()const{ return reply; } |
57 | void setReply( const QString&a ) { reply = a; } | 57 | void setReply( const QString&a ) { reply = a; } |
58 | void setInreply(const QStringList&list){m_in_reply_to = list;} | ||
59 | const QStringList&Inreply()const{return m_in_reply_to;} | ||
58 | 60 | ||
59 | private: | 61 | private: |
60 | QList<Attachment> attList; | 62 | QList<Attachment> attList; |
61 | QString name, mail, to, cc, bcc, reply, subject, message; | 63 | QString name, mail, to, cc, bcc, reply, subject, message; |
64 | QStringList m_in_reply_to; | ||
62 | }; | 65 | }; |
63 | 66 | ||
64 | class Folder : public QObject | 67 | class Folder : public QObject |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index d7a005e..63acfd5 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -149,6 +149,7 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) { | |||
149 | mailimf_mailbox *sender=0,*fromBox=0; | 149 | mailimf_mailbox *sender=0,*fromBox=0; |
150 | mailimf_mailbox_list *from=0; | 150 | mailimf_mailbox_list *from=0; |
151 | mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; | 151 | mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; |
152 | clist*in_reply_to = 0; | ||
152 | char *subject = strdup( mail.getSubject().latin1() ); | 153 | char *subject = strdup( mail.getSubject().latin1() ); |
153 | int err; | 154 | int err; |
154 | 155 | ||
@@ -175,9 +176,35 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) { | |||
175 | cc = parseAddresses( mail.getCC() ); | 176 | cc = parseAddresses( mail.getCC() ); |
176 | bcc = parseAddresses( mail.getBCC() ); | 177 | bcc = parseAddresses( mail.getBCC() ); |
177 | reply = parseAddresses( mail.getReply() ); | 178 | reply = parseAddresses( mail.getReply() ); |
179 | |||
180 | if (mail.Inreply().count()>0) { | ||
181 | in_reply_to = clist_new(); | ||
182 | char*c_reply; | ||
183 | unsigned int nsize = 0; | ||
184 | for (QStringList::ConstIterator it=mail.Inreply().begin(); | ||
185 | it != mail.Inreply().end();++it) { | ||
186 | /* yes! must be malloc! */ | ||
187 | if ((*it).isEmpty()) | ||
188 | continue; | ||
189 | QString h((*it)); | ||
190 | while (h.length()>0 && h[0]=='<') { | ||
191 | h.remove(0,1); | ||
192 | } | ||
193 | while (h.length()>0 && h[h.length()-1]=='>') { | ||
194 | h.remove(h.length()-1,1); | ||
195 | } | ||
196 | if (h.isEmpty()) continue; | ||
197 | nsize = strlen(h.latin1()); | ||
198 | c_reply = (char*)malloc( (nsize+1)*sizeof(char)); | ||
199 | memset(c_reply,0,nsize+1); | ||
200 | memcpy(c_reply,h.latin1(),nsize); | ||
201 | clist_append(in_reply_to,c_reply); | ||
202 | qDebug("In reply to: %s",c_reply); | ||
203 | } | ||
204 | } | ||
178 | 205 | ||
179 | fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, | 206 | fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, |
180 | NULL, NULL, subject ); | 207 | in_reply_to, NULL, subject ); |
181 | if ( fields == NULL ) | 208 | if ( fields == NULL ) |
182 | goto err_free_reply; | 209 | goto err_free_reply; |
183 | 210 | ||
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index ec93f8d..84f8a90 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -409,14 +409,16 @@ void ViewMail::slotReply() | |||
409 | rtext += "\n"; | 409 | rtext += "\n"; |
410 | 410 | ||
411 | QString prefix; | 411 | QString prefix; |
412 | if ( m_mail[1].find(QRegExp("^Re: *$")) != -1) prefix = ""; | 412 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
413 | else prefix = "Re: "; // no i18n on purpose | 413 | else prefix = "Re: "; // no i18n on purpose |
414 | 414 | ||
415 | Settings *settings = new Settings(); | 415 | Settings *settings = new Settings(); |
416 | ComposeMail composer( settings ,this, 0, true); | 416 | ComposeMail composer( settings ,this, 0, true); |
417 | composer.setTo( m_mail[0] ); | 417 | composer.setTo( m_mail[0] ); |
418 | composer.setSubject( "Re: " + m_mail[1] ); | 418 | composer.setSubject( prefix + m_mail[1] ); |
419 | composer.setMessage( rtext ); | 419 | composer.setMessage( rtext ); |
420 | composer.setInReplyTo(m_recMail.Msgid()); | ||
421 | |||
420 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) | 422 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) |
421 | { | 423 | { |
422 | m_recMail.Wrapper()->answeredMail(m_recMail); | 424 | m_recMail.Wrapper()->answeredMail(m_recMail); |