Mercurial > pidgin.yaz
comparison src/protocols/gg/gg.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 | fefad67de2c7 |
children | 9eb5b13fd412 |
comparison
equal
deleted
inserted
replaced
5435:a2f26666de42 | 5436:ad445074d239 |
---|---|
1 /* | 1 /* |
2 * gaim - Gadu-Gadu Protocol Plugin | 2 * gaim - Gadu-Gadu Protocol Plugin |
3 * $Id: gg.c 5573 2003-04-25 06:47:33Z chipx86 $ | 3 * $Id: gg.c 5818 2003-05-18 19:59:02Z chipx86 $ |
4 * | 4 * |
5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> | 5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> |
6 * | 6 * |
7 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License as published by | 8 * it under the terms of the GNU General Public License as published by |
586 { | 586 { |
587 struct agg_data *gd = (struct agg_data *)gc->proto_data; | 587 struct agg_data *gd = (struct agg_data *)gc->proto_data; |
588 gchar *imsg; | 588 gchar *imsg; |
589 | 589 |
590 if (invalid_uin(who)) { | 590 if (invalid_uin(who)) { |
591 do_error_dialog(_("You are trying to send a message to an invalid Gadu-Gadu UIN."), NULL, | 591 gaim_notify_error(gc, NULL, |
592 GAIM_ERROR); | 592 _("You are trying to send a message to an " |
593 "invalid Gadu-Gadu UIN."), NULL); | |
593 return -1; | 594 return -1; |
594 } | 595 } |
595 | 596 |
596 if (strlen(msg) > 0) { | 597 if (strlen(msg) > 0) { |
597 imsg = charset_convert(msg, "UTF-8", "CP1250"); | 598 imsg = charset_convert(msg, "UTF-8", "CP1250"); |
649 char *ptr; | 650 char *ptr; |
650 int i, j; | 651 int i, j; |
651 | 652 |
652 if ((ptr = strstr(webdata, "query_results:")) == NULL || (ptr = strchr(ptr, '\n')) == NULL) { | 653 if ((ptr = strstr(webdata, "query_results:")) == NULL || (ptr = strchr(ptr, '\n')) == NULL) { |
653 debug_printf("search_callback: pubdir result [%s]\n", webdata); | 654 debug_printf("search_callback: pubdir result [%s]\n", webdata); |
654 do_error_dialog(_("Couldn't get search results"), NULL, GAIM_ERROR); | 655 gaim_notify_error(gc, NULL, _("Couldn't get search results"), NULL); |
655 return; | 656 return; |
656 } | 657 } |
657 ptr++; | 658 ptr++; |
658 | 659 |
659 buf = g_strconcat("<B>", _("Gadu-Gadu Search Engine"), "</B><BR>\n", NULL); | 660 buf = g_strconcat("<B>", _("Gadu-Gadu Search Engine"), "</B><BR>\n", NULL); |
753 { | 754 { |
754 gchar *ptr; | 755 gchar *ptr; |
755 gchar **users_tbl; | 756 gchar **users_tbl; |
756 int i; | 757 int i; |
757 if (strstr(webdata, "no_data:")) { | 758 if (strstr(webdata, "no_data:")) { |
758 do_error_dialog(_("There is no Buddy List stored on the Gadu-Gadu server."), NULL, GAIM_ERROR); | 759 gaim_notify_error(gc, NULL, |
760 _("There is no Buddy List stored on the " | |
761 "Gadu-Gadu server."), NULL); | |
759 return; | 762 return; |
760 } | 763 } |
761 | 764 |
762 if ((ptr = strstr(webdata, "get_results:")) == NULL || (ptr = strchr(ptr, ':')) == NULL) { | 765 if ((ptr = strstr(webdata, "get_results:")) == NULL || (ptr = strchr(ptr, ':')) == NULL) { |
763 debug_printf("import_buddies_server_results: import buddies result [%s]\n", webdata); | 766 debug_printf("import_buddies_server_results: import buddies result [%s]\n", webdata); |
764 do_error_dialog(_("Couldn't Import Buddy List from Server"), NULL, GAIM_ERROR); | 767 gaim_notify_error(gc, NULL, |
768 _("Couldn't Import Buddy List from Server"), NULL); | |
765 return; | 769 return; |
766 } | 770 } |
767 ptr++; | 771 ptr++; |
768 | 772 |
769 users_tbl = g_strsplit(ptr, "\n", AGG_PUBDIR_MAX_ENTRIES); | 773 users_tbl = g_strsplit(ptr, "\n", AGG_PUBDIR_MAX_ENTRIES); |
819 } | 823 } |
820 | 824 |
821 static void export_buddies_server_results(struct gaim_connection *gc, gchar *webdata) | 825 static void export_buddies_server_results(struct gaim_connection *gc, gchar *webdata) |
822 { | 826 { |
823 if (strstr(webdata, "put_success:")) { | 827 if (strstr(webdata, "put_success:")) { |
824 do_error_dialog(_("Buddy List successfully transferred to Gadu-Gadu server"), NULL, GAIM_INFO); | 828 gaim_notify_info(gc, NULL, |
829 _("Buddy List successfully transferred to " | |
830 "Gadu-Gadu server"), NULL); | |
825 return; | 831 return; |
826 } | 832 } |
827 | 833 |
828 debug_printf("export_buddies_server_results: webdata [%s]\n", webdata); | 834 debug_printf("export_buddies_server_results: webdata [%s]\n", webdata); |
829 do_error_dialog(_("Couldn't transfer Buddy List to Gadu-Gadu server"), NULL, GAIM_ERROR); | 835 gaim_notify_error(gc, NULL, |
836 _("Couldn't transfer Buddy List to Gadu-Gadu server"), | |
837 NULL); | |
830 } | 838 } |
831 | 839 |
832 static void delete_buddies_server_results(struct gaim_connection *gc, gchar *webdata) | 840 static void delete_buddies_server_results(struct gaim_connection *gc, gchar *webdata) |
833 { | 841 { |
834 if (strstr(webdata, "put_success:")) { | 842 if (strstr(webdata, "put_success:")) { |
835 do_error_dialog(_("Buddy List successfully deleted from Gadu-Gadu server"), NULL, GAIM_INFO); | 843 gaim_notify_info(gc, NULL, |
844 _("Buddy List successfully deleted from " | |
845 "Gadu-Gadu server"), NULL); | |
836 return; | 846 return; |
837 } | 847 } |
838 | 848 |
839 debug_printf("delete_buddies_server_results: webdata [%s]\n", webdata); | 849 debug_printf("delete_buddies_server_results: webdata [%s]\n", webdata); |
840 do_error_dialog(_("Couldn't delete Buddy List from Gadu-Gadu server"), NULL, GAIM_ERROR); | 850 gaim_notify_error(gc, NULL, |
851 _("Couldn't delete Buddy List from Gadu-Gadu server"), | |
852 NULL); | |
841 } | 853 } |
842 | 854 |
843 static void password_change_server_results(struct gaim_connection *gc, gchar *webdata) | 855 static void password_change_server_results(struct gaim_connection *gc, gchar *webdata) |
844 { | 856 { |
845 if (strstr(webdata, "reg_success:")) { | 857 if (strstr(webdata, "reg_success:")) { |
846 do_error_dialog(_("Password changed successfully"), NULL, GAIM_INFO); | 858 gaim_notify_info(gc, NULL, |
859 _("Password changed successfully"), NULL); | |
847 return; | 860 return; |
848 } | 861 } |
849 | 862 |
850 debug_printf("password_change_server_results: webdata [%s]\n", webdata); | 863 debug_printf("password_change_server_results: webdata [%s]\n", webdata); |
851 do_error_dialog(_("Password couldn't be changed"), NULL, GAIM_ERROR); | 864 gaim_notify_error(gc, NULL, |
865 _("Password couldn't be changed"), NULL); | |
852 } | 866 } |
853 | 867 |
854 static void http_results(gpointer data, gint source, GaimInputCondition cond) | 868 static void http_results(gpointer data, gint source, GaimInputCondition cond) |
855 { | 869 { |
856 struct agg_http *hdata = data; | 870 struct agg_http *hdata = data; |
957 | 971 |
958 if (write(source, buf, strlen(buf)) < strlen(buf)) { | 972 if (write(source, buf, strlen(buf)) < strlen(buf)) { |
959 g_free(buf); | 973 g_free(buf); |
960 g_free(hdata); | 974 g_free(hdata); |
961 close(source); | 975 close(source); |
962 do_error_dialog(_("Error communicating with Gadu-Gadu server"), | 976 gaim_notify_error(gc, NULL, |
963 _("Gaim was unable to complete your request due to a problem " | 977 _("Error communicating with Gadu-Gadu server"), |
964 "communicating with the Gadu-Gadu HTTP server. Please try again " | 978 _("Gaim was unable to complete your request due " |
965 "later."), GAIM_ERROR); | 979 "to a problem communicating with the Gadu-Gadu " |
980 "HTTP server. Please try again later.")); | |
966 return; | 981 return; |
967 } | 982 } |
968 | 983 |
969 g_free(buf); | 984 g_free(buf); |
970 | 985 |
985 | 1000 |
986 g_free(u); | 1001 g_free(u); |
987 g_free(p); | 1002 g_free(p); |
988 | 1003 |
989 if (proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, hi) < 0) { | 1004 if (proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, hi) < 0) { |
990 do_error_dialog(_("Unable to import Gadu-Gadu buddy list"), | 1005 gaim_notify_error(gc, NULL, |
991 _("Gaim was unable to connect to the Gadu-Gadu buddy list " | 1006 _("Unable to import Gadu-Gadu buddy list"), |
992 "server. Please try again later."), GAIM_ERROR); | 1007 _("Gaim was unable to connect to the Gadu-Gadu " |
1008 "buddy list server. Please try again later.")); | |
993 g_free(hi->request); | 1009 g_free(hi->request); |
994 g_free(hi); | 1010 g_free(hi); |
995 return; | 1011 return; |
996 } | 1012 } |
997 } | 1013 } |
1054 } | 1070 } |
1055 } | 1071 } |
1056 } | 1072 } |
1057 | 1073 |
1058 if (proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, he) < 0) { | 1074 if (proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, he) < 0) { |
1059 do_error_dialog(_("Couldn't export buddy list"), | 1075 gaim_notify_error(gc, NULL, |
1060 _("Gaim was unable to connect to the buddy list server. " | 1076 _("Couldn't export buddy list"), |
1061 "Please try again later."), GAIM_ERROR); | 1077 _("Gaim was unable to connect to the buddy " |
1078 "list server. Please try again later.")); | |
1062 g_free(he->request); | 1079 g_free(he->request); |
1063 g_free(he); | 1080 g_free(he); |
1064 return; | 1081 return; |
1065 } | 1082 } |
1066 } | 1083 } |
1076 he->form = AGG_PUBDIR_USERLIST_EXPORT_FORM; | 1093 he->form = AGG_PUBDIR_USERLIST_EXPORT_FORM; |
1077 he->host = GG_PUBDIR_HOST; | 1094 he->host = GG_PUBDIR_HOST; |
1078 he->request = g_strdup_printf("FmNum=%s&Pass=%s&Delete=1", u, p); | 1095 he->request = g_strdup_printf("FmNum=%s&Pass=%s&Delete=1", u, p); |
1079 | 1096 |
1080 if (proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, he) < 0) { | 1097 if (proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, he) < 0) { |
1081 do_error_dialog(_("Unable to delete Gadu-Gadu buddy list"), | 1098 gaim_notify_error(gc, NULL, |
1082 _("Gaim was unable to connect to the buddy list server. " | 1099 _("Unable to delete Gadu-Gadu buddy list"), |
1083 "Please try again later."), GAIM_ERROR); | 1100 _("Gaim was unable to connect to the buddy " |
1101 "list server. Please try again later.")); | |
1084 g_free(he->request); | 1102 g_free(he->request); |
1085 g_free(he); | 1103 g_free(he); |
1086 return; | 1104 return; |
1087 } | 1105 } |
1088 } | 1106 } |
1124 g_free(enew_last); | 1142 g_free(enew_last); |
1125 g_free(enew_city); | 1143 g_free(enew_city); |
1126 } | 1144 } |
1127 | 1145 |
1128 if (proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, srch) < 0) { | 1146 if (proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, srch) < 0) { |
1129 do_error_dialog(_("Unable to access directory"), | 1147 gaim_notify_error(gc, NULL, |
1130 _("Gaim was unable to search the Directory because it " | 1148 _("Unable to access directory"), |
1131 "was unable to connect to the directory server. Please try " | 1149 _("Gaim was unable to search the Directory " |
1132 "again later."), GAIM_ERROR); | 1150 "because it was unable to connect to the " |
1151 "directory server. Please try again later.")); | |
1133 g_free(srch->request); | 1152 g_free(srch->request); |
1134 g_free(srch); | 1153 g_free(srch); |
1135 return; | 1154 return; |
1136 } | 1155 } |
1137 } | 1156 } |
1157 g_free(p); | 1176 g_free(p); |
1158 g_free(enew); | 1177 g_free(enew); |
1159 g_free(eold); | 1178 g_free(eold); |
1160 | 1179 |
1161 if (proxy_connect(gc->account, GG_REGISTER_HOST, GG_REGISTER_PORT, http_req_callback, hpass) < 0) { | 1180 if (proxy_connect(gc->account, GG_REGISTER_HOST, GG_REGISTER_PORT, http_req_callback, hpass) < 0) { |
1162 do_error_dialog(_("Unable to change Gadu-Gadu password"), | 1181 gaim_notify_error(gc, NULL, |
1163 _("Gaim was unable to change your password due to an error connecting " | 1182 _("Unable to change Gadu-Gadu password"), |
1164 "to the Gadu-Gadu server. Please try again later."), GAIM_ERROR); | 1183 _("Gaim was unable to change your password " |
1184 "due to an error connecting to the " | |
1185 "Gadu-Gadu server. Please try again " | |
1186 "later.")); | |
1165 g_free(hpass->request); | 1187 g_free(hpass->request); |
1166 g_free(hpass); | 1188 g_free(hpass); |
1167 return; | 1189 return; |
1168 } | 1190 } |
1169 } | 1191 } |
1232 g_free(enew_who); | 1254 g_free(enew_who); |
1233 } else | 1255 } else |
1234 srch->request = g_strdup_printf("Mode=3&UserId=%s", who); | 1256 srch->request = g_strdup_printf("Mode=3&UserId=%s", who); |
1235 | 1257 |
1236 if (proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, srch) < 0) { | 1258 if (proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, srch) < 0) { |
1237 do_error_dialog(_("Unable to access user profile."), | 1259 gaim_notify_error(gc, NULL, |
1238 _("Gaim was unable to access this user's profile due to an error " | 1260 _("Unable to access user profile."), |
1239 "connecting to the directory server. Please try again later."), GAIM_ERROR); | 1261 _("Gaim was unable to access this user's " |
1262 "profile due to an error connecting to the " | |
1263 "directory server. Please try again later.")); | |
1240 g_free(srch->request); | 1264 g_free(srch->request); |
1241 g_free(srch); | 1265 g_free(srch); |
1242 return; | 1266 return; |
1243 } | 1267 } |
1244 } | 1268 } |