diff options
author | dequis <dx@dxzone.com.ar> | 2016-12-26 21:29:30 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2016-12-26 21:29:30 -0300 |
commit | faa7abb613e71133fa190725ace3df794ca3cc30 (patch) | |
tree | c6778d1efb4327eb6e4f8683f44340e0047ede5d /protocols/purple/purple.c | |
parent | 1882b70857d9b8f9d68caa668e79614f376fb850 (diff) |
purple: hack to keep the purple-line auth token in the config
Diffstat (limited to 'protocols/purple/purple.c')
-rw-r--r-- | protocols/purple/purple.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index 7c65aa97..20166599 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -123,6 +123,7 @@ static gboolean purple_account_should_set_nick(account_t *acc) "prpl-hangouts", "prpl-eionrobb-funyahoo-plusplus", "prpl-icq", + "prpl-line", NULL, }; char **p; @@ -303,6 +304,11 @@ static void purple_init(account_t *acc) s = set_add(&acc->set, "gg_sync_contacts", "true", set_eval_bool, acc); } + if (g_strcmp0(prpl->info->id, "prpl-line") == 0) { + s = set_add(&acc->set, "line-auth-token", NULL, NULL, acc); + s->flags |= SET_HIDDEN; + } + /* Go through all away states to figure out if away/status messages are possible. */ pa = purple_account_new(acc->user, prpl_id); @@ -361,6 +367,11 @@ static void purple_sync_settings(account_t *acc, PurpleAccount *pa) if (pi->options & OPT_PROTO_MAIL_CHECK) { purple_account_set_check_mail(pa, set_getbool(&acc->set, "mail_notifications")); } + + if (g_strcmp0(prpl->info->id, "prpl-line") == 0) { + const char *name = "line-auth-token"; + purple_account_set_string(pa, name, set_getstr(&acc->set, name)); + } } static void purple_login(account_t *acc) @@ -956,7 +967,8 @@ static void prplcb_conn_progress(PurpleConnection *gc, const char *text, size_t static void prplcb_conn_connected(PurpleConnection *gc) { struct im_connection *ic = purple_ic_by_gc(gc); - const char *dn; + struct purple_data *pd = ic->proto_data; + const char *dn, *token; set_t *s; imcb_connected(ic); @@ -970,6 +982,13 @@ static void prplcb_conn_connected(PurpleConnection *gc) // user list needs to be requested for Gadu-Gadu purple_gg_buddylist_import(gc); + /* more awful hacks, because clearly we didn't have enough of those */ + if ((s = set_find(&ic->acc->set, "line-auth-token")) && + (token = purple_account_get_string(pd->account, "line-auth-token", NULL))) { + g_free(s->value); + s->value = g_strdup(token); + } + ic->flags |= OPT_DOES_HTML; } |