diff -pruN bitlbee-1.2.3/irc.c bitlbee-1.2.3_new/irc.c
|
old
|
new
|
|
| 149 | 149 | s = set_add( &irc->set, "buddy_sendbuffer", "false", set_eval_bool, irc ); |
| 150 | 150 | s = set_add( &irc->set, "buddy_sendbuffer_delay", "200", set_eval_int, irc ); |
| 151 | 151 | s = set_add( &irc->set, "charset", "utf-8", set_eval_charset, irc ); |
| | 152 | s = set_add( &irc->set, "oscar_recode_charset", "utf-8", set_eval_oscar_recode_charset, irc ); |
| 152 | 153 | s = set_add( &irc->set, "debug", "false", set_eval_bool, irc ); |
| 153 | 154 | s = set_add( &irc->set, "default_target", "root", NULL, irc ); |
| 154 | 155 | s = set_add( &irc->set, "display_namechanges", "false", set_eval_bool, irc ); |
diff -pruN bitlbee-1.2.3/protocols/oscar/oscar.c bitlbee-1.2.3_new/protocols/oscar/oscar.c
|
old
|
new
|
|
| 1055 | 1055 | return 1; |
| 1056 | 1056 | } |
| 1057 | 1057 | |
| | 1058 | static char *get_oscar_recode_charset(struct im_connection *ic ) { |
| | 1059 | char *cs; |
| | 1060 | char *src = "cp1250"; |
| | 1061 | if ((cs = set_getstr(&ic->irc->set, "oscar_recode_charset")) && (g_strcasecmp(cs, "utf-8") != 0)) |
| | 1062 | src = cs; |
| | 1063 | return src; |
| | 1064 | } |
| | 1065 | |
| 1058 | 1066 | static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
| 1059 | 1067 | char *tmp = g_malloc(BUF_LONG + 1); |
| 1060 | 1068 | struct im_connection *ic = sess->aux_data; |
| … |
… |
|
| 1069 | 1077 | if (args->icbmflags & AIM_IMFLAGS_UNICODE) |
| 1070 | 1078 | src = "UNICODEBIG"; |
| 1071 | 1079 | else |
| 1072 | | src = "ISO8859-1"; |
| 1073 | | |
| | 1080 | src = get_oscar_recode_charset(ic); |
| | 1081 | |
| 1074 | 1082 | /* Try to use iconv first to convert the message to UTF8 - which is what BitlBee expects */ |
| 1075 | 1083 | if (do_iconv(src, "UTF-8", args->msg, tmp, args->msglen, BUF_LONG) >= 0) { |
| 1076 | 1084 | // Successfully converted! |
| … |
… |
|
| 2271 | 2279 | { |
| 2272 | 2280 | struct im_connection *ic = sess->aux_data; |
| 2273 | 2281 | struct oscar_data *od = ic->proto_data; |
| | 2282 | char tmp[BUF_LONG]; |
| 2274 | 2283 | gchar who[16]; |
| 2275 | 2284 | GString *str; |
| 2276 | 2285 | va_list ap; |
| … |
… |
|
| 2287 | 2296 | str = g_string_sized_new(512); |
| 2288 | 2297 | g_snprintf(who, sizeof(who), "%u", info->uin); |
| 2289 | 2298 | |
| | 2299 | #define translate(x) ((do_iconv(get_oscar_recode_charset(ic), "UTF-8", x, tmp, strlen(x), BUF_LONG) >= 0) ? tmp : x) |
| | 2300 | |
| 2290 | 2301 | g_string_printf(str, "%s: %s - %s: %s", _("UIN"), who, _("Nick"), |
| 2291 | | info->nick ? info->nick : "-"); |
| 2292 | | g_string_append_printf(str, "\n%s: %s", _("First Name"), info->first); |
| 2293 | | g_string_append_printf(str, "\n%s: %s", _("Last Name"), info->last); |
| | 2302 | info->nick ? translate(info->nick) : "-"); |
| | 2303 | g_string_append_printf(str, "\n%s: %s", _("First Name"), translate(info->first)); |
| | 2304 | g_string_append_printf(str, "\n%s: %s", _("Last Name"), translate(info->last)); |
| | 2305 | |
| 2294 | 2306 | g_string_append_printf(str, "\n%s: %s", _("Email Address"), info->email); |
| 2295 | 2307 | if (info->numaddresses && info->email2) { |
| 2296 | 2308 | int i; |
| … |
… |
|
| 2323 | 2335 | g_string_append_printf(str, "\n%s: %s", _("Personal Web Page"), info->personalwebpage); |
| 2324 | 2336 | if (info->info && info->info[0]) { |
| 2325 | 2337 | g_string_sprintfa(str, "\n%s:\n%s\n%s", _("Additional Information"), |
| 2326 | | info->info, _("End of Additional Information")); |
| | 2338 | translate(info->info), _("End of Additional Information")); |
| 2327 | 2339 | } |
| 2328 | 2340 | g_string_append_c(str, '\n'); |
| 2329 | 2341 | if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { |
| 2330 | 2342 | g_string_append_printf(str, "%s:", _("Home Address")); |
| 2331 | | g_string_append_printf(str, "\n%s: %s", _("Address"), info->homeaddr); |
| 2332 | | g_string_append_printf(str, "\n%s: %s", _("City"), info->homecity); |
| 2333 | | g_string_append_printf(str, "\n%s: %s", _("State"), info->homestate); |
| | 2343 | g_string_append_printf(str, "\n%s: %s", _("Address"), translate(info->homeaddr)); |
| | 2344 | g_string_append_printf(str, "\n%s: %s", _("City"), translate(info->homecity)); |
| | 2345 | g_string_append_printf(str, "\n%s: %s", _("State"), translate(info->homestate)); |
| 2334 | 2346 | g_string_append_printf(str, "\n%s: %s", _("Zip Code"), info->homezip); |
| 2335 | 2347 | g_string_append_c(str, '\n'); |
| 2336 | 2348 | } |
| 2337 | 2349 | if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { |
| 2338 | 2350 | g_string_append_printf(str, "%s:", _("Work Address")); |
| 2339 | | g_string_append_printf(str, "\n%s: %s", _("Address"), info->workaddr); |
| 2340 | | g_string_append_printf(str, "\n%s: %s", _("City"), info->workcity); |
| 2341 | | g_string_append_printf(str, "\n%s: %s", _("State"), info->workstate); |
| | 2351 | g_string_append_printf(str, "\n%s: %s", _("Address"), translate(info->workaddr)); |
| | 2352 | g_string_append_printf(str, "\n%s: %s", _("City"), translate(info->workcity)); |
| | 2353 | g_string_append_printf(str, "\n%s: %s", _("State"), translate(info->workstate)); |
| 2342 | 2354 | g_string_append_printf(str, "\n%s: %s", _("Zip Code"), info->workzip); |
| 2343 | 2355 | g_string_append_c(str, '\n'); |
| 2344 | 2356 | } |
| 2345 | 2357 | if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { |
| 2346 | 2358 | g_string_append_printf(str, "%s:", _("Work Information")); |
| 2347 | | g_string_append_printf(str, "\n%s: %s", _("Company"), info->workcompany); |
| 2348 | | g_string_append_printf(str, "\n%s: %s", _("Division"), info->workdivision); |
| 2349 | | g_string_append_printf(str, "\n%s: %s", _("Position"), info->workposition); |
| | 2359 | g_string_append_printf(str, "\n%s: %s", _("Company"), translate(info->workcompany)); |
| | 2360 | g_string_append_printf(str, "\n%s: %s", _("Division"), translate(info->workdivision)); |
| | 2361 | g_string_append_printf(str, "\n%s: %s", _("Position"), translate(info->workposition)); |
| 2350 | 2362 | if (info->workwebpage && info->workwebpage[0]) { |
| 2351 | 2363 | g_string_append_printf(str, "\n%s: %s", _("Web Page"), info->workwebpage); |
| 2352 | 2364 | } |
| 2353 | 2365 | g_string_append_c(str, '\n'); |
| 2354 | 2366 | } |
| 2355 | 2367 | |
| | 2368 | #undef translate |
| | 2369 | |
| 2356 | 2370 | imcb_log(ic, "%s\n%s", _("User Info"), str->str); |
| 2357 | 2371 | g_string_free(str, TRUE); |
| 2358 | 2372 | |
diff -pruN bitlbee-1.2.3/set.c bitlbee-1.2.3_new/set.c
|
old
|
new
|
|
| 245 | 245 | |
| 246 | 246 | return value; |
| 247 | 247 | } |
| | 248 | |
| | 249 | char *set_eval_oscar_recode_charset( set_t *set, char *value ) |
| | 250 | { |
| | 251 | GIConv cd; |
| | 252 | |
| | 253 | if ( g_strncasecmp( value, "none", 4 ) == 0 ) |
| | 254 | return value; |
| | 255 | |
| | 256 | cd = g_iconv_open( "UTF-8", value ); |
| | 257 | if( cd == (GIConv) -1 ) |
| | 258 | return NULL; |
| | 259 | |
| | 260 | g_iconv_close( cd ); |
| | 261 | return value; |
| | 262 | } |
| | 263 | |
diff -pruN bitlbee-1.2.3/set.h bitlbee-1.2.3_new/set.h
|
old
|
new
|
|
| 100 | 100 | /* Some not very generic evaluators that really shouldn't be here... */ |
| 101 | 101 | char *set_eval_to_char( set_t *set, char *value ); |
| 102 | 102 | char *set_eval_ops( set_t *set, char *value ); |
| | 103 | char *set_eval_oscar_recode_charset( set_t *set, char *value ); |
| 103 | 104 | |
| 104 | 105 | #endif /* __SET_H__ */ |