Mercurial > pidgin.yaz
comparison src/protocols/oscar/oscar.c @ 9627:8a540b8a5f70
[gaim-migrate @ 10471]
A bug fix for away message tooltips and some more removing-gaim_notify_errors.
Here's the thought: for errors associated with a buddy, check to see if
there's already a window open for him, if so, print the error to the window
and present the window to the user. If not, you can go ahead and gaim_notify_error.
So, things like checking profiles in the buddy list might potentially print errors
to conversations. I think this is good, but we'll try it out a bit.
If it's really good, we won't even gaim_notify_error and instead create a new convo
window just for the error.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 01 Aug 2004 00:31:45 +0000 |
parents | afd069368860 |
children | 71c31e4505fd |
comparison
equal
deleted
inserted
replaced
9626:afd069368860 | 9627:8a540b8a5f70 |
---|---|
1412 gaim_debug_error("oscar", | 1412 gaim_debug_error("oscar", |
1413 "major connection error\n"); | 1413 "major connection error\n"); |
1414 gaim_connection_error(gc, _("Disconnected.")); | 1414 gaim_connection_error(gc, _("Disconnected.")); |
1415 } else if (conn->type == AIM_CONN_TYPE_CHAT) { | 1415 } else if (conn->type == AIM_CONN_TYPE_CHAT) { |
1416 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | 1416 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); |
1417 GaimConversation *conv = gaim_find_chat(gc, c->id); | |
1417 char *buf; | 1418 char *buf; |
1418 gaim_debug_info("oscar", | 1419 gaim_debug_info("oscar", |
1419 "disconnected from chat room %s\n", c->name); | 1420 "disconnected from chat room %s\n", c->name); |
1420 c->conn = NULL; | 1421 c->conn = NULL; |
1421 if (c->inpa > 0) | 1422 if (c->inpa > 0) |
1422 gaim_input_remove(c->inpa); | 1423 gaim_input_remove(c->inpa); |
1423 c->inpa = 0; | 1424 c->inpa = 0; |
1424 c->fd = -1; | 1425 c->fd = -1; |
1425 aim_conn_kill(od->sess, &conn); | 1426 aim_conn_kill(od->sess, &conn); |
1426 buf = g_strdup_printf(_("You have been disconnected from chat room %s."), c->name); | 1427 buf = g_strdup_printf(_("You have been disconnected from chat room %s."), c->name); |
1427 gaim_notify_error(gc, NULL, buf, NULL); | 1428 if (conv) |
1429 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_ERROR, time(NULL)); | |
1430 else | |
1431 gaim_notify_error(gc, NULL, buf, NULL); | |
1428 g_free(buf); | 1432 g_free(buf); |
1429 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { | 1433 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
1430 if (od->cnpa > 0) | 1434 if (od->cnpa > 0) |
1431 gaim_input_remove(od->cnpa); | 1435 gaim_input_remove(od->cnpa); |
1432 od->cnpa = 0; | 1436 od->cnpa = 0; |
3676 } | 3680 } |
3677 | 3681 |
3678 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { | 3682 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
3679 GaimConnection *gc = sess->aux_data; | 3683 GaimConnection *gc = sess->aux_data; |
3680 GaimAccount *account = gaim_connection_get_account(gc); | 3684 GaimAccount *account = gaim_connection_get_account(gc); |
3681 GaimConversation *conv; | |
3682 char *buf; | 3685 char *buf; |
3683 va_list ap; | 3686 va_list ap; |
3684 fu16_t chan, nummissed, reason; | 3687 fu16_t chan, nummissed, reason; |
3685 aim_userinfo_t *userinfo; | 3688 aim_userinfo_t *userinfo; |
3686 | 3689 |
3746 nummissed, | 3749 nummissed, |
3747 userinfo->sn); | 3750 userinfo->sn); |
3748 break; | 3751 break; |
3749 } | 3752 } |
3750 | 3753 |
3751 conv = gaim_find_conversation_with_account(userinfo->sn, account); | 3754 if (!gaim_conv_present_error(userinfo->sn, account, buf)) |
3752 if (conv != NULL) | |
3753 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_ERROR, time(NULL)); | |
3754 else | |
3755 gaim_notify_error(sess->aux_data, NULL, buf, NULL); | 3755 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
3756 g_free(buf); | 3756 g_free(buf); |
3757 | 3757 |
3758 return 1; | 3758 return 1; |
3759 } | 3759 } |
3870 | 3870 |
3871 return 1; | 3871 return 1; |
3872 } | 3872 } |
3873 | 3873 |
3874 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { | 3874 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
3875 GaimConnection *gc = sess->aux_data; | |
3875 #if 0 | 3876 #if 0 |
3876 GaimConnection *gc = sess->aux_data; | |
3877 OscarData *od = gc->proto_data; | 3877 OscarData *od = gc->proto_data; |
3878 GaimXfer *xfer; | 3878 GaimXfer *xfer; |
3879 #endif | 3879 #endif |
3880 va_list ap; | 3880 va_list ap; |
3881 fu16_t reason; | 3881 fu16_t reason; |
3897 return 1; | 3897 return 1; |
3898 } | 3898 } |
3899 #endif | 3899 #endif |
3900 | 3900 |
3901 /* Data is assumed to be the destination sn */ | 3901 /* Data is assumed to be the destination sn */ |
3902 buf = g_strdup_printf(_("Your message to %s did not get sent:"), data); | 3902 if (!gaim_conv_present_error(data, gaim_connection_get_account(gc), |
3903 gaim_notify_error(sess->aux_data, NULL, buf, | 3903 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Your message did not get sent."))) { |
3904 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); | 3904 buf = g_strdup_printf(_("Your message to %s did not get sent:"), data); |
3905 g_free(buf); | 3905 gaim_notify_error(sess->aux_data, NULL, buf, |
3906 | 3906 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
3907 g_free(buf); | |
3908 } | |
3907 return 1; | 3909 return 1; |
3908 } | 3910 } |
3909 | 3911 |
3910 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { | 3912 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
3911 GaimConnection *gc = sess->aux_data; | 3913 GaimConnection *gc = sess->aux_data; |
3943 /* | 3945 /* |
3944 * We get this error when there was an error in the locate family. This | 3946 * We get this error when there was an error in the locate family. This |
3945 * happens when you request info of someone who is offline. | 3947 * happens when you request info of someone who is offline. |
3946 */ | 3948 */ |
3947 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { | 3949 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
3948 gchar *buf; | 3950 gchar *buf, *cbuf; |
3949 va_list ap; | 3951 va_list ap; |
3950 fu16_t reason; | 3952 fu16_t reason; |
3951 char *destn; | 3953 char *destn; |
3952 | 3954 |
3953 va_start(ap, fr); | 3955 va_start(ap, fr); |
3955 destn = va_arg(ap, char *); | 3957 destn = va_arg(ap, char *); |
3956 va_end(ap); | 3958 va_end(ap); |
3957 | 3959 |
3958 if (destn == NULL) | 3960 if (destn == NULL) |
3959 return 1; | 3961 return 1; |
3960 | 3962 |
3961 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); | 3963 cbuf = g_strdup_printf(_("User information not available: %s"), (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
3962 | 3964 if (!gaim_conv_present_error(destn, gaim_connection_get_account((GaimConnection*)sess->aux_data), cbuf)) { |
3963 gaim_notify_error(sess->aux_data, NULL, buf, | 3965 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); |
3964 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); | 3966 gaim_notify_error(sess->aux_data, NULL, buf, |
3965 g_free(buf); | 3967 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
3968 g_free(buf); | |
3969 } | |
3970 g_free(cbuf); | |
3966 | 3971 |
3967 return 1; | 3972 return 1; |
3968 } | 3973 } |
3969 | 3974 |
3970 static int gaim_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...) { | 3975 static int gaim_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
5520 OscarData *od = (OscarData *)gc->proto_data; | 5525 OscarData *od = (OscarData *)gc->proto_data; |
5521 | 5526 |
5522 if (!aim_snvalid(buddy->name)) { | 5527 if (!aim_snvalid(buddy->name)) { |
5523 gchar *buf; | 5528 gchar *buf; |
5524 buf = g_strdup_printf(_("Could not add the buddy %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), buddy->name); | 5529 buf = g_strdup_printf(_("Could not add the buddy %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), buddy->name); |
5525 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); | 5530 if (!gaim_conv_present_error(buddy->name, gaim_connection_get_account(gc), buf)) |
5531 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); | |
5526 g_free(buf); | 5532 g_free(buf); |
5527 | 5533 |
5528 /* Remove from local list */ | 5534 /* Remove from local list */ |
5529 gaim_blist_remove_buddy(buddy); | 5535 gaim_blist_remove_buddy(buddy); |
5530 | 5536 |
5968 } break; | 5974 } break; |
5969 | 5975 |
5970 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ | 5976 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ |
5971 gchar *buf; | 5977 gchar *buf; |
5972 buf = g_strdup_printf(_("Could not add the buddy %s because you have too many buddies in your buddy list. Please remove one and try again."), (retval->name ? retval->name : _("(no name)"))); | 5978 buf = g_strdup_printf(_("Could not add the buddy %s because you have too many buddies in your buddy list. Please remove one and try again."), (retval->name ? retval->name : _("(no name)"))); |
5973 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); | 5979 if (!gaim_conv_present_error(retval->name, gaim_connection_get_account(gc), buf)) |
5980 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); | |
5974 g_free(buf); | 5981 g_free(buf); |
5975 } | 5982 } |
5976 | 5983 |
5977 case 0x000e: { /* buddy requires authorization */ | 5984 case 0x000e: { /* buddy requires authorization */ |
5978 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) | 5985 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) |
5981 | 5988 |
5982 default: { /* La la la */ | 5989 default: { /* La la la */ |
5983 gchar *buf; | 5990 gchar *buf; |
5984 gaim_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); | 5991 gaim_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); |
5985 buf = g_strdup_printf(_("Could not add the buddy %s for an unknown reason. The most common reason for this is that you have the maximum number of allowed buddies in your buddy list."), (retval->name ? retval->name : _("(no name)"))); | 5992 buf = g_strdup_printf(_("Could not add the buddy %s for an unknown reason. The most common reason for this is that you have the maximum number of allowed buddies in your buddy list."), (retval->name ? retval->name : _("(no name)"))); |
5986 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); | 5993 if (!gaim_conv_present_error(retval->name, gaim_connection_get_account(gc), buf)) |
5994 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); | |
5987 g_free(buf); | 5995 g_free(buf); |
5988 } break; | 5996 } break; |
5989 } | 5997 } |
5990 | 5998 |
5991 retval = retval->next; | 5999 retval = retval->next; |
6446 gchar *charset = oscar_encoding_extract(userinfo->away_encoding); | 6454 gchar *charset = oscar_encoding_extract(userinfo->away_encoding); |
6447 gchar *away_utf8 = oscar_encoding_to_utf8(charset, userinfo->away, userinfo->away_len); | 6455 gchar *away_utf8 = oscar_encoding_to_utf8(charset, userinfo->away, userinfo->away_len); |
6448 g_free(charset); | 6456 g_free(charset); |
6449 if (away_utf8 != NULL) { | 6457 if (away_utf8 != NULL) { |
6450 gchar *tmp1, *tmp2; | 6458 gchar *tmp1, *tmp2; |
6451 tmp1 = gaim_strcasereplace(away_utf8, "<BR>", "\n"); | 6459 /* tmp1 = gaim_strcasereplace(away_utf8, "<BR>", "\n"); This replacement is handled in strip_html. |
6460 * g_free(away_utf8); | |
6461 */ | |
6462 tmp2 = gaim_markup_strip_html(away_utf8); | |
6452 g_free(away_utf8); | 6463 g_free(away_utf8); |
6453 tmp2 = gaim_markup_strip_html(tmp1); | |
6454 g_free(tmp1); | |
6455 tmp1 = gaim_escape_html(tmp2); | 6464 tmp1 = gaim_escape_html(tmp2); |
6456 g_free(tmp2); | 6465 g_free(tmp2); |
6457 tmp2 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc))); | 6466 tmp2 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc))); |
6458 g_free(tmp1); | 6467 g_free(tmp1); |
6459 g_string_append_printf(str, "\n<b>%s:</b> %s", _("Away Message"), tmp2); | 6468 g_string_append_printf(str, "\n<b>%s:</b> %s", _("Away Message"), tmp2); |
6469 | |
6460 g_free(tmp2); | 6470 g_free(tmp2); |
6461 } | 6471 } |
6462 } | 6472 } |
6463 } | 6473 } |
6464 | 6474 |