comparison plugins/chatlist.c @ 3930:22e3bbbd9a32

[gaim-migrate @ 4102] So at some point gaim_user_dir() changed so that it returned a static buffer instead of some sort of fancy "dynamic" whizbang. So this just keeps the thing from segfaulting when you try to load it. Oh, and, uh, I don't actually use this. Honest I don't. I'm not really sure what it's supposed to do. It would be nice if it were gtk2ized, though. There is a big teddy bear on my desk. It's soft and fluffy. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 08 Nov 2002 07:51:28 +0000
parents 43e396e94095
children a55c2a0ddcd4
comparison
equal deleted inserted replaced
3929:f0efc0293bbf 3930:22e3bbbd9a32
97 char *x = gaim_user_dir(); 97 char *x = gaim_user_dir();
98 GList *crs = chat_rooms; 98 GList *crs = chat_rooms;
99 99
100 g_snprintf(path, sizeof(path), "%s/%s", x, "chats"); 100 g_snprintf(path, sizeof(path), "%s/%s", x, "chats");
101 f = fopen(path, "w"); 101 f = fopen(path, "w");
102 if (!f) { 102 if (!f)
103 g_free(x); 103 return;
104 return;
105 }
106 while (crs) { 104 while (crs) {
107 struct chat_room *cr = crs->data; 105 struct chat_room *cr = crs->data;
108 crs = crs->next; 106 crs = crs->next;
109 fprintf(f, "%s\n%d\n", cr->name, cr->exchange); 107 fprintf(f, "%s\n%d\n", cr->name, cr->exchange);
110 } 108 }
111 g_free(x);
112 fclose(f); 109 fclose(f);
113 } 110 }
114 111
115 static void restore_chat_prefs() 112 static void restore_chat_prefs()
116 { 113 {
119 char *x = gaim_user_dir(); 116 char *x = gaim_user_dir();
120 char buf[1024]; 117 char buf[1024];
121 118
122 g_snprintf(path, sizeof(path), "%s/%s", x, "chats"); 119 g_snprintf(path, sizeof(path), "%s/%s", x, "chats");
123 f = fopen(path, "r"); 120 f = fopen(path, "r");
124 if (!f) { 121 if (!f)
125 g_free(x); 122 return;
126 return;
127 }
128 while (fgets(buf, 1024, f)) { 123 while (fgets(buf, 1024, f)) {
129 struct chat_room *cr = g_new0(struct chat_room, 1); 124 struct chat_room *cr = g_new0(struct chat_room, 1);
130 g_snprintf(cr->name, sizeof(cr->name), "%s", g_strchomp(buf)); 125 g_snprintf(cr->name, sizeof(cr->name), "%s", g_strchomp(buf));
131 if (!fgets(buf, 1024, f)) { 126 if (!fgets(buf, 1024, f)) {
132 g_free(cr); 127 g_free(cr);