Post By Email: OPW is over!

I can hardly believe it, but my summer internship is drawing to a close.

This week, I released version 1.0.4 of the Post By Email plugin, comprised of minor bugfixes, tests, and documentation as I prepped the project for its evaluation phase.  I’ve added quite a bit of info to the readme page, including better installation and configuration instructions.

Those of you following along on Trac may have noticed that I’ve kind of run out of tasks.  🙂

Today is the official end of the OPW and GSoC programs, so I’ll be taking a short break from development work during the evaluation period.  But this isn’t goodbye!  I definitely plan to stick around and continue working on and supporting this project in the future — so keep those bug reports coming!

I do want to take a second to thank all of you for being here for me as I learned the ins and outs of WordPress this summer.  I feel really good about where this project landed, and I know it’s because I had so many amazing resources every step of the way.  So, to everyone who left me comments, answered my questions on IRC or Twitter, reviewed my code, tested, reported bugs, offered suggestions, spoke at WCSF, or even just edited a Codex page or wrote a quick tutorial now and then: THANK YOU.  It really made the difference in those moments when I felt frustrated or overwhelmed.

I don’t know exactly what the future holds, but I do know that I love being a part of WordPress, and I’m excited to continue working with y’all.  Let’s keep in touch.  🙂

#post-by-email, #weekly-update

Post By Email Plugin: Version 1.0 is live!

I just released version 1.0 of the Post By Email plugin, which includes the following updates:

  • Support for IMAP and SSL connections
  • Option to “mark as read” instead of deleting messages after posting them (IMAP only)
  • Only fetch unread messages (IMAP only)
  • Added contextual help to the admin panel
  • Support for HTML-formatted emails
  • Under the hood: refactoring, bugfixes, properly checking nonce for AJAX requests, etc.

I also made some changes to the Core patch and added it to the corresponding Trac ticket for community review.

Please do install and test this version and let me know how it goes!

This plugin is in beta; the usual caveats apply.  Please be sure to back up your data and/or run this against a test email account.

As always, you can download the plugin from the official repository or from the Github mirror.

#post-by-email, #weekly-update

Post By Email weekly update

This week, I finally released the Post By Email plugin into the official repository, which inspired me to do a lot of incidental cleanup (readme files, test instructions, etc.).

I finished updating the Core deprecation patch for 3.7 — it’s in the plugin repo and will be submitted back to Trac once my mentors get a chance to review it.  (Comments and feedback welcome!)

I also powered through the remaining infrastructure tasks.  The latest version is 0.9.9 (look how close that is to 1.0!  SO CLOSE) and includes the following:

  • Improved error and status logging
  • Scheduled mail checks via wp_cron
  • Prettified settings page (with stuff like consistent date/time display)
  • Autoloading of Horde library files (HT to ryanmccue for the example)

If you happen to have access to an unsecured POP3 mail server and want to test this and see what breaks, I’d love to hear about it.  (Be sure to patch Core with the deprecation patch first to avoid weird behavior.)

The 1.0 release will include IMAP and SSL, at which point I will start requesting beta testers in earnest.

I just spent the last few hours tracking down a bug in my clear_log function, which turned out to be caused by the Settings API validation function being triggered when an AJAX function (called from the settings page, but not with a form submit) called update_option.  I worked around that, but haven’t yet figured out why it’s happening at all — any insights would be appreciated.

#post-by-email, #weekly-update

Post By Email: Roadmap for the final stretch

I met with my mentors this past week to hash out the spec for the final iteration of the Post By Email plugin.  It can be found here; I’m updating it as I finish tasks, as well as tracking them in the GSoC Trac.

This week, I tested under PHP 5.2 and made a few small changes to the Horde library files to support both 5.2 and 5.3 (the Horde framework requires a minimum of 5.3).  I also refactored the admin-specific methods (adding menus and so on) into their own class, which is loaded only if is_admin().

Of the original feature list, we’ve decided that supporting multisite is currently out of scope (though it may well work anyhow — it’s globally disabled in Core for a multisite install, but I can’t think of any reason to restrict it for the plugin).  Attachments and comment reply via email are on the “nice to have” list, meaning I might not get to them (at least, not before the official internship period ends).

#post-by-email, #roadmaps, #weekly-update

Post By Email: Getting back on track

It has sadly not been a very productive couple of weeks in Post By Email land — I’ve been struggling to balance conferences, travel, illness and other obligations, and ultimately hit that not-so-fun point of needing to take a few days off because the more work I tried to do, the less I was able to do.

The good news is, I’m regrouping and made a few updates to the plugin — mostly minor fixes and code style cleanup.  This coming week, I’m planning to work with my mentors on the final roadmap of additional features that will be implemented between now and the end of September, so I will have that to share with you next week.

#post-by-email, #weekly-update

Post By Email Update: Horde library!

After much wailing and gnashing of teeth, I was finally able to get the Post By Email plugin working against the Horde IMAP Client Library.

It’s a bit of a hack right now — I still need to clean up the code and pull a lot of it out into helper functions — but with this in place, I’ve laid the groundwork for supporting SSL and IMAP connections (without requiring PHP to be compiled with IMAP support).

A couple of technical oddities…

  • The Horde framework is massive, and while the IMAP library is available as a standalone PEAR package, it still has a ton of dependencies to the rest of Horde.  I solved the problem in a quick-and-dirty way by copying any missing files into the plugin’s includes directory.  Horde uses an autoloader to include the classes it needs; I’m planning to experiment with that, but for now I just wrote a wrapper (so I only have to include one file in the plugin class).  (Does anyone know whether autoloading plays nicely with WP?)
  • Instead of copying over the translation classes, I stubbed out one of them in a “bogus” way that uses WP’s translation functions instead.  Might poke around and see whether I can do this with any of the others, as well.

