comparison pidgin-twitter.c @ 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
comparison
equal deleted inserted replaced
221:b5fa0c295ff5 222:b168502b73c3
886 eval(const GMatchInfo *match_info, GString *result, gpointer user_data) 886 eval(const GMatchInfo *match_info, GString *result, gpointer user_data)
887 { 887 {
888 eval_data *data = (eval_data *)user_data; 888 eval_data *data = (eval_data *)user_data;
889 gint which = data->which; 889 gint which = data->which;
890 gint service = data->service; 890 gint service = data->service;
891 gchar sub[128]; 891 gchar sub[SUBST_BUF_SIZE];
892 892
893 twitter_debug("which = %d service = %d\n", which, service); 893 twitter_debug("which = %d service = %d\n", which, service);
894 894
895 if(which == RECIPIENT) { 895 if(which == RECIPIENT) {
896 gchar *match = g_match_info_fetch(match_info, 1); 896 gchar *match = g_match_info_fetch(match_info, 1);
907 break; 907 break;
908 default: 908 default:
909 twitter_debug("unknown service\n"); 909 twitter_debug("unknown service\n");
910 break; 910 break;
911 } 911 }
912 g_snprintf(sub, 128, format, match, match); 912 g_snprintf(sub, SUBST_BUF_SIZE, format, match, match);
913 g_free(match); 913 g_free(match);
914 } 914 }
915 else if(which == SENDER) { 915 else if(which == SENDER) {
916 gchar *match1 = g_match_info_fetch(match_info, 1); /*preceding CR|LF*/ 916 gchar *match1 = g_match_info_fetch(match_info, 1); /*preceding CR|LF*/
917 gchar *match2 = g_match_info_fetch(match_info, 2); /* sender */ 917 gchar *match2 = g_match_info_fetch(match_info, 2); /* sender */
930 default: 930 default:
931 twitter_debug("unknown service\n"); 931 twitter_debug("unknown service\n");
932 break; 932 break;
933 } 933 }
934 934
935 g_snprintf(sub, 128, format, match1 ? match1: "", match2, match2); 935 g_snprintf(sub, SUBST_BUF_SIZE, format, match1 ? match1: "", match2, match2);
936 936
937 g_free(match1); 937 g_free(match1);
938 g_free(match2); 938 g_free(match2);
939 } 939 }
940 else if(which == CHANNEL_WASSR && service == wassr_service) { 940 else if(which == CHANNEL_WASSR && service == wassr_service) {
941 gchar *match1 = g_match_info_fetch(match_info, 1); /*before channel*/ 941 gchar *match1 = g_match_info_fetch(match_info, 1); /*before channel*/
942 gchar *match2 = g_match_info_fetch(match_info, 2); /* channel */ 942 gchar *match2 = g_match_info_fetch(match_info, 2); /* channel */
943 const gchar *format = CHANNEL_FORMAT_WASSR; 943 const gchar *format = CHANNEL_FORMAT_WASSR;
944 944
945 g_snprintf(sub, 128, format, match1 ? match1: "", match2, match2); 945 g_snprintf(sub, SUBST_BUF_SIZE, format, match1 ? match1: "", match2, match2);
946 946
947 g_free(match1); 947 g_free(match1);
948 g_free(match2); 948 g_free(match2);
949 } 949 }
950 else if(which == TAG_IDENTICA && service == identica_service) { 950 else if(which == TAG_IDENTICA && service == identica_service) {
951 gchar *match = g_match_info_fetch(match_info, 1); 951 gchar *match = g_match_info_fetch(match_info, 1);
952 const gchar *format = TAG_FORMAT_IDENTICA; 952 const gchar *format = TAG_FORMAT_IDENTICA;
953 g_snprintf(sub, 128, format, match, match); 953 g_snprintf(sub, SUBST_BUF_SIZE, format, match, match);
954 g_free(match); 954 g_free(match);
955 } 955 }
956 956
957 g_string_append(result, sub); 957 g_string_append(result, sub);
958 twitter_debug("sub = %s\n", sub); 958 twitter_debug("sub = %s\n", sub);
2379 gint linenumber = 0; 2379 gint linenumber = 0;
2380 2380
2381 twitter_debug("called\n"); 2381 twitter_debug("called\n");
2382 2382
2383 if(service == unknown_service) { 2383 if(service == unknown_service) {
2384 twitter_debug("neither twitter or wassr conv\n"); 2384 twitter_debug("neither twitter nor wassr conv\n");
2385 return FALSE; 2385 return FALSE;
2386 } 2386 }
2387 2387
2388 /* get text buffer */ 2388 /* get text buffer */
2389 imhtml = GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml); 2389 imhtml = GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml);