adium 2413:b454b49dc3f3: Add a bit.ly service for URL shortening.
commits at adium.im
commits at adium.im
Sat May 30 21:07:39 UTC 2009
details: http://hg.adium.im/adium/rev/b454b49dc3f3
revision: 2413:b454b49dc3f3
author: Zachary West <zacw at adium.im>
date: Sat May 30 17:07:29 2009 -0400
Add a bit.ly service for URL shortening.
This currently uses an "adiumofficial" account as the account it's tied to. History is not enabled (history=1 would have to be appended to the link), so other than being a stupid requirement, users won't be able to claim this URL. :/ I'm not writing a UI for setting the username/API key so whatever.
diffs (52 lines):
diff -r 8f5459ece588 -r b454b49dc3f3 Source/AIURLShortenerPlugin.h
--- a/Source/AIURLShortenerPlugin.h Sat May 30 15:52:13 2009 -0400
+++ b/Source/AIURLShortenerPlugin.h Sat May 30 17:07:29 2009 -0400
@@ -21,7 +21,8 @@
AITinyURL = 0,
AIisgd,
AIMetamark,
- AITrim
+ AITrim,
+ AIBitly
} AIShortenLinkService;
@interface AIURLShortenerPlugin : AIPlugin {
diff -r 8f5459ece588 -r b454b49dc3f3 Source/AIURLShortenerPlugin.m
--- a/Source/AIURLShortenerPlugin.m Sat May 30 15:52:13 2009 -0400
+++ b/Source/AIURLShortenerPlugin.m Sat May 30 17:07:29 2009 -0400
@@ -105,6 +105,7 @@
[NSNumber numberWithInteger:AIisgd], @"is.gd",
[NSNumber numberWithInteger:AIMetamark], @"xrl.us",
[NSNumber numberWithInteger:AITrim], @"tr.im",
+ [NSNumber numberWithInteger:AIBitly], @"bit.ly",
nil];
[menu removeAllItems];
@@ -234,19 +235,23 @@
switch(service) {
case AITinyURL:
- request = [NSString stringWithFormat:@"http://tinyurl.com/api-create.php?url=%@", [address stringByEncodingURLEscapes]];
+ request = [NSString stringWithFormat:@"http://tinyurl.com/api-create.php?url=%@", [address stringByAddingPercentEscapesForAllCharacters]];
break;
case AIisgd:
- request = [NSString stringWithFormat:@"http://is.gd/api.php?longurl=%@", [address stringByEncodingURLEscapes]];
+ request = [NSString stringWithFormat:@"http://is.gd/api.php?longurl=%@", [address stringByAddingPercentEscapesForAllCharacters]];
break;
case AIMetamark:
- request = [NSString stringWithFormat:@"http://metamark.net/api/rest/simple?long_url=%@", [address stringByEncodingURLEscapes]];
+ request = [NSString stringWithFormat:@"http://metamark.net/api/rest/simple?long_url=%@", [address stringByAddingPercentEscapesForAllCharacters]];
break;
case AITrim:
- request = [NSString stringWithFormat:@"http://api.tr.im/api/trim_simple?api_key=zghQN6sv5y0FkLPNlQAopm7qDQz6ItO33ENU21OBsy3dL1Kl&url=%@", [address stringByEncodingURLEscapes]];
+ request = [NSString stringWithFormat:@"http://api.tr.im/api/trim_simple?api_key=zghQN6sv5y0FkLPNlQAopm7qDQz6ItO33ENU21OBsy3dL1Kl&url=%@", [address stringByAddingPercentEscapesForAllCharacters]];
+ break;
+
+ case AIBitly:
+ request = [NSString stringWithFormat:@"http://api.bit.ly/shorten?version=2.0.1&format=text&longUrl=%@&login=adiumofficial&apiKey=R_3a9f4affdf9181536d5536f67e02a59c", [address stringByAddingPercentEscapesForAllCharacters]];
break;
default:
More information about the commits
mailing list