Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/EionRobb/skype4pidgin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2017-06-21 09:07:06 +0300
committerdequis <dx@dxzone.com.ar>2017-06-21 09:35:38 +0300
commitd48d9d509e8d033f0868ff724afb681124ed9f8c (patch)
tree63ce78778e82d0dd4d9b7b1dc9c78d5a4d4b2455 /skypeweb/libskypeweb.c
parent1b11ad7c96feaaa4161e13c899981614452924a0 (diff)
Add alternative login methods
These methods return better error messages, should be better at handling reconnections (because only obvious auth errors are marked as such), and will probably work with 2FA when combined with app passwords. This adds two closely related methods that return skypetokens in a fairly straightforward way. - For skype usernames: api.skype.com/login/skypetoken Takes an old style skype md5 hash. - For microsoft accounts: api.skype.com/rps/skypetoken Takes a ticket token (magic T) for "wl.skype.com" The only complicated part is getting that token. One way could be to use oauth with the code that is already implemented, but that's no fun. Instead, this uses SOAP login (login.live.com/RST.srf) from the MSN era. A little verbose but very reliable and simpler than scraping HTML. And it gets decent error messages. This is disabled by default, can be enabled with the "Use alternative login method" setting. Things left to be explored: - It's technically possible to use SOAP login for skype usernames too, but I got "Profile accrual is required" when I tried to request the wl.skype.com scope. It works for other scopes. - wl.skype.com and lw.skype.com are not the same thing, apparently. - I'm not doing anything regarding the 24 hour expiration. I'm not sure the term "refresh token" makes sense. - This could be combined with oauth too, for fun.
Diffstat (limited to 'skypeweb/libskypeweb.c')
-rw-r--r--skypeweb/libskypeweb.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/skypeweb/libskypeweb.c b/skypeweb/libskypeweb.c
index 6953fcd..c46de02 100644
--- a/skypeweb/libskypeweb.c
+++ b/skypeweb/libskypeweb.c
@@ -345,11 +345,19 @@ skypeweb_login(PurpleAccount *account)
sa->keepalive_pool = purple_http_keepalive_pool_new();
purple_http_keepalive_pool_set_limit_per_host(sa->keepalive_pool, SKYPEWEB_MAX_CONNECTIONS);
sa->conns = purple_http_connection_set_new();
-
- if (purple_account_get_string(account, "refresh-token", NULL) && purple_account_get_remember_password(account)) {
- skypeweb_refresh_token_login(sa);
+
+ if (purple_account_get_bool(account, "alt-login", FALSE)) {
+ if (!SKYPEWEB_BUDDY_IS_MSN(purple_account_get_username(account))) {
+ skypeweb_begin_skyper_login(sa);
+ } else {
+ skypeweb_begin_soapy_login(sa);
+ }
} else {
- skypeweb_begin_oauth_login(sa);
+ if (purple_account_get_string(account, "refresh-token", NULL) && purple_account_get_remember_password(account)) {
+ skypeweb_refresh_token_login(sa);
+ } else {
+ skypeweb_begin_oauth_login(sa);
+ }
}
if (!conversation_updated_signal) {
@@ -743,7 +751,7 @@ skypeweb_protocol_init(PurpleProtocol *prpl_info)
{
PurpleProtocol *info = prpl_info;
#endif
- PurpleAccountOption *option, *typing_type1, *typing_type2;
+ PurpleAccountOption *option, *typing_type1, *typing_type2, *alt_login;
PurpleBuddyIconSpec icon_spec = {"jpeg", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY};
//PurpleProtocol
@@ -753,16 +761,19 @@ skypeweb_protocol_init(PurpleProtocol *prpl_info)
option = purple_account_option_bool_new("", "", FALSE);
typing_type1 = purple_account_option_bool_new(N_("Show 'Typing' status as system message in chat window."), "show-typing-as-text", FALSE);
typing_type2 = purple_account_option_bool_new(N_("Show 'Typing' status with 'Voice' icon near buddy name."), "show-typing-as-icon", FALSE);
+ alt_login = purple_account_option_bool_new(N_("Use alternative login method"), "alt-login", FALSE);
#if !PURPLE_VERSION_CHECK(3, 0, 0)
prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option);
prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, typing_type1);
prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, typing_type2);
+ prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, alt_login);
prpl_info->icon_spec = icon_spec;
#else
prpl_info->account_options = g_list_append(prpl_info->account_options, option);
prpl_info->account_options = g_list_append(prpl_info->account_options, typing_type1);
prpl_info->account_options = g_list_append(prpl_info->account_options, typing_type2);
+ prpl_info->account_options = g_list_append(prpl_info->account_options, alt_login);
prpl_info->icon_spec = &icon_spec;
#endif