comparison libpurple/protocols/yahoo/libymsg.c @ 32767:2ec94166be43

On the way to hiding the PurpleConnection struct. * Added purple_connection_get_flags() and purple_connection_set_flags() * Use purple_connection_ accessor functions.
author andrew.victor@mxit.com
date Tue, 18 Oct 2011 18:47:48 +0000
parents 10e5000326a5
children 50cd80d3554e
comparison
equal deleted inserted replaced
32766:ea2b621fd3ba 32767:2ec94166be43
335 PurpleBuddy *b; 335 PurpleBuddy *b;
336 336
337 if (!name) 337 if (!name)
338 break; 338 break;
339 339
340 b = purple_find_buddy(gc->account, name); 340 b = purple_find_buddy(purple_connection_get_account(gc), name);
341 341
342 if (!cksum || (cksum == -1)) { 342 if (!cksum || (cksum == -1)) {
343 if (f) 343 if (f)
344 yahoo_friend_set_buddy_icon_need_request(f, TRUE); 344 yahoo_friend_set_buddy_icon_need_request(f, TRUE);
345 purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL); 345 purple_buddy_icons_set_for_user(purple_connection_get_account(gc), name, NULL, 0, NULL);
346 break; 346 break;
347 } 347 }
348 348
349 if (!f) 349 if (!f)
350 break; 350 break;
2178 case 12: 2178 case 12:
2179 purple_debug_info("yahoo", "Server reported \"is a buddy\" for %s while %s", 2179 purple_debug_info("yahoo", "Server reported \"is a buddy\" for %s while %s",
2180 who, (ignore ? "ignoring" : "unignoring")); 2180 who, (ignore ? "ignoring" : "unignoring"));
2181 2181
2182 if (ignore) { 2182 if (ignore) {
2183 b = purple_find_buddy(gc->account, who); 2183 b = purple_find_buddy(purple_connection_get_account(gc), who);
2184 g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the " 2184 g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the "
2185 "user is on your buddy list. Clicking \"Yes\" " 2185 "user is on your buddy list. Clicking \"Yes\" "
2186 "will remove and ignore the buddy."), who); 2186 "will remove and ignore the buddy."), who);
2187 purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, 2187 purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0,
2188 gc->account, who, NULL, 2188 purple_connection_get_account(gc), who, NULL,
2189 b, 2189 b,
2190 G_CALLBACK(ignore_buddy), 2190 G_CALLBACK(ignore_buddy),
2191 G_CALLBACK(keep_buddy)); 2191 G_CALLBACK(keep_buddy));
2192 break; 2192 break;
2193 } 2193 }
2212 GSList *l = pkt->hash; 2212 GSList *l = pkt->hash;
2213 int err = 0; 2213 int err = 0;
2214 char *msg; 2214 char *msg;
2215 char *url = NULL; 2215 char *url = NULL;
2216 char *fullmsg; 2216 char *fullmsg;
2217 PurpleAccount *account = gc->account; 2217 PurpleAccount *account = purple_connection_get_account(gc);
2218 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; 2218 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
2219 2219
2220 while (l) { 2220 while (l) {
2221 struct yahoo_pair *pair = l->data; 2221 struct yahoo_pair *pair = l->data;
2222 2222
3243 yd = purple_connection_get_protocol_data(gc); 3243 yd = purple_connection_get_protocol_data(gc);
3244 yd->fd = source; 3244 yd->fd = source;
3245 3245
3246 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, yd->session_id); 3246 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, yd->session_id);
3247 3247
3248 yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc)))); 3248 yahoo_packet_hash_str(pkt, 1, purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc))));
3249 yahoo_packet_send_and_free(pkt, yd); 3249 yahoo_packet_send_and_free(pkt, yd);
3250 3250
3251 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); 3251 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc);
3252 } 3252 }
3253 3253
3270 yd->fd = source; 3270 yd->fd = source;
3271 3271
3272 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, yd->session_id); 3272 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, yd->session_id);
3273 3273
3274 yahoo_packet_hash(pkt, "sss", 0, 3274 yahoo_packet_hash(pkt, "sss", 0,
3275 purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), 3275 purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc))),
3276 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), 3276 1, purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc))),
3277 6, yd->auth); 3277 6, yd->auth);
3278 yahoo_packet_send_and_free(pkt, yd); 3278 yahoo_packet_send_and_free(pkt, yd);
3279 3279
3280 g_free(yd->auth); 3280 g_free(yd->auth);
3281 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); 3281 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc);
3676 gboolean use_whole_url = yahoo_account_use_http_proxy(gc); 3676 gboolean use_whole_url = yahoo_account_use_http_proxy(gc);
3677 gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); 3677 gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE);
3678 PurpleUtilFetchUrlData *url_data; 3678 PurpleUtilFetchUrlData *url_data;
3679 3679
3680 purple_connection_set_protocol_data(gc, yd); 3680 purple_connection_set_protocol_data(gc, yd);
3681 gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; 3681 purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC);
3682 3682
3683 purple_connection_update_progress(gc, _("Connecting"), 1, 2); 3683 purple_connection_update_progress(gc, _("Connecting"), 1, 2);
3684 3684
3685 purple_connection_set_display_name(gc, purple_account_get_username(account)); 3685 purple_connection_set_display_name(gc, purple_account_get_username(account));
3686 3686
4474 "Content-Length: %" G_GSIZE_FORMAT "\r\n" 4474 "Content-Length: %" G_GSIZE_FORMAT "\r\n"
4475 "Cache-Control: no-cache\r\n\r\n%s", 4475 "Cache-Control: no-cache\r\n\r\n%s",
4476 YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str); 4476 YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str);
4477 4477
4478 /* use whole URL if using HTTP Proxy */ 4478 /* use whole URL if using HTTP Proxy */
4479 if ((purple_account_get_proxy_info(gc->account)) && (purple_proxy_info_get_type(purple_account_get_proxy_info(gc->account)) == PURPLE_PROXY_HTTP)) 4479 if ((purple_account_get_proxy_info(purple_connection_get_account(gc))) && (purple_proxy_info_get_type(purple_account_get_proxy_info(purple_connection_get_account(gc))) == PURPLE_PROXY_HTTP))
4480 use_whole_url = TRUE; 4480 use_whole_url = TRUE;
4481 4481
4482 url_data = purple_util_fetch_url_request( 4482 url_data = purple_util_fetch_url_request(
4483 purple_connection_get_account(gc), YAHOO_SMS_CARRIER_URL, use_whole_url, 4483 purple_connection_get_account(gc), YAHOO_SMS_CARRIER_URL, use_whole_url,
4484 YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, 4484 YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1,
4610 * just so that we don't inadvertantly reset their IMVironment back 4610 * just so that we don't inadvertantly reset their IMVironment back
4611 * to nothing. 4611 * to nothing.
4612 * 4612 *
4613 * If they have not set an IMVironment, then use the default. 4613 * If they have not set an IMVironment, then use the default.
4614 */ 4614 */
4615 wb = purple_whiteboard_get_session(gc->account, who); 4615 wb = purple_whiteboard_get_session(purple_connection_get_account(gc), who);
4616 if (wb) 4616 if (wb)
4617 yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY); 4617 yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY);
4618 else 4618 else
4619 { 4619 {
4620 const char *imv; 4620 const char *imv;
5260 gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type) 5260 gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type)
5261 { 5261 {
5262 PurpleConversation *c; 5262 PurpleConversation *c;
5263 5263
5264 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, 5264 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
5265 username, gc->account); 5265 username, purple_connection_get_account(gc));
5266 5266
5267 g_return_val_if_fail(c != NULL, FALSE); 5267 g_return_val_if_fail(c != NULL, FALSE);
5268 5268
5269 purple_debug_info("yahoo", "Sending <ding> on account %s to buddy %s.\n", 5269 purple_debug_info("yahoo", "Sending <ding> on account %s to buddy %s.\n",
5270 username, purple_conversation_get_name(c)); 5270 username, purple_conversation_get_name(c));