KCDDB

smtpsubmit.cpp
1 /*
2  SPDX-FileCopyrightText: 2003 Richard Lärkäng <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "smtpsubmit.h"
8 #include "logging.h"
9 
10 #include <KIO/Job>
11 
12 namespace KCDDB
13 {
14  SMTPSubmit::SMTPSubmit(const QString& hostname, uint port, const QString& username,
15  const QString& from, const QString& to)
16  : Submit(), from_(from), to_(to)
17  {
18  url_.setScheme(QLatin1String( "smtp" ));
19  url_.setHost(hostname);
20  url_.setPort(port);
21  if (!username.isEmpty())
22  url_.setUserName(username);
23  url_.setPath(QLatin1String( "/send" ));
24  }
25 
26  SMTPSubmit::~SMTPSubmit()
27  {
28 
29  }
30 
31  KIO::Job* SMTPSubmit::createJob(const CDInfo& cdInfo)
32  {
33  url_.setQuery(QString::fromLatin1("to=%1&subject=cddb %2 %3&from=%4")
34  .arg(to_, cdInfo.get(Category).toString(),
35  cdInfo.get(QLatin1String( "discid" )).toString(), from_));
36  qCDebug(LIBKCDDB) << "Url is: " << url_.toDisplayString();
37 
38  return KIO::storedPut(diskData_.toUtf8().data(), url_, -1, KIO::HideProgressInfo);
39  }
40 
41  void SMTPSubmit::makeDiskData( const CDInfo& cdInfo, const TrackOffsetList& offsetList )
42  {
43  diskData_ = QLatin1String( "Content-Type: text/plain; charset=\"utf-8\";\n" );
44 
45  Submit::makeDiskData(cdInfo, offsetList);
46  }
47 }
48 
KIOCORE_EXPORT StoredTransferJob * storedPut(const QByteArray &arr, const QUrl &url, int permissions, JobFlags flags=DefaultFlags)
HideProgressInfo
bool isEmpty() const const
QString fromLatin1(const char *str, int size)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Nov 26 2021 23:22:53 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.