# HG changeset patch # User Yoshiki Yazawa # Date 1219789204 -32400 # Node ID 6b258bdd9c49afad4afdce36ed3d5a3118adc565 # Parent 148fa8a8be8e4671ec202fdaca6c4129e22977fe added a feature of excluding reply to me from filter application. diff -r 148fa8a8be8e -r 6b258bdd9c49 pidgin-twitter.c --- a/pidgin-twitter.c Tue Aug 26 18:56:06 2008 +0900 +++ b/pidgin-twitter.c Wed Aug 27 07:20:04 2008 +0900 @@ -1529,6 +1529,7 @@ { GMatchInfo *match_info; const gchar *list = NULL; + gchar *screen_name = NULL; gchar **candidates = NULL, **candidate = NULL; g_return_if_fail(*sender != NULL); @@ -1539,18 +1540,31 @@ switch(service) { case twitter_service: list = purple_prefs_get_string(OPT_FILTER_TWITTER); + screen_name = g_strdup_printf("@%s", purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER)); break; case wassr_service: list = purple_prefs_get_string(OPT_FILTER_WASSR); + screen_name = g_strdup_printf("@%s", purple_prefs_get_string(OPT_SCREEN_NAME_WASSR)); break; case identica_service: list = purple_prefs_get_string(OPT_FILTER_IDENTICA); + screen_name = g_strdup_printf("@%s", purple_prefs_get_string(OPT_SCREEN_NAME_IDENTICA)); break; } g_return_if_fail(list != NULL); if(strstr(list, DEFAULT_LIST)) return; + /* find @myself */ + if(purple_prefs_get_bool(OPT_FILTER_EXCLUDE_REPLY) && + strstr(plain, screen_name)) { + g_free(plain); + g_free(screen_name); + return; + } + else + g_free(screen_name); + candidates = g_strsplit_set(list, " ,:;", 0); g_return_if_fail(candidates != NULL); @@ -1566,12 +1580,12 @@ twitter_debug("candidate = %s\n", *candidate); if(!strcmp(user, *candidate)) { twitter_debug("match. filter %s\n", user); -// *flags |= PURPLE_MESSAGE_INVISIBLE; /* pidgin should handle this flag properly --yaz */ -#if 1 + /* pidgin should handle this flag properly --yaz */ +// *flags |= PURPLE_MESSAGE_INVISIBLE; + /* temporal workaround */ g_free(*sender); *sender = NULL; g_free(*buffer); *buffer = NULL; -#endif break; } } @@ -1579,6 +1593,7 @@ g_free(user); g_match_info_next(match_info, NULL); } + g_free(plain); g_strfreev(candidates); g_match_info_free(match_info); @@ -2874,13 +2889,20 @@ /***************/ /* filter page */ /***************/ - e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_check")); + e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_filter_check")); g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), purple_prefs_get_bool(OPT_FILTER)); g_signal_connect(e, "toggled", G_CALLBACK(bool_toggled_cb), &e); + e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_exclude_reply_check")); + g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER_EXCLUDE_REPLY); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), + purple_prefs_get_bool(OPT_FILTER_EXCLUDE_REPLY)); + g_signal_connect(e, "toggled", + G_CALLBACK(bool_toggled_cb), &e); + e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_twitter")); g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER_TWITTER); text = purple_prefs_get_string(OPT_FILTER_TWITTER); @@ -3166,6 +3188,7 @@ purple_prefs_add_bool(OPT_LOG_OUTPUT, FALSE); purple_prefs_add_bool(OPT_FILTER, TRUE); + purple_prefs_add_bool(OPT_FILTER_EXCLUDE_REPLY, TRUE); purple_prefs_add_string(OPT_FILTER_TWITTER, DEFAULT_LIST); purple_prefs_add_string(OPT_FILTER_WASSR, DEFAULT_LIST); purple_prefs_add_string(OPT_FILTER_IDENTICA, DEFAULT_LIST); diff -r 148fa8a8be8e -r 6b258bdd9c49 pidgin-twitter.h --- a/pidgin-twitter.h Tue Aug 26 18:56:06 2008 +0900 +++ b/pidgin-twitter.h Wed Aug 27 07:20:04 2008 +0900 @@ -122,9 +122,11 @@ #define OPT_API_BASE_GET_INTERVAL OPT_PIDGINTWITTER "/api_base_get_interval" #define OPT_LOG_OUTPUT OPT_PIDGINTWITTER "/log_output" #define OPT_FILTER OPT_PIDGINTWITTER "/filter" +#define OPT_FILTER_EXCLUDE_REPLY OPT_PIDGINTWITTER "/filter_exclude_reply" #define OPT_FILTER_TWITTER OPT_PIDGINTWITTER "/filter_twitter" #define OPT_FILTER_WASSR OPT_PIDGINTWITTER "/filter_wassr" #define OPT_FILTER_IDENTICA OPT_PIDGINTWITTER "/filter_identica" + #ifdef _WIN32 #define OPT_PIDGIN_BLINK_IM PIDGIN_PREFS_ROOT "/win32/blink_im" #endif diff -r 148fa8a8be8e -r 6b258bdd9c49 prefs.ui --- a/prefs.ui Tue Aug 26 18:56:06 2008 +0900 +++ b/prefs.ui Wed Aug 27 07:20:04 2008 +0900 @@ -482,7 +482,7 @@ 0 20 - + True True Apply filter @@ -499,6 +499,28 @@ + + True + 0 + 20 + + + True + True + Exclude reply to me from application + 0 + True + + + + + False + False + 2 + 2 + + + True 0 @@ -517,7 +539,7 @@ False False - 2 + 3 @@ -561,7 +583,7 @@ False False 2 - 3 + 4 @@ -604,7 +626,7 @@ False False 2 - 4 + 5 @@ -648,7 +670,7 @@ False False 2 - 5 + 6 @@ -738,17 +760,46 @@ - + True - 40 + + + + + + 2 + 3 + + + + + + + True - + + + + + 1 + 2 + + + + + + True + 20 + + True - Icon size + pixel + 3 + 4 @@ -775,46 +826,17 @@ - + True - 20 + 40 - + True - pixel + Icon size - 3 - 4 - - - - - - - True - - - - - - 1 - 2 - - - - - - True - - - - - - 2 - 3 @@ -905,24 +927,72 @@ - + True - 20 - + + + + + 1 + 2 + + + + + + True + 40 + + True - days + Update every - 5 - 6 + + True + 4 + + + True + True + 1 + True + True + + + + + 2 + 3 + + + + + + + True + + + True + times or + + + + + 3 + 4 + + + + True 4 @@ -945,71 +1015,23 @@ - + True + 20 - + True - times or - - - - - 3 - 4 - - - - - - True - 4 - - - True - True - 1 - True - True + days - 2 - 3 + 5 + 6 - - - True - 40 - - - True - Update every - - - - - - - - - - - True - - - - - - 1 - 2 - - - False