changeset 161:5dcd8699cba0

added a workaround for posting via broken firewall, for example notorious "watchguard". if you got error code 400, try hidden prefs value "broken_firewall" be 1.
author Yoshiki Yazawa <yaz@honeyplnaet.jp>
date Sat, 26 Jul 2008 15:48:26 +0900
parents aef26b56a54b
children 1237fc885a92
files pidgin-twitter.c pidgin-twitter.h
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Sat Jul 26 13:23:27 2008 +0900
+++ b/pidgin-twitter.c	Sat Jul 26 15:48:26 2008 +0900
@@ -717,7 +717,10 @@
     header = g_strdup_printf(TWITTER_STATUS_POST, basic_auth_encoded,
                              (int)strlen(status));
 
-    request = g_strconcat(header, status, TWITTER_STATUS_TERMINATOR, NULL);
+    if(purple_prefs_get_bool(OPT_BROKEN_FIREWALL))
+        request = g_strconcat(header, status, NULL);
+    else
+        request = g_strconcat(header, status, TWITTER_STATUS_TERMINATOR, NULL);
 
     purple_util_fetch_url_request(TWITTER_BASE_URL, FALSE,
                                   NULL, TRUE, request, TRUE,
@@ -2989,6 +2992,8 @@
     purple_prefs_add_bool(OPT_UPDATE_ICON, TRUE);
     purple_prefs_add_int(OPT_ICON_MAX_COUNT, DEFAULT_ICON_MAX_COUNT);
     purple_prefs_add_int(OPT_ICON_MAX_DAYS, DEFAULT_ICON_MAX_DAYS);
+
+    purple_prefs_add_bool(OPT_BROKEN_FIREWALL, FALSE);
 }
 
 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info)
--- a/pidgin-twitter.h	Sat Jul 26 13:23:27 2008 +0900
+++ b/pidgin-twitter.h	Sat Jul 26 15:48:26 2008 +0900
@@ -117,6 +117,7 @@
 #define OPT_ICON_MAX_COUNT      OPT_PIDGINTWITTER "/icon_max_count"
 #define OPT_ICON_MAX_DAYS       OPT_PIDGINTWITTER "/icon_max_days"
 #define OPT_API_BASE_GET_INTERVAL OPT_PIDGINTWITTER "/api_base_get_interval"
+#define OPT_BROKEN_FIREWALL     OPT_PIDGINTWITTER "/broken_firewall"
 
 /* formats and templates */
 #define RECIPIENT_FORMAT_TWITTER "@<a href='http://twitter.com/%s'>%s</a>"
@@ -144,11 +145,11 @@
 
 /* twitter API specific macros */
 #define TWITTER_BASE_URL "http://twitter.com"
-#define TWITTER_STATUS_GET "GET /statuses/friends_timeline.xml HTTP/1.0\r\n" \
+#define TWITTER_STATUS_GET "GET /statuses/friends_timeline.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_POST "POST /statuses/update.xml HTTP/1.0\r\n" \
+#define TWITTER_STATUS_POST "POST /statuses/update.xml HTTP/1.1\r\n" \
     "Host: twitter.com\r\n"                                          \
     "User-Agent: Pidgin-Twitter\r\n"                                 \
     "Authorization: Basic %s\r\n"                                    \