comparison libpurple/protocols/bonjour/jabber.c @ 21358:ba41f2a60253

Rename: * PurpleDisconnectReason to PurpleConnectionError; * elements of that enum from PURPLE_REASON_* to PURPLE_CONNECTION_ERROR_*; * purple_connection_reason_is_fatal to purple_connection_error_is_fatal.
author Will Thompson <will.thompson@collabora.co.uk>
date Sun, 14 Oct 2007 21:08:42 +0000
parents efadfc6e2117
children 38cc722159ff
comparison
equal deleted inserted replaced
21357:5a3242b676ad 21358:ba41f2a60253
579 /* Open a listening socket for incoming conversations */ 579 /* Open a listening socket for incoming conversations */
580 if ((data->socket = socket(PF_INET, SOCK_STREAM, 0)) < 0) 580 if ((data->socket = socket(PF_INET, SOCK_STREAM, 0)) < 0)
581 { 581 {
582 purple_debug_error("bonjour", "Cannot open socket: %s\n", strerror(errno)); 582 purple_debug_error("bonjour", "Cannot open socket: %s\n", strerror(errno));
583 purple_connection_error_reason (data->account->gc, 583 purple_connection_error_reason (data->account->gc,
584 PURPLE_REASON_NETWORK_ERROR, _("Cannot open socket")); 584 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
585 _("Cannot open socket"));
585 return -1; 586 return -1;
586 } 587 }
587 588
588 /* Make the socket reusable */ 589 /* Make the socket reusable */
589 if (setsockopt(data->socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) != 0) 590 if (setsockopt(data->socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) != 0)
590 { 591 {
591 purple_debug_error("bonjour", "Error setting socket options: %s\n", strerror(errno)); 592 purple_debug_error("bonjour", "Error setting socket options: %s\n", strerror(errno));
592 purple_connection_error_reason (data->account->gc, 593 purple_connection_error_reason (data->account->gc,
593 PURPLE_REASON_NETWORK_ERROR, _("Error setting socket options")); 594 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
595 _("Error setting socket options"));
594 return -1; 596 return -1;
595 } 597 }
596 598
597 memset(&my_addr, 0, sizeof(struct sockaddr_in)); 599 memset(&my_addr, 0, sizeof(struct sockaddr_in));
598 my_addr.sin_family = PF_INET; 600 my_addr.sin_family = PF_INET;
613 /* On no! We tried 10 ports and could not bind to ANY of them */ 615 /* On no! We tried 10 ports and could not bind to ANY of them */
614 if (!bind_successful) 616 if (!bind_successful)
615 { 617 {
616 purple_debug_error("bonjour", "Cannot bind socket: %s\n", strerror(errno)); 618 purple_debug_error("bonjour", "Cannot bind socket: %s\n", strerror(errno));
617 purple_connection_error_reason (data->account->gc, 619 purple_connection_error_reason (data->account->gc,
618 PURPLE_REASON_NETWORK_ERROR, _("Could not bind socket to port")); 620 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
621 _("Could not bind socket to port"));
619 return -1; 622 return -1;
620 } 623 }
621 624
622 /* Attempt to listen on the bound socket */ 625 /* Attempt to listen on the bound socket */
623 if (listen(data->socket, 10) != 0) 626 if (listen(data->socket, 10) != 0)
624 { 627 {
625 purple_debug_error("bonjour", "Cannot listen on socket: %s\n", strerror(errno)); 628 purple_debug_error("bonjour", "Cannot listen on socket: %s\n", strerror(errno));
626 purple_connection_error_reason (data->account->gc, 629 purple_connection_error_reason (data->account->gc,
627 PURPLE_REASON_NETWORK_ERROR, _("Could not listen on socket")); 630 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
631 _("Could not listen on socket"));
628 return -1; 632 return -1;
629 } 633 }
630 634
631 #if 0 635 #if 0
632 /* TODO: Why isn't this being used? */ 636 /* TODO: Why isn't this being used? */