The good news is that, once I got this working, I was able to scrap the whole preexisting deal with reading each message line by line and processing it with (buggy) regexes… and move to letting Horde abstract parsing out headers, decoding MIME, etc.  This will also make it much easier to deal with HTML emails, attachments, and so on in the future.

For now it still supports only POP3, but unlike the previous iteration, it doesn’t lose all the text and create blank posts — certainly an improvement.  🙂

Next steps: Refactor check_email into helper functions and add support for IMAP, then SSL connections.

#post-by-email, #weekly-update

Post By Email playing hooky this week

It’s been a long week and I’m in the midst of a few things that just aren’t quite working yet. Normally my inclination would be to stay up late hacking it into shape and writing a blog post… but today, it’s more important to me to get to bed early so I don’t miss any sessions at WCSF tomorrow!

Post By Email will return to regularly-scheduled updates with a longer one next Thursday. In the meantime, if you’re at WordCamp this weekend, be sure to say hi!

#post-by-email, #weekly-update

Post By Email Update: POP/IMAP libraries, Trac questions

Rather unexciting update this week, as I’m still in the midst of a few things (and have been distracted by caring for a cat who had some teeth pulled… poor kitty!).

As I mentioned last week, in reading through old Trac tickets, I learned that the POP3 class we’re using to read emails was originally copied over from SquirrelMail.  I’ve been digging into their SVN repo in hopes of being able to adopt (1) an updated POP library that might include fixes for some of the bugs we’ve found, and (2) an IMAP library that we can similarly adapt to our own uses.

It’s an interesting adventure trying to reconstruct years of history from bug tracker and commit logs… at any rate, it appears the POP3 library originally came from a SquirrelMail plugin called “mail_fetch”, which was since merged into SquirrelMail core.  Complicating matters, the file was renamed from class-pop3.php to class.mail_fetch.php.  But I did ultimately track it down!

However, while the development branch of SquirrelMail now has “some plumbing” to support remote IMAP servers, I’m not sure whether any of that code will be useful for our needs — it’s not just still under development, but much more intertwined with the rest of SquirrelMail’s code, as opposed to being a standalone class.  At this point I’m more inclined to go with a different library, and have been researching alternatives; the top contender right now is the Horde IMAP library, which also includes an abstraction layer for POP3 (but I’m open to suggestions, if anyone has a favorite).  In the next week, I plan to load that into the plugin and see if I can get it working to support a wider variety of mail servers.

In other news, I’ve found myself fighting with Trac a lot lately.  I’m curious how all y’all keep track of tickets — both existing ones that you want to receive notices about, and new ones coming in that might be relevant to your interests.  Do you have custom searches bookmarked, an RSS feed, something else?  Please share any tips!

#post-by-email, #weekly-update

Post By Email Weekly Update

This past week, I continued delving into the mysteries of unit testing, and ended up submitting a minor patch back to the unit-tests repo (after spending some time trying to figure out what was wrong with my setup that was causing one of the tests to fail on core).

The Post By Email plugin now has working tests for activation, but not yet for the main functionality, which will require further research to learn how to mock out email retrieval.  (I’ve back-burnered this for the moment.)

I also spent some time wandering around Trac, and learned that a problem I’ve been having is actually an ancient bug, which I then tracked down to a misbehaving regex that is supposed to determine the charset of the email.  It requests that iconv transform the given text into the garbled charset, gets nothing back, and proceeds to cheerfully create an empty post.  I haven’t fixed it yet, as I’m hoping to replace large swaths of that code with a new library anyhow (apparently we originally got that POP3 library from SquirrelMail, which does now support IMAP and SSL, so that’s the first place I’ll look unless there are other recommendations).

Finally, I collated the plugin’s status and error messages into a mini-log, and added a quick status overview to the settings page.  I also put a “check now” button in the settings.  Right now it just logs the result of the most recent check; ultimately I plan to show a longer history, and also organize/format the messages better (errors color-coded, links to posts, etc.).

I tweaked a few more things about my setup this week, and am now mirroring the plugin source on Github, if Git happens to be more your cup of tea.

Next, I’m focusing on developing a patch to deprecate Core, and vetting existing plugins to ensure backward compatibility.

#post-by-email, #weekly-update

Post By Email update: tests and multiple WP versions

First off: After I mentioned last week that I needed a POP mail account to test with, several folks with their own mail servers offered their help.  I’m set up with something now.  Thanks to all who reached out!

The past week has been all about testing, with the goal of getting good unit and/or integration tests written for the Post By Email plugin before I start adding features to it.  This is entirely new territory for me, though I’ve done some TDD in Ruby in the past.  So far, I’ve learned how the tests work on Core, and gotten a whole mess of things installed and running (wp-cli, Pear, PHPUnit, etc.).  I followed this guide to set up the basic test structure for the plugin.  I was hoping to have some actual tests done for this week’s update, but it took a bit longer than expected to get the framework set up, so I don’t have anything ready for primetime yet.

So, this week’s question: What are some plugins that have really good tests?  I’m seeking examples of what to do (or not to do!).  I’m especially curious to see tests of Settings API stuff and install/activation functions.

Side note: I really need to clean up my development setup for testing against multiple WordPress versions.  I have several versions installed already, but they’re pretty haphazard (with different databases, inconsistent directory names, etc.).  I found this very good post about a development setup with multiple WP versions.  For those of you who support plugins or themes on multiple versions — any tips?  Is your setup similar to that post?

#post-by-email, #weekly-update