summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-08 03:06:39 (UTC)
committer alwin <alwin>2004-03-08 03:06:39 (UTC)
commit38301e81221e7e51cc67a5e366498a71df288263 (patch) (side-by-side diff)
tree47cfc2c2bf399c7f8bec3be4007d4f69a4d0b07a
parenta3836842bfabc973f27f2686320f7a207c59b10a (diff)
downloadopie-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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/composemail.cpp17
-rw-r--r--noncore/net/mail/composemail.h6
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp13
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.h4
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.h3
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp29
-rw-r--r--noncore/net/mail/viewmail.cpp6
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
@@ -16,2 +16,3 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
settings = s;
+ m_replyid = "";
@@ -86,10 +87,3 @@ void ComposeMail::setTo( const QString & to )
{
-/* QString toline;
- QStringList toEntry = to;
- for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) {
- toline += (*it);
- }
- toLine->setText( toline );
-*/
-toLine->setText( to );
+ toLine->setText( to );
}
@@ -103,3 +97,3 @@ void ComposeMail::setInReplyTo( const QString & messageId )
{
-
+ m_replyid = messageId;
}
@@ -209,2 +203,7 @@ void ComposeMail::accept()
mail->setSubject( subjectLine->text() );
+ if (!m_replyid.isEmpty()) {
+ QStringList ids;
+ ids.append(m_replyid);
+ mail->setInreply(ids);
+ }
QString txt = message->text();
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
@@ -56,8 +56,6 @@ private slots:
-
-
-private:
+protected:
Settings *settings;
QList<SMTPaccount> smtpAccounts;
-
+ QString m_replyid;
};
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
@@ -36,2 +36,3 @@ void RecMail::copy_old(const RecMail&old)
wrapper = old.wrapper;
+ in_reply_to = old.in_reply_to;
}
@@ -43,2 +44,3 @@ void RecMail::init()
bcc.clear();
+ in_reply_to.clear();
wrapper = 0;
@@ -86,2 +88,13 @@ const QStringList& RecMail::Bcc()const
+void RecMail::setInreply(const QStringList&list)
+{
+ in_reply_to = list;
+}
+
+const QStringList& RecMail::Inreply()const
+{
+ return in_reply_to;
+}
+
+
RecPart::RecPart()
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
@@ -61,2 +61,4 @@ public:
const QStringList&Bcc()const;
+ void setInreply(const QStringList&list);
+ const QStringList&Inreply()const;
const QBitArray&getFlags()const{return msg_flags;}
@@ -71,3 +73,3 @@ protected:
QBitArray msg_flags;
- QStringList to,cc,bcc;
+ QStringList to,cc,bcc,in_reply_to;
AbstractMail*wrapper;
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
@@ -57,2 +57,4 @@ public:
void setReply( const QString&a ) { reply = a; }
+ void setInreply(const QStringList&list){m_in_reply_to = list;}
+ const QStringList&Inreply()const{return m_in_reply_to;}
@@ -61,2 +63,3 @@ private:
QString name, mail, to, cc, bcc, reply, subject, message;
+ QStringList m_in_reply_to;
};
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
@@ -151,2 +151,3 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) {
mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0;
+ clist*in_reply_to = 0;
char *subject = strdup( mail.getSubject().latin1() );
@@ -177,5 +178,31 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) {
reply = parseAddresses( mail.getReply() );
+
+ if (mail.Inreply().count()>0) {
+ in_reply_to = clist_new();
+ char*c_reply;
+ unsigned int nsize = 0;
+ for (QStringList::ConstIterator it=mail.Inreply().begin();
+ it != mail.Inreply().end();++it) {
+ /* yes! must be malloc! */
+ if ((*it).isEmpty())
+ continue;
+ QString h((*it));
+ while (h.length()>0 && h[0]=='<') {
+ h.remove(0,1);
+ }
+ while (h.length()>0 && h[h.length()-1]=='>') {
+ h.remove(h.length()-1,1);
+ }
+ if (h.isEmpty()) continue;
+ nsize = strlen(h.latin1());
+ c_reply = (char*)malloc( (nsize+1)*sizeof(char));
+ memset(c_reply,0,nsize+1);
+ memcpy(c_reply,h.latin1(),nsize);
+ clist_append(in_reply_to,c_reply);
+ qDebug("In reply to: %s",c_reply);
+ }
+ }
fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc,
- NULL, NULL, subject );
+ in_reply_to, NULL, subject );
if ( fields == NULL )
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
@@ -411,3 +411,3 @@ void ViewMail::slotReply()
QString prefix;
- if ( m_mail[1].find(QRegExp("^Re: *$")) != -1) prefix = "";
+ if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = "";
else prefix = "Re: "; // no i18n on purpose
@@ -417,4 +417,6 @@ void ViewMail::slotReply()
composer.setTo( m_mail[0] );
- composer.setSubject( "Re: " + m_mail[1] );
+ composer.setSubject( prefix + m_mail[1] );
composer.setMessage( rtext );
+ composer.setInReplyTo(m_recMail.Msgid());
+
if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) )