libpurple/protocols/facebook/api.c

changeset 37416
77536a48b4be
parent 37414
252bb96afbe0
child 37419
25bab54aa2fa
equal deleted inserted replaced
37415:a06ade737f26 37416:77536a48b4be
715 fb_http_params_set_str(params, "device_id", priv->did); 715 fb_http_params_set_str(params, "device_id", priv->did);
716 fb_http_params_set_str(params, "fb_api_req_friendly_name", name); 716 fb_http_params_set_str(params, "fb_api_req_friendly_name", name);
717 fb_http_params_set_str(params, "format", "json"); 717 fb_http_params_set_str(params, "format", "json");
718 fb_http_params_set_str(params, "method", method); 718 fb_http_params_set_str(params, "method", method);
719 719
720 val = fb_util_locale_str(); 720 val = fb_util_get_locale();
721 fb_http_params_set_str(params, "locale", val); 721 fb_http_params_set_str(params, "locale", val);
722 g_free(val); 722 g_free(val);
723 723
724 req = purple_http_request_new(url); 724 req = purple_http_request_new(url);
725 purple_http_request_set_max_len(req, -1); 725 purple_http_request_set_max_len(req, -1);
917 917
918 /* Write the STOP for the struct */ 918 /* Write the STOP for the struct */
919 fb_thrift_write_stop(thft); 919 fb_thrift_write_stop(thft);
920 920
921 bytes = fb_thrift_get_bytes(thft); 921 bytes = fb_thrift_get_bytes(thft);
922 cytes = fb_util_zcompress(bytes, &err); 922 cytes = fb_util_zlib_deflate(bytes, &err);
923 923
924 FB_API_ERROR_EMIT(api, err, 924 FB_API_ERROR_EMIT(api, err,
925 g_object_unref(thft); 925 g_object_unref(thft);
926 return; 926 return;
927 ); 927 );
1617 {"/orca_typing_notifications", fb_api_cb_publish_typing}, 1617 {"/orca_typing_notifications", fb_api_cb_publish_typing},
1618 {"/t_ms", fb_api_cb_publish_ms}, 1618 {"/t_ms", fb_api_cb_publish_ms},
1619 {"/t_p", fb_api_cb_publish_p} 1619 {"/t_p", fb_api_cb_publish_p}
1620 }; 1620 };
1621 1621
1622 comp = fb_util_zcompressed(pload); 1622 comp = fb_util_zlib_test(pload);
1623 1623
1624 if (G_LIKELY(comp)) { 1624 if (G_LIKELY(comp)) {
1625 bytes = fb_util_zuncompress(pload, &err); 1625 bytes = fb_util_zlib_inflate(pload, &err);
1626 FB_API_ERROR_EMIT(api, err, return); 1626 FB_API_ERROR_EMIT(api, err, return);
1627 } else { 1627 } else {
1628 bytes = (GByteArray*) pload; 1628 bytes = (GByteArray*) pload;
1629 } 1629 }
1630 1630
1683 1683
1684 g_return_if_fail(FB_IS_API(api)); 1684 g_return_if_fail(FB_IS_API(api));
1685 priv = api->priv; 1685 priv = api->priv;
1686 1686
1687 if (priv->cid == NULL) { 1687 if (priv->cid == NULL) {
1688 priv->cid = fb_util_randstr(32); 1688 priv->cid = fb_util_rand_alnum(32);
1689 } 1689 }
1690 1690
1691 if (priv->did == NULL) { 1691 if (priv->did == NULL) {
1692 priv->did = purple_uuid_random(); 1692 priv->did = purple_uuid_random();
1693 } 1693 }
2125 va_start(ap, format); 2125 va_start(ap, format);
2126 msg = g_strdup_vprintf(format, ap); 2126 msg = g_strdup_vprintf(format, ap);
2127 va_end(ap); 2127 va_end(ap);
2128 2128
2129 bytes = g_byte_array_new_take((guint8*) msg, strlen(msg)); 2129 bytes = g_byte_array_new_take((guint8*) msg, strlen(msg));
2130 cytes = fb_util_zcompress(bytes, &err); 2130 cytes = fb_util_zlib_deflate(bytes, &err);
2131 2131
2132 FB_API_ERROR_EMIT(api, err, 2132 FB_API_ERROR_EMIT(api, err,
2133 g_byte_array_free(bytes, TRUE); 2133 g_byte_array_free(bytes, TRUE);
2134 return; 2134 return;
2135 ); 2135 );

mercurial