comparison libpurple/protocols/msn/session.c @ 20120:557c4c67bd29

Use purple_connection_error_reason in prpl-msn.
author Will Thompson <will.thompson@collabora.co.uk>
date Wed, 19 Sep 2007 16:38:33 +0000
parents 44b4e8bd759b
children f3cfcbbac3d8
comparison
equal deleted inserted replaced
20119:ec3471ab96d6 20120:557c4c67bd29
284 void 284 void
285 msn_session_set_error(MsnSession *session, MsnErrorType error, 285 msn_session_set_error(MsnSession *session, MsnErrorType error,
286 const char *info) 286 const char *info)
287 { 287 {
288 PurpleConnection *gc; 288 PurpleConnection *gc;
289 PurpleDisconnectReason reason;
289 char *msg; 290 char *msg;
290 291
291 gc = purple_account_get_connection(session->account); 292 gc = purple_account_get_connection(session->account);
292 293
293 switch (error) 294 switch (error)
294 { 295 {
295 case MSN_ERROR_SERVCONN: 296 case MSN_ERROR_SERVCONN:
297 reason = PURPLE_REASON_NETWORK_ERROR;
296 msg = g_strdup(info); 298 msg = g_strdup(info);
297 break; 299 break;
298 case MSN_ERROR_UNSUPPORTED_PROTOCOL: 300 case MSN_ERROR_UNSUPPORTED_PROTOCOL:
301 reason = PURPLE_REASON_NETWORK_ERROR;
299 msg = g_strdup(_("Our protocol is not supported by the " 302 msg = g_strdup(_("Our protocol is not supported by the "
300 "server.")); 303 "server."));
301 break; 304 break;
302 case MSN_ERROR_HTTP_MALFORMED: 305 case MSN_ERROR_HTTP_MALFORMED:
306 reason = PURPLE_REASON_NETWORK_ERROR;
303 msg = g_strdup(_("Error parsing HTTP.")); 307 msg = g_strdup(_("Error parsing HTTP."));
304 break; 308 break;
305 case MSN_ERROR_SIGN_OTHER: 309 case MSN_ERROR_SIGN_OTHER:
306 gc->wants_to_die = TRUE; 310 gc->wants_to_die = TRUE;
311 reason = PURPLE_REASON_NAME_IN_USE;
307 msg = g_strdup(_("You have signed on from another location.")); 312 msg = g_strdup(_("You have signed on from another location."));
308 break; 313 break;
309 case MSN_ERROR_SERV_UNAVAILABLE: 314 case MSN_ERROR_SERV_UNAVAILABLE:
315 reason = PURPLE_REASON_NETWORK_ERROR;
310 msg = g_strdup(_("The MSN servers are temporarily " 316 msg = g_strdup(_("The MSN servers are temporarily "
311 "unavailable. Please wait and try " 317 "unavailable. Please wait and try "
312 "again.")); 318 "again."));
313 break; 319 break;
314 case MSN_ERROR_SERV_DOWN: 320 case MSN_ERROR_SERV_DOWN:
321 reason = PURPLE_REASON_NETWORK_ERROR;
315 msg = g_strdup(_("The MSN servers are going down " 322 msg = g_strdup(_("The MSN servers are going down "
316 "temporarily.")); 323 "temporarily."));
317 break; 324 break;
318 case MSN_ERROR_AUTH: 325 case MSN_ERROR_AUTH:
326 reason = PURPLE_REASON_AUTHENTICATION_FAILED;
319 gc->wants_to_die = TRUE; 327 gc->wants_to_die = TRUE;
320 msg = g_strdup_printf(_("Unable to authenticate: %s"), 328 msg = g_strdup_printf(_("Unable to authenticate: %s"),
321 (info == NULL ) ? 329 (info == NULL ) ?
322 _("Unknown error") : info); 330 _("Unknown error") : info);
323 break; 331 break;
324 case MSN_ERROR_BAD_BLIST: 332 case MSN_ERROR_BAD_BLIST:
333 reason = PURPLE_REASON_NETWORK_ERROR;
325 msg = g_strdup(_("Your MSN buddy list is temporarily " 334 msg = g_strdup(_("Your MSN buddy list is temporarily "
326 "unavailable. Please wait and try " 335 "unavailable. Please wait and try "
327 "again.")); 336 "again."));
328 break; 337 break;
329 default: 338 default:
339 reason = PURPLE_REASON_NETWORK_ERROR;
330 msg = g_strdup(_("Unknown error.")); 340 msg = g_strdup(_("Unknown error."));
331 break; 341 break;
332 } 342 }
333 343
334 msn_session_disconnect(session); 344 msn_session_disconnect(session);
335 345
336 purple_connection_error(gc, msg); 346 purple_connection_error_reason (gc, reason, msg);
337 347
338 g_free(msg); 348 g_free(msg);
339 } 349 }
340 350
341 static const char * 351 static const char *