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