diff --git a/build.sbt b/build.sbt index 887f268..687c803 100644 --- a/build.sbt +++ b/build.sbt @@ -8,12 +8,12 @@ lazy val contributors = Seq( , "mrauilm" -> "Milan Raulim" ) -val fs2Version = "2.0.0" +val fs2Version = "2.1.0" lazy val commonSettings = Seq( organization := "com.spinoco", - scalaVersion := "2.12.4", - crossScalaVersions := Seq("2.11.11", "2.12.4"), + scalaVersion := "2.12.10", + crossScalaVersions := Seq("2.11.12", "2.12.10"), scalacOptions ++= Seq( "-feature", "-deprecation", diff --git a/project/build.properties b/project/build.properties index d6e3507..6adcdc7 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.1.6 +sbt.version=1.3.3 diff --git a/src/main/scala/spinoco/fs2/mail/imap/IMAPClient.scala b/src/main/scala/spinoco/fs2/mail/imap/IMAPClient.scala index e19d33b..2b95fdb 100644 --- a/src/main/scala/spinoco/fs2/mail/imap/IMAPClient.scala +++ b/src/main/scala/spinoco/fs2/mail/imap/IMAPClient.scala @@ -287,7 +287,7 @@ object IMAPClient { fromServer.through(spinoco.fs2.mail.internal.takeThroughDrain[F, IMAPData] { case IMAPText(l) => ! l.startsWith(tag) case _ => true - }).pull.uncons1.flatMap { + }).onFinalize{Applicative[F].unit}.pull.uncons1.flatMap { case None => unlock.map { _ => Left("* BAD Connection with server terminated") } case Some((IMAPText(resp), tail)) => if (resp.startsWith(tag)) { diff --git a/src/test/scala/spinoco/fs2/mail/encoding/quotedPrintableSpec.scala b/src/test/scala/spinoco/fs2/mail/encoding/quotedPrintableSpec.scala index c7141a0..4e6bbc3 100644 --- a/src/test/scala/spinoco/fs2/mail/encoding/quotedPrintableSpec.scala +++ b/src/test/scala/spinoco/fs2/mail/encoding/quotedPrintableSpec.scala @@ -53,7 +53,7 @@ object quotedPrintableSpec extends Properties("quotedPrintable") { |un moyen, et te trompant ainsi sur la route =C3=A0 suivre les voil=C3=A0 bi= |ent=C3=B4t qui te d=C3=A9gradent, car si leur musique est vulgaire ils te f= |abriquent pour te la vendre une =C3=A2me vulgaire.""" - .stripMargin.lines.toSeq + .stripMargin.linesIterator.toSeq , raw = Seq( """J'interdis aux marchands de vanter trop leur marchandises. Car ils se font vite pédagogues et t'enseignent comme but ce qui n'est par essence qu'un moyen, et te trompant ainsi sur la route à suivre les voilà bientôt qui te dégradent, car si leur musique est vulgaire ils te fabriquent pour te la vendre une âme vulgaire.""" ) @@ -86,7 +86,7 @@ object quotedPrintableSpec extends Properties("quotedPrintable") { |in |wenig aufschieben, denn auch uns f=C3=BCrchten, wie ihr seht, einige Tiere, |welche also wohl noch ungl=C3=BCcklicher sein m=C3=BCssen als wir."""" - .stripMargin.lines.toSeq + .stripMargin.linesIterator.toSeq , raw = Seq( "Die Hasen und die Frösche" , "" diff --git a/src/test/scala/spinoco/fs2/mail/imap/IMAPClientFetchSpec.scala b/src/test/scala/spinoco/fs2/mail/imap/IMAPClientFetchSpec.scala index 1e2d50a..032da66 100644 --- a/src/test/scala/spinoco/fs2/mail/imap/IMAPClientFetchSpec.scala +++ b/src/test/scala/spinoco/fs2/mail/imap/IMAPClientFetchSpec.scala @@ -106,7 +106,7 @@ object IMAPClientFetchSpec extends Properties("IMAPClient.Fetch"){ |* 0 EXPUNGE |3 OK Success | - |""".stripMargin.lines.mkString("\r\n") + |""".stripMargin.linesIterator.mkString("\r\n") val multipleHeadersResponse = """* 4249 FETCH (BODY[HEADER] {4774} @@ -277,7 +277,7 @@ object IMAPClientFetchSpec extends Properties("IMAPClient.Fetch"){ |) |4 OK Success | - |""".stripMargin.lines.mkString("\r\n") + |""".stripMargin.linesIterator.mkString("\r\n") def parseFetchResponse(resp: String, chunkSz: Int): Vector[Either[String, Long]] = { @@ -420,7 +420,7 @@ object IMAPClientFetchSpec extends Properties("IMAPClient.Fetch"){ |AAAASUVORK5CYII=) |10 OK Success | - |""".stripMargin.stripMargin.lines.mkString("\r\n") + |""".stripMargin.stripMargin.linesIterator.mkString("\r\n") val fetchBodyBytes = ByteVector.fromBase64( """iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAPFBMVEX///+1tbWwsLCtra3////5 @@ -470,14 +470,14 @@ object IMAPClientFetchSpec extends Properties("IMAPClient.Fetch"){ |Please click on the link below to create your account https://accounts.restcomm.com/verify-code?code=1709-4060452b-1b01-4991-9b7e-93e98e139e9d |) |11 OK Success - |""".stripMargin.lines.mkString("\r\n") + |""".stripMargin.linesIterator.mkString("\r\n") val BodyText8BitResponse = """* 2077 FETCH (BODY[1] {87} |Jestliže se vám newsletter nezobrazil správně, klikněte prosím sem |Červen 2017 ) |12 OK Success - |""".stripMargin.lines.mkString("\r\n") + |""".stripMargin.linesIterator.mkString("\r\n") val BodyTextQuotedPrintableResponse = """* 4249 FETCH (BODY[1] {745} @@ -498,7 +498,7 @@ object IMAPClientFetchSpec extends Properties("IMAPClient.Fetch"){ |">=20 |) |13 OK Success - |""".stripMargin.lines.mkString("\r\n") + |""".stripMargin.linesIterator.mkString("\r\n") val BodyTextBase64Response = """* 3632 FETCH (BODY[1] {3112} @@ -548,7 +548,7 @@ object IMAPClientFetchSpec extends Properties("IMAPClient.Fetch"){ |MDZmZGMwNjliZDQ0OGE2YTI0MTFhZGU2ZGZjMzgzND4gICAgICAgICAgICAgICAgICAg |ICAgICAgICAgICAgICAgICAgDQoNCg==) |13 OK Success - """.stripMargin.lines.mkString("\r\n") + """.stripMargin.linesIterator.mkString("\r\n") val SP = " " @@ -558,13 +558,13 @@ object IMAPClientFetchSpec extends Properties("IMAPClient.Fetch"){ | |Please click on the link below to create your account https://accounts.restcomm.com/verify-code?code=1709-4060452b-1b01-4991-9b7e-93e98e139e9d | - |""".stripMargin.lines.mkString("\r\n") + |""".stripMargin.linesIterator.mkString("\r\n") } property("decode-fetch-bytes.8bit") = forAll(Gen.choose(1, BodyText8BitResponse.size)) { sz => decodeFetchText(BodyText8BitResponse, sz, encoding = "8BIT", charset = Some("UTF-8")) ?= """Jestliže se vám newsletter nezobrazil správně, klikněte prosím sem - |Červen 2017 """.stripMargin.lines.mkString("\r\n") + |Červen 2017 """.stripMargin.linesIterator.mkString("\r\n") } @@ -580,14 +580,14 @@ object IMAPClientFetchSpec extends Properties("IMAPClient.Fetch"){ |
$SP |