comparison main.c @ 302:e17b74fdf86a

more ffeed support: - automatically prepend @me to sending message - discard parrot message
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 26 May 2009 00:37:48 +0900
parents 42cdddf0f747
children 13b268d9d034
comparison
equal deleted inserted replaced
301:3b2b68c8babd 302:e17b74fdf86a
28 source_t source; 28 source_t source;
29 static gboolean suppress_oops = FALSE; 29 static gboolean suppress_oops = FALSE;
30 static GHashTable *conv_hash = NULL; 30 static GHashTable *conv_hash = NULL;
31 static GList *wassr_parrot_list = NULL; 31 static GList *wassr_parrot_list = NULL;
32 static GList *identica_parrot_list = NULL; 32 static GList *identica_parrot_list = NULL;
33 static GList *ffeed_parrot_list = NULL;
33 #ifdef _WIN32 34 #ifdef _WIN32
34 gboolean blink_state = FALSE; 35 gboolean blink_state = FALSE;
35 gboolean blink_modified = FALSE; 36 gboolean blink_modified = FALSE;
36 #endif 37 #endif
37 38
72 void *data) 73 void *data)
73 { 74 {
74 int utflen, bytes; 75 int utflen, bytes;
75 int service = get_service_type_by_account(account, recipient); 76 int service = get_service_type_by_account(account, recipient);
76 gchar *tmp, *plain; 77 gchar *tmp, *plain;
78 gchar *ffeed_tmp;
77 gsize dummy; 79 gsize dummy;
78 80
79 twitter_debug("called\n"); 81 twitter_debug("called\n");
80 82
81 if(service == unknown_service) 83 if(service == unknown_service)
103 case identica_service: 105 case identica_service:
104 /* store sending message to address parrot problem */ 106 /* store sending message to address parrot problem */
105 identica_parrot_list = 107 identica_parrot_list =
106 g_list_prepend(identica_parrot_list, g_strdup(plain)); 108 g_list_prepend(identica_parrot_list, g_strdup(plain));
107 twitter_debug("identica parrot pushed:%s\n", plain); 109 twitter_debug("identica parrot pushed:%s\n", plain);
110 break;
111 case ffeed_service:
112 /* store sending message to address parrot problem */
113 ffeed_parrot_list =
114 g_list_prepend(ffeed_parrot_list, g_strdup(plain));
115 twitter_debug("ffeed parrot pushed:%s\n", plain);
116
117 /* prepend @me */
118 ffeed_tmp = g_strdup_printf("@me %s", plain);
119 g_free(plain);
120 plain = ffeed_tmp;
108 break; 121 break;
109 default: 122 default:
110 break; 123 break;
111 } 124 }
112 125
940 current = next; 953 current = next;
941 } 954 }
942 } 955 }
943 g_free(stripped); 956 g_free(stripped);
944 } 957 }
945 958 else if(service == identica_service) {
946 if(service == identica_service) {
947 /* discard parrot message */ 959 /* discard parrot message */
948 gchar *stripped = strip_html_markup(*buffer); 960 gchar *stripped = strip_html_markup(*buffer);
949 GList *current = g_list_first(identica_parrot_list); 961 GList *current = g_list_first(identica_parrot_list);
950 while(current) { 962 while(current) {
951 GList *next = g_list_next(current); 963 GList *next = g_list_next(current);
957 g_free(*buffer); *buffer = NULL; 969 g_free(*buffer); *buffer = NULL;
958 g_free(current->data); 970 g_free(current->data);
959 current->data = NULL; 971 current->data = NULL;
960 identica_parrot_list = 972 identica_parrot_list =
961 g_list_delete_link(identica_parrot_list, current); 973 g_list_delete_link(identica_parrot_list, current);
974 break;
975 }
976
977 current = next;
978 }
979 g_free(stripped);
980 }
981 else if(service == ffeed_service) {
982 /* discard parrot message */
983 gchar *stripped = strip_html_markup(*buffer);
984 GList *current = g_list_first(ffeed_parrot_list);
985 while(current) {
986 GList *next = g_list_next(current);
987
988 if(strstr(stripped, current->data)) {
989 twitter_debug("ffeed parrot clearing: buf = %s post = %s\n",
990 *buffer, (char *)current->data);
991 g_free(*sender); *sender = NULL;
992 g_free(*buffer); *buffer = NULL;
993 g_free(current->data);
994 current->data = NULL;
995 ffeed_parrot_list =
996 g_list_delete_link(ffeed_parrot_list, current);
962 break; 997 break;
963 } 998 }
964 999
965 current = next; 1000 current = next;
966 } 1001 }