Mercurial > pidgin
comparison libpurple/protocols/bonjour/bonjour.c @ 17541:a62a695ccfb5
Improve Bonjour error handling when there are errors "connecting".
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 06 Jun 2007 03:22:06 +0000 |
parents | c96b085ddf5c |
children | 61005dea822b |
comparison
equal
deleted
inserted
replaced
17540:eae7a411e3a1 | 17541:a62a695ccfb5 |
---|---|
92 | 92 |
93 static void | 93 static void |
94 bonjour_login(PurpleAccount *account) | 94 bonjour_login(PurpleAccount *account) |
95 { | 95 { |
96 PurpleConnection *gc = purple_account_get_connection(account); | 96 PurpleConnection *gc = purple_account_get_connection(account); |
97 PurpleGroup *bonjour_group = NULL; | 97 PurpleGroup *bonjour_group; |
98 BonjourData *bd = NULL; | 98 BonjourData *bd; |
99 PurpleStatus *status; | 99 PurpleStatus *status; |
100 PurplePresence *presence; | 100 PurplePresence *presence; |
101 | 101 |
102 gc->flags |= PURPLE_CONNECTION_HTML; | 102 gc->flags |= PURPLE_CONNECTION_HTML; |
103 gc->proto_data = g_new0(BonjourData, 1); | 103 gc->proto_data = bd = g_new0(BonjourData, 1); |
104 bd = gc->proto_data; | |
105 | 104 |
106 /* Start waiting for jabber connections (iChat style) */ | 105 /* Start waiting for jabber connections (iChat style) */ |
107 bd->jabber_data = g_new(BonjourJabber, 1); | 106 bd->jabber_data = g_new(BonjourJabber, 1); |
108 bd->jabber_data->port = BONJOUR_DEFAULT_PORT_INT; | 107 bd->jabber_data->port = BONJOUR_DEFAULT_PORT_INT; |
109 bd->jabber_data->account = account; | 108 bd->jabber_data->account = account; |
110 | 109 |
111 if (bonjour_jabber_start(bd->jabber_data) == -1) { | 110 if (bonjour_jabber_start(bd->jabber_data) == -1) { |
112 /* Send a message about the connection error */ | 111 /* Send a message about the connection error */ |
113 purple_connection_error(gc, _("Unable to listen for incoming IM connections\n")); | 112 purple_connection_error(gc, _("Unable to listen for incoming IM connections\n")); |
114 | |
115 /* Free the data */ | |
116 g_free(bd->jabber_data); | |
117 bd->jabber_data = NULL; | |
118 return; | 113 return; |
119 } | 114 } |
120 | 115 |
121 /* Connect to the mDNS daemon looking for buddies in the LAN */ | 116 /* Connect to the mDNS daemon looking for buddies in the LAN */ |
122 bd->dns_sd_data = bonjour_dns_sd_new(); | 117 bd->dns_sd_data = bonjour_dns_sd_new(); |
153 | 148 |
154 static void | 149 static void |
155 bonjour_close(PurpleConnection *connection) | 150 bonjour_close(PurpleConnection *connection) |
156 { | 151 { |
157 PurpleGroup *bonjour_group; | 152 PurpleGroup *bonjour_group; |
158 BonjourData *bd = (BonjourData*)connection->proto_data; | 153 BonjourData *bd = connection->proto_data; |
159 | 154 |
160 /* Stop looking for buddies in the LAN */ | 155 /* Stop looking for buddies in the LAN */ |
161 if (bd->dns_sd_data != NULL) | 156 if (bd->dns_sd_data != NULL) |
162 { | 157 { |
163 bonjour_dns_sd_stop(bd->dns_sd_data); | 158 bonjour_dns_sd_stop(bd->dns_sd_data); |