changeset 333:dff611cb9f7b

fixed a bug that in_reply_to_status_id field had been ignored.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 13 Oct 2009 13:34:29 +0900
parents 227852ee649c
children 2dec3eb6e770
files pidgin-twitter.h twitter_api.c
diffstat 2 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.h	Tue Oct 13 03:10:32 2009 +0900
+++ b/pidgin-twitter.h	Tue Oct 13 13:34:29 2009 +0900
@@ -173,7 +173,6 @@
 #define TAG_FORMAT_IDENTICA     "#<a href='http://identi.ca/tag/%s'>%s</a>"
 #define GROUP_FORMAT_IDENTICA   "!<a href='http://identi.ca/group/%s'>%s</a>"
 #define LINK_FORMAT_TWITTER     " <a href='PT://reply-twitter/?id=%s&user=%s'>R</a> <a href='PT://fav-twitter/?id=%s'>F</a> <a href='PT://retweet-twitter/?id=%s&user=%s&msg=%s'>RT</a>"
-#define TWITTER_REPLY_FORMAT    "in_reply_to_status_id=%llu"
 
 #define DEFAULT_LIST            "(list of users: separated with ' ,:;')"
 #define OOPS_MESSAGE            "<body>Oops! Your update was over 140 characters. We sent the short version to your friends (they can view the entire update on the web).<BR></body>"
@@ -211,13 +210,13 @@
     "User-Agent: pidgin-twitter\r\n"                                 \
     "Authorization: Basic %s\r\n"                                    \
     "Content-Length: %d\r\n"
-#define TWITTER_STATUS_FORMAT "status=%s&source=pidgintwitter"
-
 #define TWITTER_FAV_POST "POST /favorites/create/%llu.xml HTTP/1.1\r\n" \
     "Host: twitter.com\r\n"                                          \
     "User-Agent: pidgin-twitter\r\n"                                 \
     "Authorization: Basic %s\r\n"
 
+#define TWITTER_STATUS_FORMAT "status=%s&source=pidgintwitter"
+#define TWITTER_REPLY_FORMAT  "status=%s&in_reply_to_status_id=%llu&source=pidgintwitter"
 
 #define TWITTER_DEFAULT_INTERVAL (60)
 #define TWITTER_OLD_DEFAULT_ICON_URL "http://static.twitter.com/images/default_profile_bigger.png"
--- a/twitter_api.c	Tue Oct 13 03:10:32 2009 +0900
+++ b/twitter_api.c	Tue Oct 13 13:34:29 2009 +0900
@@ -509,23 +509,20 @@
                                               strlen(basic_auth));
     g_free(basic_auth);
 
-    status = g_strdup_printf(TWITTER_STATUS_FORMAT, url_encoded);
-    header = g_strdup_printf(TWITTER_STATUS_POST, basic_auth_encoded,
-                             (int)strlen(status));
-
     if(reply_to_msgid > 0) {
-        char *inreply = NULL;
-        inreply = g_strdup_printf(TWITTER_REPLY_FORMAT,
-                                  (long long unsigned int)reply_to_msgid);
-        request = g_strconcat(header, "\r\n", status, "\r\n",
-                              inreply, "\r\n", NULL);
+        status = g_strdup_printf(TWITTER_REPLY_FORMAT, url_encoded,
+                                 (long long unsigned int)reply_to_msgid);
+        header = g_strdup_printf(TWITTER_STATUS_POST, basic_auth_encoded,
+                                 (int)strlen(status));
         reply_to_msgid = 0;
-        g_free(inreply);
     }
     else {
-        request = g_strconcat(header, "\r\n", status, "\r\n", NULL);
+        status = g_strdup_printf(TWITTER_STATUS_FORMAT, url_encoded);
+        header = g_strdup_printf(TWITTER_STATUS_POST, basic_auth_encoded,
+                                 (int)strlen(status));
     }
 
+    request = g_strconcat(header, "\r\n", status, "\r\n", NULL);
     purple_util_fetch_url_request(TWITTER_BASE_URL, FALSE,
                                   NULL, TRUE, request, TRUE,
                                   post_status_with_api_cb, tm);