# HG changeset patch # User Yoshiki Yazawa # Date 1231689581 -32400 # Node ID 2d559555875f60297472da5247db5f34d2f87ccd # Parent ba00b20d968b2771c351c5c142162bceceb134ac now message count can be specified in twitter API access. diff -r ba00b20d968b -r 2d559555875f main.c --- a/main.c Tue Dec 16 20:31:32 2008 +0900 +++ b/main.c Mon Jan 12 00:59:41 2009 +0900 @@ -1308,6 +1308,7 @@ purple_prefs_add_bool(OPT_API_BASE_POST, TRUE); purple_prefs_add_int(OPT_API_BASE_GET_INTERVAL, TWITTER_DEFAULT_INTERVAL); + purple_prefs_add_int(OPT_RETRIEVE_COUNT, TWITTER_DEFAULT_RETRIEVE_COUNT); purple_prefs_add_string(OPT_SCREEN_NAME_TWITTER, EMPTY); purple_prefs_add_string(OPT_PASSWORD_TWITTER, EMPTY); purple_prefs_add_string(OPT_SCREEN_NAME_WASSR, EMPTY); diff -r ba00b20d968b -r 2d559555875f pidgin-twitter.h --- a/pidgin-twitter.h Tue Dec 16 20:31:32 2008 +0900 +++ b/pidgin-twitter.h Mon Jan 12 00:59:41 2009 +0900 @@ -141,6 +141,7 @@ #define OPT_FILTER_IDENTICA OPT_PIDGINTWITTER "/filter_identica" #define OPT_FILTER_JISKO OPT_PIDGINTWITTER "/filter_jisko" #define OPT_STRIP_EXCESS_LF OPT_PIDGINTWITTER "/strip_excess_lf" +#define OPT_RETRIEVE_COUNT OPT_PIDGINTWITTER "/retrieve_count" #ifdef _WIN32 #define OPT_PIDGIN_BLINK_IM PIDGIN_PREFS_ROOT "/win32/blink_im" @@ -180,7 +181,7 @@ /* twitter API specific macros */ #define TWITTER_BASE_URL "http://twitter.com" -#define TWITTER_STATUS_GET "GET /statuses/friends_timeline.xml HTTP/1.1\r\n" \ +#define TWITTER_STATUS_GET "GET /statuses/friends_timeline.xml?count=%d HTTP/1.1\r\n" \ "Host: twitter.com\r\n" \ "User-Agent: pidgin-twitter\r\n" \ "Authorization: Basic %s\r\n" @@ -192,6 +193,7 @@ #define TWITTER_STATUS_FORMAT "status=%s&source=pidgintwitter" #define TWITTER_DEFAULT_INTERVAL (60) #define TWITTER_DEFAULT_ICON_URL "http://static.twitter.com/images/default_profile_bigger.png" +#define TWITTER_DEFAULT_RETRIEVE_COUNT (20) /* wassr specific macros */ #define WASSR_POST_LEN (255) diff -r ba00b20d968b -r 2d559555875f prefs.c --- a/prefs.c Tue Dec 16 20:31:32 2008 +0900 +++ b/prefs.c Mon Jan 12 00:59:41 2009 +0900 @@ -236,6 +236,28 @@ interval_prefs_cb, NULL); + /* count spin */ + e = GTK_WIDGET(gtk_builder_get_object (builder, + "account_api_get_count_spin")); + g_object_set_data(G_OBJECT(e), "pref", OPT_RETRIEVE_COUNT); + + spin = GTK_SPIN_BUTTON(e); + + value = purple_prefs_get_int(OPT_RETRIEVE_COUNT); + twitter_debug("spin value = %d\n", value); + + adjust = gtk_adjustment_new(value, 20, 200, 10, 100, 100); + gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); + gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); + + if(value == 0) { + value = TWITTER_DEFAULT_RETRIEVE_COUNT; + purple_prefs_set_int(OPT_RETRIEVE_COUNT, value); + } + gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); + g_signal_connect(e, "value-changed", + G_CALLBACK(spin_changed_cb), &e); + /********************/ /* translation page */ diff -r ba00b20d968b -r 2d559555875f prefs.ui --- a/prefs.ui Tue Dec 16 20:31:32 2008 +0900 +++ b/prefs.ui Mon Jan 12 00:59:41 2009 +0900 @@ -1,7 +1,10 @@ + + + @@ -64,6 +67,9 @@ + + 0 + @@ -81,6 +87,9 @@ + + 0 + @@ -121,6 +130,9 @@ + + 0 + @@ -162,6 +174,9 @@ + + 0 + @@ -203,6 +218,9 @@ + + 0 + @@ -255,9 +273,10 @@ 20 + Get/post statuses via API True True - Get/post statuses via API + False True @@ -301,7 +320,7 @@ False - GTK_PACK_END + end 1 @@ -316,8 +335,6 @@ True - 2 - 10 40 @@ -329,13 +346,13 @@ False False + 0 True 2 - 10 4 @@ -350,26 +367,25 @@ False False - GTK_PACK_END + end 2 True - 10 8 True - sec + secs False False - GTK_PACK_END + end 1 @@ -379,6 +395,76 @@ 8 + + + True + + + True + 2 + 10 + 40 + + + True + Number of messages to retrieve + + + + + False + False + 0 + + + + + True + 2 + 10 + 4 + + + True + True + 1 + True + True + + + + + False + False + end + 2 + + + + + True + 10 + 8 + + + True + msgs + + + + + False + False + end + 1 + + + + + False + 9 + + @@ -411,6 +497,7 @@ False + 0 @@ -420,9 +507,10 @@ 20 + Translate @username to link True True - Translate @username to link + False True @@ -440,9 +528,10 @@ 20 + Translate sender name to link True True - Translate sender name to link + False True @@ -460,9 +549,10 @@ 20 + Translate #channel/tag to link True True - Translate #channel/tag to link + False True @@ -511,6 +601,7 @@ False False + 0 @@ -520,9 +611,10 @@ 20 + Apply filter True True - Apply filter + False True @@ -541,9 +633,10 @@ 20 + Exclude reply to me True True - Exclude reply to me + False True @@ -593,6 +686,9 @@ + + 0 + @@ -636,6 +732,9 @@ + + 0 + @@ -680,6 +779,9 @@ + + 0 + @@ -724,6 +826,9 @@ + + 0 + @@ -789,6 +894,7 @@ False + 0 @@ -797,9 +903,10 @@ 20 + Show icons in conversations True True - Show icons in conversations + False True @@ -814,30 +921,6 @@ True 4 - - - - - - - - - - - - - - - - - - - - - - - - True 40 @@ -951,9 +1034,10 @@ 20 + Enable icon update True True - Enable icon update + False True @@ -968,42 +1052,6 @@ True 6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True 20 @@ -1150,6 +1198,9 @@ + + 0 + @@ -1157,9 +1208,10 @@ 20 + Play sound on a reply to a specified recipient True True - Play sound on a reply to a specified recipient + False True @@ -1186,6 +1238,7 @@ False False + 0 @@ -1203,7 +1256,7 @@ False False - GTK_PACK_END + end 1 @@ -1230,6 +1283,7 @@ False False + 0 @@ -1241,20 +1295,18 @@ True - False - True model1 - - 0 - + + 0 + - GTK_PACK_END + end 1 @@ -1288,9 +1340,10 @@ 20 + Play sound on a message from a specified sender True True - Play sound on a message from a specified sender + False True @@ -1317,6 +1370,7 @@ False False + 0 @@ -1334,7 +1388,7 @@ False False - GTK_PACK_END + end 1 @@ -1362,6 +1416,7 @@ False False + 0 @@ -1374,20 +1429,18 @@ True - False - True model1 - - - 0 - + + + 0 + - GTK_PACK_END + end 1 @@ -1430,6 +1483,9 @@ + + 0 + @@ -1437,9 +1493,10 @@ 20 + Show text counter True True - Show text counter + False True @@ -1473,9 +1530,10 @@ 20 + Escape pseudo command for twitter True True - Escape pseudo command for twitter + False True @@ -1490,9 +1548,10 @@ 20 + Suppress oops messages True True - Suppress oops messages + False True @@ -1507,9 +1566,10 @@ 20 + Strip excessive newline characters True True - Strip excessive newline characters + False True @@ -1524,9 +1584,10 @@ 20 + Do not notify incoming messages (windows only) True True - Do not notify incoming messages (windows only) + False True @@ -1561,9 +1622,10 @@ 20 + Enable log output True True - Enable log output + False True diff -r ba00b20d968b -r 2d559555875f twitter_api.c --- a/twitter_api.c Tue Dec 16 20:31:32 2008 +0900 +++ b/twitter_api.c Mon Jan 12 00:59:41 2009 +0900 @@ -290,11 +290,15 @@ gboolean get_status_with_api(gpointer data) { + twitter_debug("called\n"); + /* fetch friends time line */ char *request, *header; char *basic_auth, *basic_auth_encoded; + gint count = purple_prefs_get_int(OPT_RETRIEVE_COUNT); - twitter_debug("called\n"); + if(count < TWITTER_DEFAULT_RETRIEVE_COUNT) + count = TWITTER_DEFAULT_RETRIEVE_COUNT; /* if disabled, just return */ if(!purple_prefs_get_bool(OPT_API_BASE_POST)) @@ -317,7 +321,8 @@ g_free(basic_auth); /* header */ - header = g_strdup_printf(TWITTER_STATUS_GET, basic_auth_encoded); + + header = g_strdup_printf(TWITTER_STATUS_GET, count, basic_auth_encoded); request = g_strconcat(header, "\r\n", NULL); /* invoke fetch */