Add-on add-on to unshorten all short links is needed


Hi, guys.

I need a tiny little add-on that will do this little magic:
1. When a user submits/edits a post,
2. this addon checks all the links in the post via API,
3. converts back all the shorten links to their initial variants (replaces the href value).
4. Plus some optimization is needed to reduce the number of requests and the server usage (i.e. make a database table of unshortened urls and check it before is requested, or smth. I need your suggestions here).
5. Don't forget to deal with error cases (I need your help here too).

Looking forward to your suggestions, estimations (via conversations, I suppose) and questions if there are any.
Thank you in advance.

XenForo 1.5.10a.