Mercurial > pidgin.yaz
comparison src/protocols/bonjour/bonjour.c @ 11829:4669e7461968
[gaim-migrate @ 14120]
Regular comment changes. I'm sorry to force a big recompilation. It had to be done at some point, though, and I've tried to do this all in one day.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Wed, 26 Oct 2005 00:34:26 +0000 |
parents | 11e95968c9ff |
children | 825d3ca6ffcd |
comparison
equal
deleted
inserted
replaced
11828:5c50be815a4e | 11829:4669e7461968 |
---|---|
76 | 76 |
77 gc->flags |= GAIM_CONNECTION_HTML; | 77 gc->flags |= GAIM_CONNECTION_HTML; |
78 gc->proto_data = g_new(BonjourData, 1); | 78 gc->proto_data = g_new(BonjourData, 1); |
79 bd = gc->proto_data; | 79 bd = gc->proto_data; |
80 | 80 |
81 // Start waiting for jabber connections (iChat style) | 81 /* Start waiting for jabber connections (iChat style) */ |
82 bd->jabber_data = g_new(BonjourJabber, 1); | 82 bd->jabber_data = g_new(BonjourJabber, 1); |
83 bd->jabber_data->name = gc->account->username; | 83 bd->jabber_data->name = gc->account->username; |
84 bd->jabber_data->port = gaim_account_get_int(account, "port", BONJOUR_DEFAULT_PORT_INT); | 84 bd->jabber_data->port = gaim_account_get_int(account, "port", BONJOUR_DEFAULT_PORT_INT); |
85 bd->jabber_data->account = account; | 85 bd->jabber_data->account = account; |
86 | 86 |
87 if (bonjour_jabber_start(bd->jabber_data) == -1) { | 87 if (bonjour_jabber_start(bd->jabber_data) == -1) { |
88 // Send a message about the connection error | 88 /* Send a message about the connection error */ |
89 gaim_debug_error("bonjour", "Unable to listen to ichat connections"); | 89 gaim_debug_error("bonjour", "Unable to listen to ichat connections"); |
90 | 90 |
91 // Free the data | 91 /* Free the data */ |
92 g_free(bd->jabber_data); | 92 g_free(bd->jabber_data); |
93 g_free(bd); | 93 g_free(bd); |
94 return; | 94 return; |
95 } | 95 } |
96 | 96 |
97 // Connect to the mDNS daemon looking for buddies in the LAN | 97 /* Connect to the mDNS daemon looking for buddies in the LAN */ |
98 bd->dns_sd_data = bonjour_dns_sd_new(); | 98 bd->dns_sd_data = bonjour_dns_sd_new(); |
99 bd->dns_sd_data->name = (sw_string)gaim_account_get_username(account); | 99 bd->dns_sd_data->name = (sw_string)gaim_account_get_username(account); |
100 bd->dns_sd_data->txtvers = g_strdup("1"); | 100 bd->dns_sd_data->txtvers = g_strdup("1"); |
101 bd->dns_sd_data->version = g_strdup("1"); | 101 bd->dns_sd_data->version = g_strdup("1"); |
102 bd->dns_sd_data->first = g_strdup(gaim_account_get_string(account, "first", "TODO")); | 102 bd->dns_sd_data->first = g_strdup(gaim_account_get_string(account, "first", "TODO")); |
103 bd->dns_sd_data->last = g_strdup(gaim_account_get_string(account, "last", "")); | 103 bd->dns_sd_data->last = g_strdup(gaim_account_get_string(account, "last", "")); |
104 bd->dns_sd_data->port_p2pj = gaim_account_get_int(account, "port", BONJOUR_DEFAULT_PORT_INT); | 104 bd->dns_sd_data->port_p2pj = gaim_account_get_int(account, "port", BONJOUR_DEFAULT_PORT_INT); |
105 bd->dns_sd_data->phsh = g_strdup(""); | 105 bd->dns_sd_data->phsh = g_strdup(""); |
106 bd->dns_sd_data->status = g_strdup("avail"); //<-- Check the real status if different from avail | 106 bd->dns_sd_data->status = g_strdup("avail"); /* Check the real status if different from avail */ |
107 bd->dns_sd_data->email = g_strdup(gaim_account_get_string(account, "email", "")); | 107 bd->dns_sd_data->email = g_strdup(gaim_account_get_string(account, "email", "")); |
108 bd->dns_sd_data->vc = g_strdup(""); | 108 bd->dns_sd_data->vc = g_strdup(""); |
109 bd->dns_sd_data->jid = g_strdup(""); | 109 bd->dns_sd_data->jid = g_strdup(""); |
110 bd->dns_sd_data->AIM = g_strdup(""); | 110 bd->dns_sd_data->AIM = g_strdup(""); |
111 bd->dns_sd_data->msg = NULL; /* TODO */ | 111 bd->dns_sd_data->msg = NULL; /* TODO */ |
112 | 112 |
113 bd->dns_sd_data->account = account; | 113 bd->dns_sd_data->account = account; |
114 bonjour_dns_sd_start(bd->dns_sd_data); | 114 bonjour_dns_sd_start(bd->dns_sd_data); |
115 | 115 |
116 // Create a group for bonjour buddies | 116 /* Create a group for bonjour buddies */ |
117 bonjour_group = gaim_group_new(BONJOUR_GROUP_NAME); | 117 bonjour_group = gaim_group_new(BONJOUR_GROUP_NAME); |
118 gaim_blist_add_group(bonjour_group, NULL); | 118 gaim_blist_add_group(bonjour_group, NULL); |
119 | 119 |
120 // Show the buddy list by telling Gaim we have already connected | 120 /* Show the buddy list by telling Gaim we have already connected */ |
121 gaim_connection_set_state(gc, GAIM_CONNECTED); | 121 gaim_connection_set_state(gc, GAIM_CONNECTED); |
122 } | 122 } |
123 | 123 |
124 void | 124 void |
125 bonjour_close(GaimConnection *connection) | 125 bonjour_close(GaimConnection *connection) |
126 { | 126 { |
127 GaimGroup *bonjour_group = gaim_find_group(BONJOUR_GROUP_NAME); | 127 GaimGroup *bonjour_group = gaim_find_group(BONJOUR_GROUP_NAME); |
128 BonjourData *bd = (BonjourData*)connection->proto_data; | 128 BonjourData *bd = (BonjourData*)connection->proto_data; |
129 | 129 |
130 // Stop looking for buddies in the LAN | 130 /* Stop looking for buddies in the LAN */ |
131 if (connection != NULL) { | 131 if (connection != NULL) { |
132 bonjour_dns_sd_stop(bd->dns_sd_data); | 132 bonjour_dns_sd_stop(bd->dns_sd_data); |
133 if (bd != NULL) { | 133 if (bd != NULL) { |
134 bonjour_dns_sd_free(bd->dns_sd_data); | 134 bonjour_dns_sd_free(bd->dns_sd_data); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 // Stop waiting for conversations | 138 /* Stop waiting for conversations */ |
139 bonjour_jabber_stop(bd->jabber_data); | 139 bonjour_jabber_stop(bd->jabber_data); |
140 g_free(bd->jabber_data); | 140 g_free(bd->jabber_data); |
141 | 141 |
142 // Remove all the bonjour buddies | 142 /* Remove all the bonjour buddies */ |
143 bonjour_removeallfromlocal(connection); | 143 bonjour_removeallfromlocal(connection); |
144 | 144 |
145 // Delete the bonjour group | 145 /* Delete the bonjour group */ |
146 gaim_blist_remove_group(bonjour_group); | 146 gaim_blist_remove_group(bonjour_group); |
147 | 147 |
148 } | 148 } |
149 | 149 |
150 const char * | 150 const char * |
402 if (gethostname(hostname, 255) != 0) { | 402 if (gethostname(hostname, 255) != 0) { |
403 gaim_debug_warning("rendezvous", "Error %d when getting host name. Using \"localhost.\"\n", errno); | 403 gaim_debug_warning("rendezvous", "Error %d when getting host name. Using \"localhost.\"\n", errno); |
404 strcpy(hostname, "localhost"); | 404 strcpy(hostname, "localhost"); |
405 } | 405 } |
406 | 406 |
407 // Creating the user splits | 407 /* Creating the user splits */ |
408 split = gaim_account_user_split_new(_("Host name"), hostname, '@'); | 408 split = gaim_account_user_split_new(_("Host name"), hostname, '@'); |
409 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); | 409 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); |
410 | 410 |
411 // Creating the options for the protocol | 411 /* Creating the options for the protocol */ |
412 option = gaim_account_option_int_new(_("Port"), "port", 5298); | 412 option = gaim_account_option_int_new(_("Port"), "port", 5298); |
413 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 413 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
414 | 414 |
415 option = gaim_account_option_string_new(_("First name"), "first", "Gaim"); | 415 option = gaim_account_option_string_new(_("First name"), "first", "Gaim"); |
416 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 416 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |