comparison src/core.c @ 4800:4af15fbcb00a

[gaim-migrate @ 5120] Paco-Paco is cool, he fixed my mess, and then fixed other messes I didn't even know we had. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 16 Mar 2003 17:49:11 +0000
parents 677d3cb193a1
children b4ca2cc6bed9
comparison
equal deleted inserted replaced
4799:7fd8a82a7c36 4800:4af15fbcb00a
98 { 98 {
99 GError *error; 99 GError *error;
100 gint sent; 100 gint sent;
101 /* we'll let the write silently fail because the read will pick it up as dead */ 101 /* we'll let the write silently fail because the read will pick it up as dead */
102 g_io_channel_write_chars(ui->channel, data, len, &sent, &error); 102 g_io_channel_write_chars(ui->channel, data, len, &sent, &error);
103 g_free(error); 103 g_error_free(error);
104 return sent; 104 return sent;
105 } 105 }
106 106
107 void UI_build_write(struct UI *ui, guchar type, guchar subtype, ...) 107 void UI_build_write(struct UI *ui, guchar type, guchar subtype, ...)
108 { 108 {
180 debug_printf("unhandled meta subtype %d\n", subtype); 180 debug_printf("unhandled meta subtype %d\n", subtype);
181 break; 181 break;
182 } 182 }
183 183
184 if(error) 184 if(error)
185 g_free(error); 185 g_error_free(error);
186 } 186 }
187 187
188 static void plugin_handler(struct UI *ui, guchar subtype, guchar *data) 188 static void plugin_handler(struct UI *ui, guchar subtype, guchar *data)
189 { 189 {
190 #ifdef GAIM_PLUGINS 190 #ifdef GAIM_PLUGINS
296 static gint gaim_recv(GIOChannel *source, guchar *buf, gint len) 296 static gint gaim_recv(GIOChannel *source, guchar *buf, gint len)
297 { 297 {
298 gint total = 0; 298 gint total = 0;
299 gint cur; 299 gint cur;
300 300
301 GError *error; 301 GError *error = NULL;
302 302
303 while (total < len) { 303 while (total < len) {
304 if (g_io_channel_read_chars(source, buf + total, len - total, &cur, &error) != G_IO_STATUS_NORMAL) { 304 if (g_io_channel_read_chars(source, buf + total, len - total, &cur, &error) != G_IO_STATUS_NORMAL) {
305 g_free(error); 305 g_error_free(error);
306 return -1; 306 return -1;
307 } 307 }
308 if (cur == 0) 308 if (cur == 0)
309 return total; 309 return total;
310 total += cur; 310 total += cur;
350 if (gaim_recv(source, &type, sizeof(type)) != sizeof(type)) { 350 if (gaim_recv(source, &type, sizeof(type)) != sizeof(type)) {
351 debug_printf("UI has abandoned us!\n"); 351 debug_printf("UI has abandoned us!\n");
352 uis = g_slist_remove(uis, ui); 352 uis = g_slist_remove(uis, ui);
353 g_io_channel_shutdown(ui->channel, TRUE, &error); 353 g_io_channel_shutdown(ui->channel, TRUE, &error);
354 if(error) 354 if(error)
355 g_free(error); 355 g_error_free(error);
356 g_source_remove(ui->inpa); 356 g_source_remove(ui->inpa);
357 g_free(ui); 357 g_free(ui);
358 return FALSE; 358 return FALSE;
359 } 359 }
360 360
361 if (gaim_recv(source, &subtype, sizeof(subtype)) != sizeof(subtype)) { 361 if (gaim_recv(source, &subtype, sizeof(subtype)) != sizeof(subtype)) {
362 debug_printf("UI has abandoned us!\n"); 362 debug_printf("UI has abandoned us!\n");
363 uis = g_slist_remove(uis, ui); 363 uis = g_slist_remove(uis, ui);
364 g_io_channel_shutdown(ui->channel, TRUE, &error); 364 g_io_channel_shutdown(ui->channel, TRUE, &error);
365 if(error) 365 if(error)
366 g_free(error); 366 g_error_free(error);
367 g_source_remove(ui->inpa); 367 g_source_remove(ui->inpa);
368 g_free(ui); 368 g_free(ui);
369 return FALSE; 369 return FALSE;
370 } 370 }
371 371
372 if (gaim_recv(source, (guchar *)&len, sizeof(len)) != sizeof(len)) { 372 if (gaim_recv(source, (guchar *)&len, sizeof(len)) != sizeof(len)) {
373 debug_printf("UI has abandoned us!\n"); 373 debug_printf("UI has abandoned us!\n");
374 uis = g_slist_remove(uis, ui); 374 uis = g_slist_remove(uis, ui);
375 g_io_channel_shutdown(ui->channel, TRUE, &error); 375 g_io_channel_shutdown(ui->channel, TRUE, &error);
376 if(error) 376 if(error)
377 g_free(error); 377 g_error_free(error);
378 g_source_remove(ui->inpa); 378 g_source_remove(ui->inpa);
379 g_free(ui); 379 g_free(ui);
380 return FALSE; 380 return FALSE;
381 } 381 }
382 382
385 if (gaim_recv(source, in, len) != len) { 385 if (gaim_recv(source, in, len) != len) {
386 debug_printf("UI has abandoned us!\n"); 386 debug_printf("UI has abandoned us!\n");
387 uis = g_slist_remove(uis, ui); 387 uis = g_slist_remove(uis, ui);
388 g_io_channel_shutdown(ui->channel, TRUE, &error); 388 g_io_channel_shutdown(ui->channel, TRUE, &error);
389 if(error) 389 if(error)
390 g_free(error); 390 g_error_free(error);
391 g_source_remove(ui->inpa); 391 g_source_remove(ui->inpa);
392 g_free(ui); 392 g_free(ui);
393 return FALSE; 393 return FALSE;
394 } 394 }
395 } else 395 } else