Skip to content

Instantly share code, notes, and snippets.

@uobikiemukot
Created April 12, 2013 12:22
Show Gist options
  • Save uobikiemukot/5371645 to your computer and use it in GitHub Desktop.
Save uobikiemukot/5371645 to your computer and use it in GitHub Desktop.
bitlbee 3.2 - favorite patch
--- protocols/twitter/twitter.c.orig 2013-04-12 20:33:58.236098274 +0900
+++ protocols/twitter/twitter.c 2013-04-12 20:34:09.505347769 +0900
@@ -615,7 +615,7 @@
twitter_log(ic, "Could not undo last action");
goto eof;
- } else if (g_strcasecmp(cmd[0], "favourite") == 0 && cmd[1]) {
+ } else if (g_strcasecmp(cmd[0], "fav") == 0 && cmd[1]) {
if ((id = twitter_message_id_from_command_arg(ic, cmd[1], NULL))) {
twitter_favourite_tweet(ic, id);
} else {
--- protocols/twitter/twitter_lib.h.orig 2013-04-12 21:13:08.126820072 +0900
+++ protocols/twitter/twitter_lib.h 2013-04-12 21:11:05.737218612 +0900
@@ -68,7 +68,7 @@
/* Favorites URLs */
#define TWITTER_FAVORITES_GET_URL "/favorites.json"
-#define TWITTER_FAVORITE_CREATE_URL "/favorites/create/"
+#define TWITTER_FAVORITE_CREATE_URL "/favorites/create.json"
#define TWITTER_FAVORITE_DESTROY_URL "/favorites/destroy/"
/* Block URLs */
--- protocols/twitter/twitter_lib.c.orig 2013-04-12 20:49:40.561393644 +0900
+++ protocols/twitter/twitter_lib.c 2013-04-12 21:15:50.356292565 +0900
@@ -1241,10 +1241,12 @@
*/
void twitter_favourite_tweet(struct im_connection *ic, guint64 id)
{
- char *url;
- url = g_strdup_printf("%s%llu%s", TWITTER_FAVORITE_CREATE_URL,
- (unsigned long long) id, ".json");
- twitter_http_f(ic, url, twitter_http_post, ic, 1, NULL, 0,
+ char *args[2] = {
+ "id",
+ g_strdup_printf("%llu", (unsigned long long) id)
+ };
+
+ twitter_http_f(ic, TWITTER_FAVORITE_CREATE_URL, twitter_http_post, ic, 1, args, 2,
TWITTER_HTTP_USER_ACK);
- g_free(url);
+ g_free(args[1]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment