changeset 222:b168502b73c3

expanded size of substitution buffer to 32KB. 128 bytes were not sufficient if both user name and channel name are rather long. tenforward reported this problem and umq pointed out the cause.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 03 Sep 2008 18:39:39 +0900
parents b5fa0c295ff5
children c3efae72f72a
files pidgin-twitter.c pidgin-twitter.h
diffstat 2 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Tue Sep 02 13:19:25 2008 +0900
+++ b/pidgin-twitter.c	Wed Sep 03 18:39:39 2008 +0900
@@ -888,7 +888,7 @@
     eval_data *data = (eval_data *)user_data;
     gint which = data->which;
     gint service = data->service;
-    gchar sub[128];
+    gchar sub[SUBST_BUF_SIZE];
 
     twitter_debug("which = %d service = %d\n", which, service);
 
@@ -909,7 +909,7 @@
             twitter_debug("unknown service\n");
             break;
         }
-        g_snprintf(sub, 128, format, match, match);
+        g_snprintf(sub, SUBST_BUF_SIZE, format, match, match);
         g_free(match);
     }
     else if(which == SENDER) {
@@ -932,7 +932,7 @@
             break;
         }
 
-        g_snprintf(sub, 128, format, match1 ? match1: "", match2, match2);
+        g_snprintf(sub, SUBST_BUF_SIZE, format, match1 ? match1: "", match2, match2);
 
         g_free(match1);
         g_free(match2);
@@ -942,7 +942,7 @@
         gchar *match2 = g_match_info_fetch(match_info, 2); /* channel */
         const gchar *format = CHANNEL_FORMAT_WASSR;
 
-        g_snprintf(sub, 128, format, match1 ? match1: "", match2, match2);
+        g_snprintf(sub, SUBST_BUF_SIZE, format, match1 ? match1: "", match2, match2);
 
         g_free(match1);
         g_free(match2);
@@ -950,7 +950,7 @@
     else if(which == TAG_IDENTICA && service == identica_service) {
         gchar *match = g_match_info_fetch(match_info, 1);
         const gchar *format = TAG_FORMAT_IDENTICA;
-        g_snprintf(sub, 128, format, match, match);
+        g_snprintf(sub, SUBST_BUF_SIZE, format, match, match);
         g_free(match);
     }
 
@@ -2381,7 +2381,7 @@
     twitter_debug("called\n");
 
     if(service == unknown_service) {
-        twitter_debug("neither twitter or wassr conv\n");
+        twitter_debug("neither twitter nor wassr conv\n");
         return FALSE;
     }
 
--- a/pidgin-twitter.h	Tue Sep 02 13:19:25 2008 +0900
+++ b/pidgin-twitter.h	Wed Sep 03 18:39:39 2008 +0900
@@ -176,6 +176,9 @@
 #define TWITTER_DEFAULT_INTERVAL (60)
 #define TWITTER_DEFAULT_ICON_URL "http://static.twitter.com/images/default_profile_bigger.png"
 
+/* size of substitution buffer */
+#define SUBST_BUF_SIZE (32 * 1024)
+
 /* wassr specific macros */
 #define WASSR_POST_LEN (255)
 #define IDENTICA_POST_LEN (140)