comparison src/protocols/gg/gg.c @ 4516:2ad2f5caeb81

[gaim-migrate @ 4794] Carl-Daniel Hailfinger sent in a patch to fix Gadu-Gadu. Apparently we've been corrupting buddy lists, and segfaulting when things aren't perfect. This should fix that. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 04 Feb 2003 15:46:05 +0000
parents 238e1dd2f1a7
children 4fe661860577
comparison
equal deleted inserted replaced
4515:9b9737a00a96 4516:2ad2f5caeb81
1 /* 1 /*
2 * gaim - Gadu-Gadu Protocol Plugin 2 * gaim - Gadu-Gadu Protocol Plugin
3 * $Id: gg.c 4787 2003-02-03 13:57:25Z lschiere $ 3 * $Id: gg.c 4794 2003-02-04 15:46:05Z faceprint $
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
777 777
778 users_tbl = g_strsplit(ptr, "\n", AGG_PUBDIR_MAX_ENTRIES); 778 users_tbl = g_strsplit(ptr, "\n", AGG_PUBDIR_MAX_ENTRIES);
779 779
780 /* Parse array of Buddies List */ 780 /* Parse array of Buddies List */
781 for (i = 0; users_tbl[i] != NULL; i++) { 781 for (i = 0; users_tbl[i] != NULL; i++) {
782 if (strlen(users_tbl[i])==0) {
783 debug_printf("import_buddies_server_results: users_tbl[i] is empty\n");
784 break;
785 }
782 gchar **data_tbl; 786 gchar **data_tbl;
783 gchar *name, *show; 787 gchar *name, *show;
784 788
785 g_strdelimit(users_tbl[i], "\r\t\n\015", ' '); 789 g_strdelimit(users_tbl[i], "\r\t\n\015", ' ');
786 data_tbl = g_strsplit(users_tbl[i], ";", 8); 790 data_tbl = g_strsplit(users_tbl[i], ";", 8);
842 if (strstr(webdata, "reg_success:")) { 846 if (strstr(webdata, "reg_success:")) {
843 do_error_dialog(_("Password changed successfully"), NULL, GAIM_INFO); 847 do_error_dialog(_("Password changed successfully"), NULL, GAIM_INFO);
844 return; 848 return;
845 } 849 }
846 850
847 debug_printf("delete_buddies_server_results: webdata [%s]\n", webdata); 851 debug_printf("password_change_server_results: webdata [%s]\n", webdata);
848 do_error_dialog(_("Password couldn't be changed"), NULL, GAIM_ERROR); 852 do_error_dialog(_("Password couldn't be changed"), NULL, GAIM_ERROR);
849 } 853 }
850 854
851 static void http_results(gpointer data, gint source, GaimInputCondition cond) 855 static void http_results(gpointer data, gint source, GaimInputCondition cond)
852 { 856 {
1012 g_free(p); 1016 g_free(p);
1013 1017
1014 while (gr) { 1018 while (gr) {
1015 struct group *g = gr->data; 1019 struct group *g = gr->data;
1016 GSList *m = g->members; 1020 GSList *m = g->members;
1021 int num_added=0;
1017 while (m) { 1022 while (m) {
1018 struct buddy *b = m->data; 1023 struct buddy *b = m->data;
1019 1024
1020 if(b->account->gc == gc) { 1025 if(b->account == gc->account) {
1021 gchar *newdata; 1026 gchar *newdata;
1022 /* GG Number */ 1027 /* GG Number */
1023 gchar *name = gg_urlencode(b->name); 1028 gchar *name = gg_urlencode(b->name);
1024 /* GG Pseudo */ 1029 /* GG Pseudo */
1025 gchar *show = gg_urlencode(b->alias[0] ? b->alias : b->name); 1030 gchar *show = gg_urlencode(b->alias[0] ? b->alias : b->name);
1026 /* Group Name */ 1031 /* Group Name */
1027 gchar *gname = gg_urlencode(g->name); 1032 gchar *gname = gg_urlencode(g->name);
1028 1033
1029 ptr = he->request; 1034 ptr = he->request;
1030 newdata = g_strdup_printf("%s;%s;%s;%s;%s;%s;%s\r\n", 1035 newdata = g_strdup_printf("%s;%s;%s;%s;%s;%s;%s",
1031 show, show, show, show, "", gname, name); 1036 show, show, show, show, "", gname, name);
1032 he->request = g_strconcat(ptr, newdata, NULL); 1037
1038 if(num_added > 0)
1039 he->request = g_strconcat(ptr, "%0d%0a", newdata, NULL);
1040 else
1041 he->request = g_strconcat(ptr, newdata, NULL);
1042
1043 num_added++;
1033 1044
1034 g_free(newdata); 1045 g_free(newdata);
1035 g_free(ptr); 1046 g_free(ptr);
1036 1047
1037 g_free(gname); 1048 g_free(gname);