Mercurial > pidgin-twitter
comparison main.c @ 268:0926fa46afe0
simplify sending_im_cb() a bit.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Fri, 12 Dec 2008 18:11:16 +0900 |
parents | c2944685ac8e |
children | ac9b8dc3b013 |
comparison
equal
deleted
inserted
replaced
267:18e71951ff27 | 268:0926fa46afe0 |
---|---|
70 static gboolean | 70 static gboolean |
71 sending_im_cb(PurpleAccount *account, char *recipient, char **buffer, | 71 sending_im_cb(PurpleAccount *account, char *recipient, char **buffer, |
72 void *data) | 72 void *data) |
73 { | 73 { |
74 int utflen, bytes; | 74 int utflen, bytes; |
75 gboolean twitter_ac = FALSE, wassr_ac = FALSE, identica_ac = FALSE; | 75 int service = get_service_type_by_account(account, recipient); |
76 gchar *tmp, *plain; | |
77 gsize dummy; | |
78 | |
76 twitter_debug("called\n"); | 79 twitter_debug("called\n"); |
77 | 80 |
78 twitter_ac = is_twitter_account(account, recipient); | 81 if(service == unknown_service) |
79 wassr_ac = is_wassr_account(account, recipient); | 82 return FALSE; |
80 identica_ac = is_identica_account(account, recipient); | |
81 | 83 |
82 /* strip all markups */ | 84 /* strip all markups */ |
83 if(twitter_ac || wassr_ac || identica_ac) { | 85 tmp = strip_html_markup(*buffer); |
84 gchar *tmp, *plain; | |
85 gsize dummy; | |
86 | |
87 tmp = strip_html_markup(*buffer); | |
88 | 86 |
89 #ifndef _WIN32 | 87 #ifndef _WIN32 |
90 if(sanitize_utf) { | 88 if(sanitize_utf) { |
91 plain = sanitize_utf(tmp, -1, &dummy); | 89 plain = sanitize_utf(tmp, -1, &dummy); |
92 g_free(tmp); | 90 g_free(tmp); |
93 } | 91 } |
94 else | 92 else |
95 #endif | 93 #endif |
96 plain = tmp; | 94 plain = tmp; |
97 | 95 |
98 if(wassr_ac) { | 96 if(wassr_service) { |
99 /* store sending message to address parrot problem */ | 97 /* store sending message to address parrot problem */ |
100 wassr_parrot_list = | 98 wassr_parrot_list = |
101 g_list_prepend(wassr_parrot_list, g_strdup(plain)); | 99 g_list_prepend(wassr_parrot_list, g_strdup(plain)); |
102 twitter_debug("wassr parrot pushed:%s\n", plain); | 100 twitter_debug("wassr parrot pushed:%s\n", plain); |
103 } | 101 } |
104 else if(identica_ac) { | 102 else if(identica_service) { |
105 /* store sending message to address parrot problem */ | 103 /* store sending message to address parrot problem */ |
106 identica_parrot_list = | 104 identica_parrot_list = |
107 g_list_prepend(identica_parrot_list, g_strdup(plain)); | 105 g_list_prepend(identica_parrot_list, g_strdup(plain)); |
108 twitter_debug("identica parrot pushed:%s\n", plain); | 106 twitter_debug("identica parrot pushed:%s\n", plain); |
109 } | 107 } |
110 | 108 |
111 g_free(*buffer); | 109 g_free(*buffer); |
112 *buffer = g_markup_escape_text(plain, -1); | 110 *buffer = g_markup_escape_text(plain, -1); |
113 g_free(plain); | 111 g_free(plain); |
114 } | |
115 | 112 |
116 /* return here if the message is not to twitter */ | 113 /* return here if the message is not to twitter */ |
117 if(!twitter_ac) | 114 if(!twitter_service) |
118 return FALSE; | 115 return FALSE; |
119 | 116 |
120 /* escape pseudo command */ | 117 /* escape pseudo command */ |
121 if(twitter_ac && | 118 if(twitter_service && |
122 purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { | 119 purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { |
123 escape(buffer); | 120 escape(buffer); |
124 } | 121 } |
125 | 122 |
126 /* update status with Twitter API instead of IM protocol */ | 123 /* update status with Twitter API instead of IM protocol */ |