# HG changeset patch # User Yoshiki Yazawa # Date 1229073076 -32400 # Node ID 0926fa46afe0a7024e2e48b7b9113fcf4fa7e28e # Parent 18e71951ff27a488e50aa2bea2841b7b7b4969af simplify sending_im_cb() a bit. diff -r 18e71951ff27 -r 0926fa46afe0 main.c --- a/main.c Fri Dec 12 17:54:02 2008 +0900 +++ b/main.c Fri Dec 12 18:11:16 2008 +0900 @@ -72,53 +72,50 @@ void *data) { int utflen, bytes; - gboolean twitter_ac = FALSE, wassr_ac = FALSE, identica_ac = FALSE; + int service = get_service_type_by_account(account, recipient); + gchar *tmp, *plain; + gsize dummy; + twitter_debug("called\n"); - twitter_ac = is_twitter_account(account, recipient); - wassr_ac = is_wassr_account(account, recipient); - identica_ac = is_identica_account(account, recipient); + if(service == unknown_service) + return FALSE; /* strip all markups */ - if(twitter_ac || wassr_ac || identica_ac) { - gchar *tmp, *plain; - gsize dummy; - - tmp = strip_html_markup(*buffer); + tmp = strip_html_markup(*buffer); #ifndef _WIN32 - if(sanitize_utf) { - plain = sanitize_utf(tmp, -1, &dummy); - g_free(tmp); - } - else + if(sanitize_utf) { + plain = sanitize_utf(tmp, -1, &dummy); + g_free(tmp); + } + else #endif - plain = tmp; + plain = tmp; - if(wassr_ac) { - /* store sending message to address parrot problem */ - wassr_parrot_list = - g_list_prepend(wassr_parrot_list, g_strdup(plain)); - twitter_debug("wassr parrot pushed:%s\n", plain); - } - else if(identica_ac) { - /* store sending message to address parrot problem */ - identica_parrot_list = - g_list_prepend(identica_parrot_list, g_strdup(plain)); - twitter_debug("identica parrot pushed:%s\n", plain); - } - - g_free(*buffer); - *buffer = g_markup_escape_text(plain, -1); - g_free(plain); + if(wassr_service) { + /* store sending message to address parrot problem */ + wassr_parrot_list = + g_list_prepend(wassr_parrot_list, g_strdup(plain)); + twitter_debug("wassr parrot pushed:%s\n", plain); + } + else if(identica_service) { + /* store sending message to address parrot problem */ + identica_parrot_list = + g_list_prepend(identica_parrot_list, g_strdup(plain)); + twitter_debug("identica parrot pushed:%s\n", plain); } + g_free(*buffer); + *buffer = g_markup_escape_text(plain, -1); + g_free(plain); + /* return here if the message is not to twitter */ - if(!twitter_ac) + if(!twitter_service) return FALSE; /* escape pseudo command */ - if(twitter_ac && + if(twitter_service && purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { escape(buffer); }