henrycatalinismith / ppl

The command line address book
http://henry.catalinismith.com/ppl/
Other
300 stars 18 forks source link

Allow adding non-ascii senders #56

Closed ghost closed 9 years ago

ghost commented 9 years ago
coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.0%) to 97.41% when pulling e19772071532238cfda1dd1e3bc00328cd07ce8c on tba:rfc2047-sender into 977b3f4024e8b3b19a639274674be7666d131326 on hnrysmth:master.

henrycatalinismith commented 9 years ago

Hey @tba, I'm really sorry it took so long to get back to you on this. It's been a busy year for me! If you're at all interested, I'd love to add you to the project as a collaborator and let you merge this yourself.

Your code change seems great. It'd be perfect if it also included a test. Would a test for this fix look something like this?

    it "allows non-ASCII sender names" do
      email = [
        "Date: Fri, 30 Nov 2012 17:09:33 +0000",
        "From: Александр <test@example.org>",
        "Message-ID: <qwertyuioasdfghjk@mail.example.org>",
        "Subject: Test Email",
        "To: henry@henrysmith.org",
        "",
        "Hey,",
        "This is a test email.",
        "Bye!",
      ].join("\n")

      @storage.should_receive(:load_contact).and_return(nil)
      contacts = @adapter.scrape_contacts(email)

      contacts.first.name.full.should eq "Александр"
    end

Argh, sorry again for being so pathetically slow to reply. For what it's worth, I'm taking steps to prevent myself from blocking important fixes like these.

ghost commented 9 years ago

Hello!

Of course you are right. I forgot about tests. Sorry about that. I've added test you suggested. But probably in email header not Александр <test@example.com>, but encoded =?UTF-8?B?0JDQu9C10LrRgdCw0L3QtNGA?= <test@example.org>.

henrycatalinismith commented 9 years ago

Righty then, that's merged and should be fine as of version 2.3.3.

Thank you so much for being so patient with me :smile: