comparison plugins/gaim-remote/remote.c @ 6063:5239a3b4ab33

[gaim-migrate @ 6513] clean up a lot of compiler warnings. Hopefully I didn't break anything too badly. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 08 Jul 2003 06:11:49 +0000
parents 547ba881bc7e
children 38410dac4ac2
comparison
equal deleted inserted replaced
6062:2cd7c409d71d 6063:5239a3b4ab33
293 } 293 }
294 #endif 294 #endif
295 295
296 #ifndef _WIN32 296 #ifndef _WIN32
297 static void 297 static void
298 meta_handler(struct UI *ui, guchar subtype, guchar *data) 298 meta_handler(struct UI *ui, guchar subtype, gchar *data)
299 { 299 {
300 GaimRemotePacket *p; 300 GaimRemotePacket *p;
301 GError *error = NULL; 301 GError *error = NULL;
302 switch (subtype) { 302 switch (subtype) {
303 case CUI_META_LIST: 303 case CUI_META_LIST:
333 if(error) 333 if(error)
334 g_error_free(error); 334 g_error_free(error);
335 } 335 }
336 336
337 static void 337 static void
338 plugin_handler(struct UI *ui, guchar subtype, guchar *data) 338 plugin_handler(struct UI *ui, guchar subtype, gpointer data)
339 { 339 {
340 #ifdef GAIM_PLUGINS 340 #ifdef GAIM_PLUGINS
341 guint id; 341 guint id;
342 GaimPlugin *p; 342 GaimPlugin *p;
343 343
363 } 363 }
364 #endif 364 #endif
365 } 365 }
366 366
367 static void 367 static void
368 user_handler(struct UI *ui, guchar subtype, guchar *data) 368 user_handler(struct UI *ui, guchar subtype, gchar *data)
369 { 369 {
370 guint id; 370 guint id;
371 GaimAccount *account; 371 GaimAccount *account;
372 372
373 switch (subtype) { 373 switch (subtype) {
396 break; 396 break;
397 } 397 }
398 } 398 }
399 399
400 static void 400 static void
401 message_handler(struct UI *ui, guchar subtype, guchar *data) 401 message_handler(struct UI *ui, guchar subtype, gchar *data)
402 { 402 {
403 switch (subtype) { 403 switch (subtype) {
404 case CUI_MESSAGE_LIST: 404 case CUI_MESSAGE_LIST:
405 break; 405 break;
406 case CUI_MESSAGE_SEND: 406 case CUI_MESSAGE_SEND:
445 break; 445 break;
446 } 446 }
447 } 447 }
448 448
449 static gint 449 static gint
450 gaim_recv(GIOChannel *source, guchar *buf, gint len) 450 gaim_recv(GIOChannel *source, gchar *buf, gint len)
451 { 451 {
452 gint total = 0; 452 gint total = 0;
453 gint cur; 453 guint cur;
454 454
455 GError *error = NULL; 455 GError *error = NULL;
456 456
457 while (total < len) { 457 while (total < len) {
458 if (g_io_channel_read_chars(source, buf + total, len - total, &cur, &error) != G_IO_STATUS_NORMAL) { 458 if (g_io_channel_read_chars(source, buf + total, len - total, &cur, &error) != G_IO_STATUS_NORMAL) {
467 467
468 return total; 468 return total;
469 } 469 }
470 470
471 static void 471 static void
472 remote_handler(struct UI *ui, guchar subtype, guchar *data, int len) 472 remote_handler(struct UI *ui, guchar subtype, gchar *data, int len)
473 { 473 {
474 const char *resp; 474 const char *resp;
475 char *send; 475 char *send;
476 switch (subtype) { 476 switch (subtype) {
477 case CUI_REMOTE_CONNECTIONS: 477 case CUI_REMOTE_CONNECTIONS:
494 static gboolean 494 static gboolean
495 UI_readable(GIOChannel *source, GIOCondition cond, gpointer data) 495 UI_readable(GIOChannel *source, GIOCondition cond, gpointer data)
496 { 496 {
497 struct UI *ui = data; 497 struct UI *ui = data;
498 498
499 guchar type; 499 gchar type;
500 guchar subtype; 500 gchar subtype;
501 guint32 len; 501 guint32 len;
502 502
503 GError *error = NULL; 503 GError *error = NULL;
504 504
505 guchar *in; 505 gchar *in;
506 506
507 /* no byte order worries! this'll change if we go to TCP */ 507 /* no byte order worries! this'll change if we go to TCP */
508 if (gaim_recv(source, &type, sizeof(type)) != sizeof(type)) { 508 if (gaim_recv(source, &type, sizeof(type)) != sizeof(type)) {
509 gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n"); 509 gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n");
510 uis = g_slist_remove(uis, ui); 510 uis = g_slist_remove(uis, ui);
529 g_source_remove(ui->inpa); 529 g_source_remove(ui->inpa);
530 g_free(ui); 530 g_free(ui);
531 return FALSE; 531 return FALSE;
532 } 532 }
533 533
534 if (gaim_recv(source, (guchar *)&len, sizeof(len)) != sizeof(len)) { 534 if (gaim_recv(source, (gchar *)&len, sizeof(len)) != sizeof(len)) {
535 gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n"); 535 gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n");
536 uis = g_slist_remove(uis, ui); 536 uis = g_slist_remove(uis, ui);
537 g_io_channel_shutdown(ui->channel, TRUE, &error); 537 g_io_channel_shutdown(ui->channel, TRUE, &error);
538 if(error) { 538 if(error) {
539 g_error_free(error); 539 g_error_free(error);
543 g_free(ui); 543 g_free(ui);
544 return FALSE; 544 return FALSE;
545 } 545 }
546 546
547 if (len) { 547 if (len) {
548 in = g_new0(guchar, len); 548 in = g_new0(gchar, len);
549 if (gaim_recv(source, in, len) != len) { 549 if (gaim_recv(source, in, len) != len) {
550 gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n"); 550 gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n");
551 uis = g_slist_remove(uis, ui); 551 uis = g_slist_remove(uis, ui);
552 g_io_channel_shutdown(ui->channel, TRUE, &error); 552 g_io_channel_shutdown(ui->channel, TRUE, &error);
553 if(error) { 553 if(error) {
603 603
604 static gboolean 604 static gboolean
605 socket_readable(GIOChannel *source, GIOCondition cond, gpointer data) 605 socket_readable(GIOChannel *source, GIOCondition cond, gpointer data)
606 { 606 {
607 struct sockaddr_un saddr; 607 struct sockaddr_un saddr;
608 gint len = sizeof(saddr); 608 guint len = sizeof(saddr);
609 gint fd; 609 gint fd;
610 610
611 struct UI *ui; 611 struct UI *ui;
612 612
613 if ((fd = accept(UI_fd, (struct sockaddr *)&saddr, &len)) == -1) 613 if ((fd = accept(UI_fd, (struct sockaddr *)&saddr, &len)) == -1)
693 { 693 {
694 /* don't save prefs after plugins are gone... */ 694 /* don't save prefs after plugins are gone... */
695 #ifndef _WIN32 695 #ifndef _WIN32
696 char buf[1024]; 696 char buf[1024];
697 close(UI_fd); 697 close(UI_fd);
698 snprintf(buf, 1024, "%s" G_DIR_SEPARATOR_S "gaim_%s.%d", 698 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "gaim_%s.%d",
699 g_get_tmp_dir(), g_get_user_name(), gaim_session); 699 g_get_tmp_dir(), g_get_user_name(), gaim_session);
700 700
701 unlink(buf); 701 unlink(buf);
702 702
703 gaim_debug(GAIM_DEBUG_MISC, "core", "Removed core\n"); 703 gaim_debug(GAIM_DEBUG_MISC, "core", "Removed core\n");
751 static void 751 static void
752 __init_plugin(GaimPlugin *plugin) 752 __init_plugin(GaimPlugin *plugin)
753 { 753 {
754 } 754 }
755 755
756 GAIM_INIT_PLUGIN(remote, __init_plugin, info); 756 GAIM_INIT_PLUGIN(remote, __init_plugin, info)