archrelease: copy trunk to community-any
[ArchLinux/community.git] / purple-skypeweb / trunk / make-the-opid-stage-optional.patch
blob04731421202090ddc06334e8f51c0b66814694a7
1 From 91b0d8a6114c66bf291ca8142c2ee2df12d3923a Mon Sep 17 00:00:00 2001
2 From: bodqhrohro <bodqhrohro@yandex.ru>
3 Date: Fri, 25 Sep 2020 17:56:38 +0300
4 Subject: [PATCH] Make the opid stage optional
6 ---
7 skypeweb/skypeweb_login.c | 55 ++++++++++++++++++---------------------
8 1 file changed, 26 insertions(+), 29 deletions(-)
10 diff --git a/skypeweb/skypeweb_login.c b/skypeweb/skypeweb_login.c
11 index 650cd67..a8c9d50 100644
12 --- a/skypeweb/skypeweb_login.c
13 +++ b/skypeweb/skypeweb_login.c
14 @@ -259,37 +259,34 @@ skypeweb_login_got_opid(PurpleHttpConnection *http_conn, PurpleHttpResponse *res
15 data = purple_http_response_get_data(response, &len);
17 ppft = skypeweb_string_get_chunk(data, len, ",sFT:'", "',");
18 - if (!ppft) {
19 - purple_connection_error(sa->pc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Failed getting PPFT value, please try logging in via browser first"));
20 - return;
21 - }
22 opid = skypeweb_string_get_chunk(data, len, "&opid=", "'");
23 - if (!opid) {
24 - purple_connection_error(sa->pc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Failed getting opid value, try using 'Alternate Auth Method' settings"));
25 - return;
26 + if (!ppft || !opid) {
27 + // Maybe this stage isn't needed this time: passing over the Magic T
28 + skypeweb_login_got_t(http_conn, response, user_data);
29 + } else {
30 + postdata = g_string_new("");
31 + g_string_append_printf(postdata, "opid=%s&", purple_url_encode(opid));
32 + g_string_append(postdata, "site_name=lw.skype.com&");
33 + g_string_append(postdata, "oauthPartner=999&");
34 + g_string_append(postdata, "client_id=578134&");
35 + g_string_append(postdata, "redirect_uri=https%3A%2F%2Fweb.skype.com&");
36 + g_string_append_printf(postdata, "PPFT=%s&", purple_url_encode(ppft));
37 + g_string_append(postdata, "type=28&");
39 + tmplen = postdata->len;
40 + if (postdata->len > INT_MAX) tmplen = INT_MAX;
42 + request = purple_http_request_new(live_login_url);
43 + purple_http_request_set_method(request, "POST");
44 + purple_http_request_set_cookie_jar(request, sa->cookie_jar);
45 + purple_http_request_header_set(request, "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
46 + purple_http_request_header_set(request, "Accept", "*/*");
47 + purple_http_request_set_contents(request, postdata->str, tmplen);
48 + purple_http_request(sa->pc, request, skypeweb_login_got_t, sa);
49 + purple_http_request_unref(request);
51 + g_string_free(postdata, TRUE);
53 - postdata = g_string_new("");
54 - g_string_append_printf(postdata, "opid=%s&", purple_url_encode(opid));
55 - g_string_append(postdata, "site_name=lw.skype.com&");
56 - g_string_append(postdata, "oauthPartner=999&");
57 - g_string_append(postdata, "client_id=578134&");
58 - g_string_append(postdata, "redirect_uri=https%3A%2F%2Fweb.skype.com&");
59 - g_string_append_printf(postdata, "PPFT=%s&", purple_url_encode(ppft));
60 - g_string_append(postdata, "type=28&");
62 - tmplen = postdata->len;
63 - if (postdata->len > INT_MAX) tmplen = INT_MAX;
65 - request = purple_http_request_new(live_login_url);
66 - purple_http_request_set_method(request, "POST");
67 - purple_http_request_set_cookie_jar(request, sa->cookie_jar);
68 - purple_http_request_header_set(request, "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
69 - purple_http_request_header_set(request, "Accept", "*/*");
70 - purple_http_request_set_contents(request, postdata->str, tmplen);
71 - purple_http_request(sa->pc, request, skypeweb_login_got_t, sa);
72 - purple_http_request_unref(request);
74 - g_string_free(postdata, TRUE);
76 g_free(ppft);
77 g_free(opid);