comparison src/protocols/oscar/oscar.c @ 5436:ad445074d239

[gaim-migrate @ 5818] Another big commit. Ugh. I need a very smart regexp. Core/UI split do_error_dialog(), and soon the mail dialogs! Yay! This should work without problems at all, but standard disclaimer.. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 18 May 2003 19:59:02 +0000
parents a2f26666de42
children 3e8487580024
comparison
equal deleted inserted replaced
5435:a2f26666de42 5436:ad445074d239
552 gaim_input_remove(c->inpa); 552 gaim_input_remove(c->inpa);
553 c->inpa = 0; 553 c->inpa = 0;
554 c->fd = -1; 554 c->fd = -1;
555 aim_conn_kill(od->sess, &conn); 555 aim_conn_kill(od->sess, &conn);
556 buf = g_strdup_printf(_("You have been disconnected from chat room %s."), c->name); 556 buf = g_strdup_printf(_("You have been disconnected from chat room %s."), c->name);
557 do_error_dialog(buf, NULL, GAIM_ERROR); 557 gaim_notify_error(gc, NULL, buf, NULL);
558 g_free(buf); 558 g_free(buf);
559 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { 559 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
560 if (od->cnpa > 0) 560 if (od->cnpa > 0)
561 gaim_input_remove(od->cnpa); 561 gaim_input_remove(od->cnpa);
562 od->cnpa = 0; 562 od->cnpa = 0;
566 struct create_room *cr = od->create_rooms->data; 566 struct create_room *cr = od->create_rooms->data;
567 g_free(cr->name); 567 g_free(cr->name);
568 od->create_rooms = 568 od->create_rooms =
569 g_slist_remove(od->create_rooms, cr); 569 g_slist_remove(od->create_rooms, cr);
570 g_free(cr); 570 g_free(cr);
571 do_error_dialog(_("Chat is currently unavailable"), NULL, GAIM_ERROR); 571 gaim_notify_error(gc, NULL,
572 _("Chat is currently unavailable"),
573 NULL);
572 } 574 }
573 aim_conn_kill(od->sess, &conn); 575 aim_conn_kill(od->sess, &conn);
574 } else if (conn->type == AIM_CONN_TYPE_AUTH) { 576 } else if (conn->type == AIM_CONN_TYPE_AUTH) {
575 if (od->paspa > 0) 577 if (od->paspa > 0)
576 gaim_input_remove(od->paspa); 578 gaim_input_remove(od->paspa);
868 if (oft_info->conn) { 870 if (oft_info->conn) {
869 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); 871 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn);
870 aim_im_sendch2_sendfile_ask(od->sess, oft_info); 872 aim_im_sendch2_sendfile_ask(od->sess, oft_info);
871 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0); 873 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0);
872 } else { 874 } else {
873 do_error_dialog(_("File Transfer Aborted"), _("Unable to establish listener socket."), GAIM_ERROR); 875 gaim_notify_error(gc, NULL, _("File Transfer Aborted"),
876 _("Unable to establish listener socket."));
874 /* XXX - The below line causes a crash because the transfer is canceled before the "Ok" callback on the file selection thing exists, I think */ 877 /* XXX - The below line causes a crash because the transfer is canceled before the "Ok" callback on the file selection thing exists, I think */
875 /* gaim_xfer_cancel_remote(xfer); */ 878 /* gaim_xfer_cancel_remote(xfer); */
876 } 879 }
877 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { 880 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) {
878 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); 881 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL);
879 if (oft_info->conn) { 882 if (oft_info->conn) {
880 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; 883 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE;
881 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0); 884 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0);
882 oft_info->conn->fd = xfer->fd = proxy_connect(gc->account, xfer->remote_ip, xfer->remote_port, oscar_sendfile_connected, xfer); 885 oft_info->conn->fd = xfer->fd = proxy_connect(gc->account, xfer->remote_ip, xfer->remote_port, oscar_sendfile_connected, xfer);
883 if (xfer->fd == -1) { 886 if (xfer->fd == -1) {
884 do_error_dialog(_("File Transfer Aborted"), _("Unable to establish file descriptor."), GAIM_ERROR); 887 gaim_notify_error(gc, NULL, _("File Transfer Aborted"),
888 _("Unable to establish file descriptor."));
885 /* gaim_xfer_cancel_remote(xfer); */ 889 /* gaim_xfer_cancel_remote(xfer); */
886 } 890 }
887 } else { 891 } else {
888 do_error_dialog(_("File Transfer Aborted"), _("Unable to create new connection."), GAIM_ERROR); 892 gaim_notify_error(gc, NULL, _("File Transfer Aborted"),
893 _("Unable to create new connection."));
889 /* gaim_xfer_cancel_remote(xfer); */ 894 /* gaim_xfer_cancel_remote(xfer); */
890 /* Try a different port? Ask them to connect to us? */ 895 /* Try a different port? Ask them to connect to us? */
891 } 896 }
892 897
893 } 898 }
1218 } 1223 }
1219 if (in != '\n') { 1224 if (in != '\n') {
1220 char buf[256]; 1225 char buf[256];
1221 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " 1226 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until "
1222 "this is fixed. Check %s for updates."), WEBSITE); 1227 "this is fixed. Check %s for updates."), WEBSITE);
1223 do_error_dialog(_("Gaim was Unable to get a valid AIM login hash."), 1228 gaim_notify_warning(pos->gc, NULL,
1224 buf, GAIM_WARNING); 1229 _("Gaim was Unable to get a valid AIM login hash."),
1230 buf);
1225 gaim_input_remove(pos->inpa); 1231 gaim_input_remove(pos->inpa);
1226 close(pos->fd); 1232 close(pos->fd);
1227 g_free(pos); 1233 g_free(pos);
1228 return; 1234 return;
1229 } 1235 }
1247 pos->fd = source; 1253 pos->fd = source;
1248 1254
1249 if (source < 0) { 1255 if (source < 0) {
1250 buf = g_strdup_printf(_("You may be disconnected shortly. You may want to use TOC until " 1256 buf = g_strdup_printf(_("You may be disconnected shortly. You may want to use TOC until "
1251 "this is fixed. Check %s for updates."), WEBSITE); 1257 "this is fixed. Check %s for updates."), WEBSITE);
1252 do_error_dialog(_("Gaim was Unable to get a valid AIM login hash."), buf, GAIM_WARNING); 1258 gaim_notify_warning(pos->gc, NULL,
1259 _("Gaim was Unable to get a valid AIM login hash."),
1260 buf);
1253 g_free(buf); 1261 g_free(buf);
1254 if (pos->modname) 1262 if (pos->modname)
1255 g_free(pos->modname); 1263 g_free(pos->modname);
1256 g_free(pos); 1264 g_free(pos);
1257 return; 1265 return;
1333 if (pos->modname) 1341 if (pos->modname)
1334 g_free(pos->modname); 1342 g_free(pos->modname);
1335 g_free(pos); 1343 g_free(pos);
1336 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " 1344 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until "
1337 "this is fixed. Check %s for updates."), WEBSITE); 1345 "this is fixed. Check %s for updates."), WEBSITE);
1338 do_error_dialog(_("Gaim was Unable to get a valid login hash."), 1346 gaim_notify_warning(pos->gc, NULL,
1339 buf, GAIM_WARNING); 1347 _("Gaim was Unable to get a valid login hash."),
1348 buf);
1340 } 1349 }
1341 1350
1342 return 1; 1351 return 1;
1343 } 1352 }
1344 1353
2570 } break; 2579 } break;
2571 2580
2572 case 0x07: { /* Someone has denied you authorization */ 2581 case 0x07: { /* Someone has denied you authorization */
2573 if (i >= 1) { 2582 if (i >= 1) {
2574 gchar *dialog_msg = g_strdup_printf(_("The user %lu has denied your request to add them to your contact list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given.")); 2583 gchar *dialog_msg = g_strdup_printf(_("The user %lu has denied your request to add them to your contact list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given."));
2575 do_error_dialog(_("ICQ authorization denied."), dialog_msg, GAIM_INFO); 2584 gaim_notify_info(gc, NULL, _("ICQ authorization denied."),
2585 dialog_msg);
2576 g_free(dialog_msg); 2586 g_free(dialog_msg);
2577 } 2587 }
2578 } break; 2588 } break;
2579 2589
2580 case 0x08: { /* Someone has granted you authorization */ 2590 case 0x08: { /* Someone has granted you authorization */
2581 gchar *dialog_msg = g_strdup_printf(_("The user %lu has granted your request to add them to your contact list."), args->uin); 2591 gchar *dialog_msg = g_strdup_printf(_("The user %lu has granted your request to add them to your contact list."), args->uin);
2582 do_error_dialog("ICQ authorization accepted.", dialog_msg, GAIM_INFO); 2592 gaim_notify_info(gc, NULL, "ICQ authorization accepted.",
2593 dialog_msg);
2583 g_free(dialog_msg); 2594 g_free(dialog_msg);
2584 } break; 2595 } break;
2585 2596
2586 case 0x09: { /* Message from the Godly ICQ server itself, I think */ 2597 case 0x09: { /* Message from the Godly ICQ server itself, I think */
2587 if (i >= 5) { 2598 if (i >= 5) {
2588 gchar *dialog_msg = g_strdup_printf(_("You have received a special message\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); 2599 gchar *dialog_msg = g_strdup_printf(_("You have received a special message\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]);
2589 do_error_dialog("ICQ Server Message", dialog_msg, GAIM_INFO); 2600 gaim_notify_info(gc, NULL, "ICQ Server Message", dialog_msg);
2590 g_free(dialog_msg); 2601 g_free(dialog_msg);
2591 } 2602 }
2592 } break; 2603 } break;
2593 2604
2594 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ 2605 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */
2595 if (i >= 6) { 2606 if (i >= 6) {
2596 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ page\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); 2607 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ page\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]);
2597 do_error_dialog("ICQ Page", dialog_msg, GAIM_INFO); 2608 gaim_notify_info(gc, NULL, "ICQ Page", dialog_msg);
2598 g_free(dialog_msg); 2609 g_free(dialog_msg);
2599 } 2610 }
2600 } break; 2611 } break;
2601 2612
2602 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ 2613 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */
2603 if (i >= 6) { 2614 if (i >= 6) {
2604 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ email from %s [%s]\n\nMessage is:\n%s"), msg2[0], msg2[3], msg2[5]); 2615 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ email from %s [%s]\n\nMessage is:\n%s"), msg2[0], msg2[3], msg2[5]);
2605 do_error_dialog("ICQ Email", dialog_msg, GAIM_INFO); 2616 gaim_notify_info(gc, NULL, "ICQ Email", dialog_msg);
2606 g_free(dialog_msg); 2617 g_free(dialog_msg);
2607 } 2618 }
2608 } break; 2619 } break;
2609 2620
2610 case 0x12: { 2621 case 0x12: {
2758 nummissed), 2769 nummissed),
2759 nummissed, 2770 nummissed,
2760 userinfo->sn); 2771 userinfo->sn);
2761 break; 2772 break;
2762 } 2773 }
2763 do_error_dialog(buf, NULL, GAIM_ERROR); 2774 gaim_notify_error(sess->aux_data, NULL, buf, NULL);
2764 g_free(buf); 2775 g_free(buf);
2765 2776
2766 return 1; 2777 return 1;
2767 } 2778 }
2768 2779
2900 "snac threw error (reason 0x%04hx: %s)\n", reason, 2911 "snac threw error (reason 0x%04hx: %s)\n", reason,
2901 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); 2912 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown");
2902 2913
2903 m = g_strdup_printf(_("SNAC threw error: %s\n"), 2914 m = g_strdup_printf(_("SNAC threw error: %s\n"),
2904 reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error")); 2915 reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error"));
2905 do_error_dialog(m, NULL, GAIM_ERROR); 2916 gaim_notify_error(sess->aux_data, NULL, m, NULL);
2906 g_free(m); 2917 g_free(m);
2907 2918
2908 return 1; 2919 return 1;
2909 } 2920 }
2910 2921
2935 } 2946 }
2936 #endif 2947 #endif
2937 2948
2938 /* Data is assumed to be the destination sn */ 2949 /* Data is assumed to be the destination sn */
2939 buf = g_strdup_printf(_("Your message to %s did not get sent:"), data); 2950 buf = g_strdup_printf(_("Your message to %s did not get sent:"), data);
2940 do_error_dialog(buf, (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given."), GAIM_ERROR); 2951 gaim_notify_error(sess->aux_data, NULL, buf,
2952 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given."));
2941 g_free(buf); 2953 g_free(buf);
2942 2954
2943 return 1; 2955 return 1;
2944 } 2956 }
2945 2957
2986 reason = (fu16_t) va_arg(ap, unsigned int); 2998 reason = (fu16_t) va_arg(ap, unsigned int);
2987 destn = va_arg(ap, char *); 2999 destn = va_arg(ap, char *);
2988 va_end(ap); 3000 va_end(ap);
2989 3001
2990 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); 3002 buf = g_strdup_printf(_("User information for %s unavailable:"), destn);
2991 do_error_dialog(buf, (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given."), GAIM_ERROR); 3003 gaim_notify_error(sess->aux_data, NULL, buf,
3004 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given."));
2992 g_free(buf); 3005 g_free(buf);
2993 3006
2994 return 1; 3007 return 1;
2995 } 3008 }
2996 3009
3201 va_end(ap); 3214 va_end(ap);
3202 3215
3203 gaim_debug(GAIM_DEBUG_MISC, "oscar", 3216 gaim_debug(GAIM_DEBUG_MISC, "oscar",
3204 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); 3217 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id);
3205 if (id < 4) 3218 if (id < 4)
3206 do_error_dialog(_("Your AIM connection may be lost."), NULL, GAIM_WARNING); 3219 gaim_notify_warning(sess->aux_data, NULL,
3220 _("Your AIM connection may be lost."), NULL);
3207 3221
3208 return 1; 3222 return 1;
3209 } 3223 }
3210 3224
3211 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { 3225 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) {
3562 if (currentavg >= clear) 3576 if (currentavg >= clear)
3563 aim_conn_setlatency(fr->conn, 0); 3577 aim_conn_setlatency(fr->conn, 0);
3564 } else if (code == AIM_RATE_CODE_WARNING) { 3578 } else if (code == AIM_RATE_CODE_WARNING) {
3565 aim_conn_setlatency(fr->conn, windowsize/4); 3579 aim_conn_setlatency(fr->conn, windowsize/4);
3566 } else if (code == AIM_RATE_CODE_LIMIT) { 3580 } else if (code == AIM_RATE_CODE_LIMIT) {
3567 do_error_dialog(_("Rate limiting error."), 3581 gaim_notify_error(sess->aux_data, NULL, _("Rate limiting error."),
3568 _("The last message was not sent because you are over the rate limit. " 3582 _("The last message was not sent because you "
3569 "Please wait 10 seconds and try again."), GAIM_ERROR); 3583 "are over the rate limit. Please wait 10 "
3584 "seconds and try again."));
3570 aim_conn_setlatency(fr->conn, windowsize/2); 3585 aim_conn_setlatency(fr->conn, windowsize/2);
3571 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { 3586 } else if (code == AIM_RATE_CODE_CLEARLIMIT) {
3572 aim_conn_setlatency(fr->conn, 0); 3587 aim_conn_setlatency(fr->conn, 0);
3573 } 3588 }
3574 3589
4030 va_start(ap, fr); 4045 va_start(ap, fr);
4031 address = va_arg(ap, char *); 4046 address = va_arg(ap, char *);
4032 va_end(ap); 4047 va_end(ap);
4033 4048
4034 buf = g_strdup_printf(_("No results found for email address %s"), address); 4049 buf = g_strdup_printf(_("No results found for email address %s"), address);
4035 do_error_dialog(buf, NULL, GAIM_ERROR); 4050 gaim_notify_error(sess->aux_data, NULL, buf, NULL);
4036 g_free(buf); 4051 g_free(buf);
4037 4052
4038 return 1; 4053 return 1;
4039 } 4054 }
4040 4055
4052 "account confirmation returned status 0x%04x (%s)\n", status, 4067 "account confirmation returned status 0x%04x (%s)\n", status,
4053 status ? "unknown" : "email sent"); 4068 status ? "unknown" : "email sent");
4054 if (!status) { 4069 if (!status) {
4055 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), 4070 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."),
4056 gc->username); 4071 gc->username);
4057 do_error_dialog(_("Account Confirmation Requested"), msg, GAIM_INFO); 4072 gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg);
4058 } 4073 }
4059 4074
4060 return 1; 4075 return 1;
4061 } 4076 }
4062 4077
4104 } break; 4119 } break;
4105 default: { 4120 default: {
4106 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); 4121 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err);
4107 } break; 4122 } break;
4108 } 4123 }
4109 do_error_dialog(dialog_top, dialog_msg, GAIM_ERROR); 4124 gaim_notify_error(gc, NULL, dialog_top, dialog_msg);
4110 g_free(dialog_top); 4125 g_free(dialog_top);
4111 g_free(dialog_msg); 4126 g_free(dialog_msg);
4112 return 1; 4127 return 1;
4113 } 4128 }
4114 4129
4115 if (sn) { 4130 if (sn) {
4116 char *dialog_msg = g_strdup_printf(_("Your screen name is currently formatted as follows:\n%s"), sn); 4131 char *dialog_msg = g_strdup_printf(_("Your screen name is currently formatted as follows:\n%s"), sn);
4117 do_error_dialog(_("Account Info"), dialog_msg, GAIM_INFO); 4132 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg);
4118 g_free(dialog_msg); 4133 g_free(dialog_msg);
4119 } 4134 }
4120 4135
4121 if (email) { 4136 if (email) {
4122 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), gc->username, email); 4137 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), gc->username, email);
4123 do_error_dialog(_("Account Info"), dialog_msg, GAIM_INFO); 4138 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg);
4124 g_free(dialog_msg); 4139 g_free(dialog_msg);
4125 } 4140 }
4126 4141
4127 return 1; 4142 return 1;
4128 } 4143 }
4339 fu32_t flags = 0; 4354 fu32_t flags = 0;
4340 char *msg = NULL; 4355 char *msg = NULL;
4341 int msglen = 0; 4356 int msglen = 0;
4342 4357
4343 if (od->rights.maxsiglen == 0) 4358 if (od->rights.maxsiglen == 0)
4344 do_error_dialog(_("Unable to set AIM profile."), 4359 gaim_notify_warning(gc, NULL, _("Unable to set AIM profile."),
4345 _("You have probably requested to set your profile before the login procedure completed. " 4360 _("You have probably requested to set your "
4346 "Your profile remains unset; try setting it again when you are fully connected."), GAIM_WARNING); 4361 "profile before the login procedure completed. "
4362 "Your profile remains unset; try setting it "
4363 "again when you are fully connected."));
4347 4364
4348 if (od->icq) 4365 if (od->icq)
4349 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq); 4366 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq);
4350 else { 4367 else {
4351 if (!text) { 4368 if (!text) {
4369 4386
4370 if (msglen > od->rights.maxsiglen) { 4387 if (msglen > od->rights.maxsiglen) {
4371 gchar *errstr; 4388 gchar *errstr;
4372 errstr = g_strdup_printf(_("The maximum profile length of %d bytes has been exceeded. " 4389 errstr = g_strdup_printf(_("The maximum profile length of %d bytes has been exceeded. "
4373 "Gaim has truncated it for you."), od->rights.maxsiglen); 4390 "Gaim has truncated it for you."), od->rights.maxsiglen);
4374 do_error_dialog(_("Profile too long."), errstr, GAIM_WARNING); 4391 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr);
4375 g_free(errstr); 4392 g_free(errstr);
4376 } 4393 }
4377 4394
4378 } 4395 }
4379 4396
4385 fu32_t flags = 0; 4402 fu32_t flags = 0;
4386 char *msg = NULL; 4403 char *msg = NULL;
4387 int msglen = 0; 4404 int msglen = 0;
4388 4405
4389 if (od->rights.maxawaymsglen == 0) 4406 if (od->rights.maxawaymsglen == 0)
4390 do_error_dialog(_("Unable to set AIM away message."), 4407 gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."),
4391 _("You have probably requested to set your away message before the login procedure completed. " 4408 _("You have probably requested to set your "
4392 "You remain in a \"present\" state; try setting it again when you are fully connected."), GAIM_WARNING); 4409 "away message before the login procedure "
4410 "completed. You remain in a \"present\" "
4411 "state; try setting it again when you are "
4412 "fully connected."));
4393 4413
4394 if (gc->away) { 4414 if (gc->away) {
4395 g_free(gc->away); 4415 g_free(gc->away);
4396 gc->away = NULL; 4416 gc->away = NULL;
4397 } 4417 }
4424 if (msglen > od->rights.maxawaymsglen) { 4444 if (msglen > od->rights.maxawaymsglen) {
4425 gchar *errstr; 4445 gchar *errstr;
4426 4446
4427 errstr = g_strdup_printf(_("The maximum away message length of %d bytes has been exceeded. " 4447 errstr = g_strdup_printf(_("The maximum away message length of %d bytes has been exceeded. "
4428 "Gaim has truncated it and set you away."), od->rights.maxawaymsglen); 4448 "Gaim has truncated it and set you away."), od->rights.maxawaymsglen);
4429 do_error_dialog(_("Away message too long."), errstr, GAIM_WARNING); 4449 gaim_notify_warning(gc, NULL, _("Away message too long."), errstr);
4430 g_free(errstr); 4450 g_free(errstr);
4431 } 4451 }
4432 4452
4433 return; 4453 return;
4434 } 4454 }
4637 va_end(ap); 4657 va_end(ap);
4638 4658
4639 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason); 4659 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason);
4640 4660
4641 if (reason == 0x0005) { 4661 if (reason == 0x0005) {
4642 do_error_dialog(_("Unable To Retrive Buddy List"), _("Gaim was temporarily unable to retrive your buddy list from the AIM servers. Your buddy list is not lost, and will probably become available in a few hours."), GAIM_ERROR); 4662 gaim_notify_error(gc, NULL, _("Unable To Retrive Buddy List"),
4663 _("Gaim was temporarily unable to retrive your buddy list from the AIM servers. Your buddy list is not lost, and will probably become available in a few hours."));
4643 } 4664 }
4644 4665
4645 /* Activate SSI */ 4666 /* Activate SSI */
4646 /* Sending the enable causes other people to be able to see you, and you to see them */ 4667 /* Sending the enable causes other people to be able to see you, and you to see them */
4647 /* Make sure your privacy setting/invisibility is set how you want it before this! */ 4668 /* Make sure your privacy setting/invisibility is set how you want it before this! */
4898 } break; 4919 } break;
4899 4920
4900 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ 4921 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */
4901 gchar *buf; 4922 gchar *buf;
4902 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)"))); 4923 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)")));
4903 do_error_dialog(_("Unable To Add"), buf, GAIM_ERROR); 4924 gaim_notify_error(gc, NULL, _("Unable To Add"), buf);
4904 g_free(buf); 4925 g_free(buf);
4905 } 4926 }
4906 4927
4907 case 0x000e: { /* contact requires authorization */ 4928 case 0x000e: { /* contact requires authorization */
4908 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) 4929 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name))
4911 4932
4912 default: { /* La la la */ 4933 default: { /* La la la */
4913 gchar *buf; 4934 gchar *buf;
4914 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); 4935 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack);
4915 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)"))); 4936 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)")));
4916 do_error_dialog(_("Unable To Add"), buf, GAIM_ERROR); 4937 gaim_notify_error(gc, NULL, _("Unable To Add"), buf);
4917 g_free(buf); 4938 g_free(buf);
4918 /* XXX - Should remove buddy from local list */ 4939 /* XXX - Should remove buddy from local list */
4919 } break; 4940 } break;
4920 } 4941 }
4921 4942
5019 nombre = g_strdup(sn); 5040 nombre = g_strdup(sn);
5020 5041
5021 if (reply) { 5042 if (reply) {
5022 /* Granted */ 5043 /* Granted */
5023 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your contact list."), nombre); 5044 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your contact list."), nombre);
5024 do_error_dialog(_("Authorization Granted"), dialog_msg, GAIM_INFO); 5045 gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg);
5025 } else { 5046 } else {
5026 /* Denied */ 5047 /* Denied */
5027 dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your contact list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given.")); 5048 dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your contact list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given."));
5028 do_error_dialog(_("Authorization Denied"), dialog_msg, GAIM_INFO); 5049 gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg);
5029 } 5050 }
5030 g_free(dialog_msg); 5051 g_free(dialog_msg);
5031 g_free(nombre); 5052 g_free(nombre);
5032 5053
5033 return 1; 5054 return 1;
5497 gaim_input_remove(dim->watcher); 5518 gaim_input_remove(dim->watcher);
5498 g_free(dim); 5519 g_free(dim);
5499 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5520 gaim_debug(GAIM_DEBUG_INFO, "oscar",
5500 "Gave up on old direct IM, trying again\n"); 5521 "Gave up on old direct IM, trying again\n");
5501 } else { 5522 } else {
5502 do_error_dialog("DirectIM already open.", NULL, GAIM_ERROR); 5523 gaim_notify_error(gc, NULL, "DirectIM already open.", NULL);
5503 g_free(data->who); 5524 g_free(data->who);
5504 g_free(data); 5525 g_free(data);
5505 return; 5526 return;
5506 } 5527 }
5507 } 5528 }
5515 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, 5536 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
5516 oscar_callback, dim->conn); 5537 oscar_callback, dim->conn);
5517 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, 5538 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED,
5518 gaim_odc_initiate, 0); 5539 gaim_odc_initiate, 0);
5519 } else { 5540 } else {
5520 do_error_dialog(_("Unable to open Direct IM"), NULL, GAIM_ERROR); 5541 gaim_notify_error(gc, NULL, _("Unable to open Direct IM"), NULL);
5521 g_free(dim); 5542 g_free(dim);
5522 } 5543 }
5523 5544
5524 g_free(data->who); 5545 g_free(data->who);
5525 g_free(data); 5546 g_free(data);
5723 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); 5744 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
5724 } else { 5745 } else {
5725 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); 5746 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick);
5726 } 5747 }
5727 } else { 5748 } else {
5728 do_error_dialog(_("The new formatting is invalid."), 5749 gaim_notify_error(gc, NULL, _("The new formatting is invalid."),
5729 _("Screenname formatting can change only capitalization and whitespace."), GAIM_ERROR); 5750 _("Screenname formatting can change only capitalization and whitespace."));
5730 } 5751 }
5731 } 5752 }
5732 5753
5733 static void oscar_show_format_screenname(struct gaim_connection *gc) 5754 static void oscar_show_format_screenname(struct gaim_connection *gc)
5734 { 5755 {