comparison src/protocols/bonjour/bonjour.c @ 11834:825d3ca6ffcd

[gaim-migrate @ 14125] Correctly restore the away/avail state for Bonjour at signon. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 26 Oct 2005 05:17:19 +0000
parents 4669e7461968
children 36c2e09c2cf9
comparison
equal deleted inserted replaced
11833:9d3ab7919ee0 11834:825d3ca6ffcd
71 bonjour_login(GaimAccount *account, GaimStatus *status) 71 bonjour_login(GaimAccount *account, GaimStatus *status)
72 { 72 {
73 GaimConnection *gc = gaim_account_get_connection(account); 73 GaimConnection *gc = gaim_account_get_connection(account);
74 GaimGroup *bonjour_group = NULL; 74 GaimGroup *bonjour_group = NULL;
75 BonjourData *bd = NULL; 75 BonjourData *bd = NULL;
76 GaimPresence *presence;
76 77
77 gc->flags |= GAIM_CONNECTION_HTML; 78 gc->flags |= GAIM_CONNECTION_HTML;
78 gc->proto_data = g_new(BonjourData, 1); 79 gc->proto_data = g_new(BonjourData, 1);
79 bd = gc->proto_data; 80 bd = gc->proto_data;
80 81
84 bd->jabber_data->port = gaim_account_get_int(account, "port", BONJOUR_DEFAULT_PORT_INT); 85 bd->jabber_data->port = gaim_account_get_int(account, "port", BONJOUR_DEFAULT_PORT_INT);
85 bd->jabber_data->account = account; 86 bd->jabber_data->account = account;
86 87
87 if (bonjour_jabber_start(bd->jabber_data) == -1) { 88 if (bonjour_jabber_start(bd->jabber_data) == -1) {
88 /* Send a message about the connection error */ 89 /* Send a message about the connection error */
89 gaim_debug_error("bonjour", "Unable to listen to ichat connections"); 90 gaim_debug_error("bonjour", "Unable to listen to iChat connections");
90 91
91 /* Free the data */ 92 /* Free the data */
92 g_free(bd->jabber_data); 93 g_free(bd->jabber_data);
93 g_free(bd); 94 g_free(bd);
94 return; 95 return;
101 bd->dns_sd_data->version = g_strdup("1"); 102 bd->dns_sd_data->version = g_strdup("1");
102 bd->dns_sd_data->first = g_strdup(gaim_account_get_string(account, "first", "TODO")); 103 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", "")); 104 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); 105 bd->dns_sd_data->port_p2pj = gaim_account_get_int(account, "port", BONJOUR_DEFAULT_PORT_INT);
105 bd->dns_sd_data->phsh = g_strdup(""); 106 bd->dns_sd_data->phsh = g_strdup("");
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
112 status = gaim_account_get_active_status(account);
113 presence = gaim_account_get_presence(account);
114 if (gaim_presence_is_available(presence))
115 bd->dns_sd_data->status = g_strdup("avail");
116 else if (gaim_presence_is_idle(presence))
117 bd->dns_sd_data->status = g_strdup("away");
118 else
119 bd->dns_sd_data->status = g_strdup("dnd");
120 bd->dns_sd_data->msg = g_strdup(gaim_status_get_attr_string(status, "message"));
112 121
113 bd->dns_sd_data->account = account; 122 bd->dns_sd_data->account = account;
114 bonjour_dns_sd_start(bd->dns_sd_data); 123 bonjour_dns_sd_start(bd->dns_sd_data);
115 124
116 /* Create a group for bonjour buddies */ 125 /* Create a group for bonjour buddies */