Mercurial > pidgin-twitter
changeset 268:0926fa46afe0
simplify sending_im_cb() a bit.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Fri, 12 Dec 2008 18:11:16 +0900 |
parents | 18e71951ff27 |
children | ac9b8dc3b013 |
files | main.c |
diffstat | 1 files changed, 30 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- 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); }