comparison libpurple/protocols/oscar/oscar.c @ 28871:4549c3b5a0b3

oscar: Make these errors more translatable. I realized that having the untranslated "%s: %s" (error, suberror) probably wasn't translator friendly. This is (probably) better, but at the expense of four strings instead of two.
author Paul Aurich <paul@darkrain42.org>
date Tue, 03 Nov 2009 19:27:23 +0000
parents c26a59000df9
children 4575d8daba12
comparison
equal deleted inserted replaced
28870:bcf6944f09d8 28871:4549c3b5a0b3
3236 OscarData *od = purple_connection_get_protocol_data(gc); 3236 OscarData *od = purple_connection_get_protocol_data(gc);
3237 PurpleXfer *xfer; 3237 PurpleXfer *xfer;
3238 #endif 3238 #endif
3239 va_list ap; 3239 va_list ap;
3240 guint16 reason, errcode; 3240 guint16 reason, errcode;
3241 char *data, *reason_str, *buf, *error; 3241 char *data, *reason_str, *buf;
3242 3242
3243 va_start(ap, fr); 3243 va_start(ap, fr);
3244 reason = (guint16)va_arg(ap, unsigned int); 3244 reason = (guint16)va_arg(ap, unsigned int);
3245 errcode = (guint16)va_arg(ap, unsigned int); 3245 errcode = (guint16)va_arg(ap, unsigned int);
3246 data = va_arg(ap, char *); 3246 data = va_arg(ap, char *);
3261 return 1; 3261 return 1;
3262 } 3262 }
3263 #endif 3263 #endif
3264 3264
3265 /* Data is assumed to be the destination bn */ 3265 /* Data is assumed to be the destination bn */
3266
3266 reason_str = g_strdup((reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason")); 3267 reason_str = g_strdup((reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason"));
3267 if (errcode != 0 && errcode < errcodereasonlen) { 3268 if (errcode != 0 && errcode < errcodereasonlen)
3268 error = g_strdup_printf("%s: %s", reason_str, _(errcodereason[errcode])); 3269 buf = g_strdup_printf(_("Unable to send message: %s (%s)"), reason_str,
3269 g_free(reason_str); 3270 _(errcodereason[errcode]));
3270 } else 3271 else
3271 error = reason_str; 3272 buf = g_strdup_printf(_("Unable to send message: %s"), reason_str);
3272 3273
3273 buf = g_strdup_printf(_("Unable to send message: %s"), error);
3274 if (!purple_conv_present_error(data, purple_connection_get_account(gc), buf)) { 3274 if (!purple_conv_present_error(data, purple_connection_get_account(gc), buf)) {
3275 g_free(buf); 3275 g_free(buf);
3276 buf = g_strdup_printf(_("Unable to send message to %s:"), data ? data : "(unknown)"); 3276 if (errcode != 0 && errcode < errcodereasonlen)
3277 purple_notify_error(od->gc, NULL, buf, error); 3277 buf = g_strdup_printf(_("Unable to send message to %s: %s (%s)"),
3278 data ? data : "(unknown)", reason_str,
3279 _(errcodereason[errcode]));
3280 else
3281 buf = g_strdup_printf(_("Unable to send message to %s: %s"),
3282 data ? data : "(unknown)", reason_str);
3283 purple_notify_error(od->gc, NULL, buf, reason_str);
3278 } 3284 }
3279 g_free(buf); 3285 g_free(buf);
3280 g_free(error); 3286 g_free(reason_str);
3281 3287
3282 return 1; 3288 return 1;
3283 } 3289 }
3284 3290
3285 static int purple_parse_mtn(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3291 static int purple_parse_mtn(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {